Wireless Sensor Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

WSN Buffer

Hello all,

 

I want to use WSN nodes in an environment where there are potential disconnections with the networks. That is why I am investigating the possibility of buffering some data (and/or averaging them) and send them upon reconnection. As I am relatively conservative with writing/erasing on the flash memory I would like to know:

 

1. How to make sure not to write in the flash memory when buffering data

 

2. How the gateway will receive those data (e.g. as a packet of data)

 

3. Is it possible to add a timestamp to the data collected?

 

Thank you in advance!

0 Kudos
Message 1 of 10
(9,127 Views)

Hi Settler,

 

By default the NI-WSN Driver will buffer somewhere around 7 measurements if it is not able to send them back to the gateway. You will simply need to read the IO variable 7 time from the host to get all the data once it has reestablished connection. You can use timestamps to determine when the measurement was taken. (see 3. to enable timestamping)

 

1. You have to explicitly write to the flash memory using the User Memory VI on the LabVIEW WSN VI that you are going to deploy to the target. The node will not write to flash on it's own. 

 

2. The Gateway will receive the data as you have defined the IOV. The Gateway will then convert that data to a Shared Variable that it or other labview programs can then use. You can also send data back using a User message. This will come back to the gateway as a string that you will have to parse. 

 

3. To enable timestamping on the data: In the LabVIEW Project, Right Click on the variable you want to add a timestamp to and select properties. In the Shared Variable Properties dialogue box check the Enable Timestamping box and click OK. Now you will be able to get timestamp information from the variables. 

 

You can implement your own buffer scheme using VIs deployed to the Nodes using the LabVIEW WSN module and programmable nodes. The simplest to code would be sticking the data into an array and then taking values out of that array to send it back. If you plan to use this scheme be careful of RAM usage as the node has limited resources and if you fill the RAM the node will reboot. You can monitor RAM by reading Available Heap and Available Stack using a config Node. A running average can also be implemented with a VI on the node. This would take a lot less space as you will only need to store 1 data point in RAM rather than the whole data set. 

 

Cheers,

Brian A

R & D Product Support Engineer | WSN/Network DAQ

National Instruments 

0 Kudos
Message 2 of 10
(9,119 Views)

Thank you very much!

 

My next problem is how to average the 5 last measurement and send the average value to the gateway every minute.

 

I have tried to store values into an array and then take the average which I want to "publish" to the gateway but nothing comes out in my chart. If I connect the individual readings it does show the values though.

 

Is there any hint I could have?

0 Kudos
Message 3 of 10
(9,083 Views)

Hi Settler,

 

To maintain a running average it would be better to use a shift register. An example which you can use to build your code can be found here.

 

Regards

Arham H
Applications Engineer
National Instruments
0 Kudos
Message 4 of 10
(9,055 Views)

Thank you very much for all the help. As I have found a lot of support from here (and hopefully will find in the future) here is a .vi that:

 

1. Transmits the signal whenever you set it (in the state case)

2. Averages over 5 readings (you can change that)

3. You can set the sub-sample step by the "wait for next ms multiple" control.

 

If anyone has ideas for improvement please contribute!

0 Kudos
Message 5 of 10
(9,039 Views)

Hi Settler.

 

Please, could you put a copy of your code in LabView version 11.

 

Thanks.

0 Kudos
Message 6 of 10
(8,545 Views)

Hi,

I am using labview 2013 ,I wanted to make buffer in Flash memory of WSN NI Node 3202 and then transfer them to NI WSN Gateway 9792.Please guide me how can I proceed ?

0 Kudos
Message 7 of 10
(7,371 Views)

Hi rita86,

 

Is there a specific reason you want to buffer to the flash memory? The flash has a limited lifetime of write cycles so should generally be used to store static values such as set points or look up tables. As long as the node is powered you can store values in an array on the block diagram as explained above. 

 

Assuming you have taken this all into consideration, you have a programable node, and still would like to buffer to flash you can follow this community example: Buffering Data on WSN Nodes

 

Cheers,

Brian A

R & D Mechanical Engineering | PXI Platform

National Instruments 

0 Kudos
Message 8 of 10
(7,362 Views)

Hi,

NI WSN Node 3202 its having RATE(Hz)  is 37.23  i.e it can give 37 samples ,it giving benchmark of 1sample/second  but in practical we measure somehow change the sample interval of Node 3202 then we get only 12 samples/sec which we verified.As talked to NI person they said "37 S/s can be acquired on the 3202, processed on the 3202, and an output of around 12 S/s can be sent to the Gateway. The maximum rate is subject to the processing done, but doesn't cross 15 S/s." 

 

So just to get more samples I want to buffer to the Flash Memory,I know Flash is having limited lifetime.Ni 3202 is programble , in Node Programming function blocks are given to store in Flash.I already seen this example to store in buffer but when can we use already function block given as in the given examples every VI is made they have not used any inbuilt labview Flash Buffer function block.

 

Please help me if anything can we done by using programming at Node to get more samples.

 

I dont know much about Node Programming well , may be I explained my problem to you clearly.

0 Kudos
Message 9 of 10
(7,331 Views)

The 37.23 Hz is possible as long as the code running in the programmable node is very basic. Please refer to the following documentation.

 

http://www.ni.com/white-paper/13161/en/

 

Basically, each additional processing task you include in the code will decrease the maximum achievable sample rate. So, in order to increase it, you need to simplify the code as much as you can.

 

In the example shown by Brian_A, custom VIs are used as you mention, but the VI that configures the buffer uses the User Memory VIs to write to the buffer. Please open the project and expand the WSN Node and WSN Target to find the WSN File Buffer.lvlib library, in which you will find the File Buffer.vi. This one is basically a Functional Global Variable that is used to initialize, write, read or clear the buffer depending on how and where it is called. If you check the block diagram in the "Write" case, you will see the Erase Sector.vi and Write to Sector.vi.

 

I believe you can study that VI and try to simplify the code to decrease the amount of processing done and you should be able to see a sample rate increase that way.

Camilo V.
National Instruments
0 Kudos
Message 10 of 10
(7,292 Views)