tinyos

Not sampling at 5 ms when I increase NREADINGS to 2 in the Oscilloscope application (TinyOS)


In the TinyOS Oscilloscope application on micaz motes, when I set the sampling rate to 5 ms with NREADINGS = 1, I notice the blinking of the green LED going really fast. But when I set NREADINGS = 2 and sampling rate to 5 ms, I notice the blinking becomes slower which means I am sending fewer packets than in the previous case. Is there any way I can get the blinking to be faster, that is, can I do something to increase the number of packets I send at NREADINGS = 2 and sampling rate equal to 5 ms?


Solution

  • The sampling rate determines how often the Oscilloscope application samples a sensor. NREADINGS determines how many samples the application obtains before it sends them in a radio packet. LED blinks each time the application sends a packet. Therefore, if you increase NREADINGS from 1 to 2, it will blink approximately every 10 ms instead of 5 ms (every two samples).

    If you want to send packets with the same frequency when you increase NREADINGS, at the same you have to decrease the sampling interval. Note, however, that sampling a sensor as well as sending a packet takes some time, so there are some constraints on how fast the application can work.