1. Create a VI to Read Temperature Values
First, create an empty project and add your NI WSN system.
1. Select Empty Project from the LabVIEW Getting Started window.
2. Right-click on the Project item and select New»Targets and Devices...

3. Select Existing target or device and expand the WSN Gateway folder.

4. Once your WSN gateway is discovered, select it and click OK.
5. Now create a new VI to read the WSN I/O by right-clicking on My Computer and selecting New»VI.

6. Place a waveform chart on the front panel of this VI.

7. View the block diagram of your VI by pressing <Ctrl-E>.
8. Expand the NI WSN-3212 measurement node in the project and drag TC0, TC1, TC2, and TC3 to the block diagram. These I/O variables read the temperature measured by the WSN node.

9. Use a Bundle function to group the I/O values and wire them to the waveform chart.
10. Place a while loop around this section of code.
11. Place a Wait (ms) function in the loop and create a stop button for the loop.

This simple application continuously monitors and displays the temperature values being returned by the NI WSN-3212 thermocouple node. However, many applications do not require every temperature value to be displayed. In the following section, add logic to the WSN measurement node so it transmits data only when the temperature exceeds a given threshold.
2. Add Node Intelligence with LabVIEW WSN
Using LabVIEW WSN, create a simple application that downloads wirelessly and runs embedded on the node to conserve power and extend battery life. This is accomplished by sending only meaningful data back to the gateway. In this example, transmit data only when a temperature exceeds 50 degrees.
1. Right-click on the NI WSN-3212 in the LabVIEW project and select Add LabVIEW WSN Target...
2. View the block diagram of the LabVIEW WSN template VI that is created for you and navigate to the Sample case. By default, this event reads the current temperature values and then transmits them to the gateway, as shown below.
You can optimize the behavior of this node to send data only when it is above 50 degrees. Additionally in LabVIEW 2011 and WSN Pioneer Module 1.3 you have the ability to create User-Defined Variables (UDV) and custom radio messages which allow for greater usability, as shown below. Most values such as AI and DIO can be sent using IOVS but UDVs can provide the user ways to send and receive data in another flexible way.



3. Place a case structure around the Radio Messages item.
4. Add four Greater? functions to the diagram and wire Temperature0, Temperature1, Temperature2, and Temperature3 to their X inputs.
5. Create a numeric constant of 50 and wire it to the Y inputs of the Greater? functions.
6. Wire the outputs of each Greater? function to a Compound Arithmetic OR function.
7. Connect the output of the OR function to the selector terminal of the case structure around the Radio Messages item. This logic causes the Radio Messages item to execute only when one of the temperature values exceeds 50 degrees. In all other scenarios, the radio is not powered on. If you want to send a custom message or receive a message you can use Radio messages VI built into the 2011 LabVIEW and WSN 1.3 Pioneer Module, shown below.

8. Save the VI as Temp threshold.vi.
9. Click the Run arrow.
10. Click Yes to create a new Build Specification.
11. Click OK to build the application. The embedded application is generated and then deployed over the air to run on the node. Once the node reboots, it transmits only temperature data when the temperature exceeds 50 degrees.

You have just used LabVIEW WSN to add intelligence to your NI WSN measurement node to extend battery life. View the Related Resources section below to learn about increasing acquisition performance and interfacing to sensors in addition to extending battery life with LabVIEW WSN.
3. Related Resources
White Paper: Introduction to the LabVIEW Wireless Sensor Network (WSN) Module Pioneer
White Paper: LabVIEW Wireless Sensor Network (WSN) Pioneer - Under the Hood
Tutorial: Getting Started with NI Wireless Sensor Networks
Programmable WSN Node Power and Performance Benchmarks
