Example Code

Query for Connection with WSN

Code and Documents

Attachment

Download All

National Instrument's Wireless Sensor Node (WSN) is a powerful way to acquire data over a large area, but it does not operate like normal DAQ devices. There may be times that you want to find out when the node looses connection with the gateway. The gateway will know that it has been disconnected after 183 seconds of not receiving a "heartbeat" signal of the Link Quality. It will then communicate with Measurement and Automation Explorer that the Node is disconnected. If you need to know before 183 second, whether or not it has received this heartbeat signal, you can use this simple Query Connection WSN.vi.

WSN-fp.png

First action is to create a VI as shown below by dragging the Link Quality I/O variable from your project. You will need to be sure that the timestamp is enabled on your I/O variable by right clicking on the Link Quality variable in your project and selecting properties, inside the properties you can enable it. Then, show the timestamp on the I/O variable by right clicking ont he I/O variable on the block diagram and choose Timestamp->Show. This will allow you to use the created subVI.

WSN-bd.png

In order to properly use this VI, you cannot query the connection until after at least 5 seconds, this is because the Link Quality update only happens every 5 seconds. The Query Connection subVI is attached to this document.

National Instruments
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors