Blog

Posted 2006/10/24

First real sensor test

I wrote a small application to measure the amount of light in the PEDAL lab and log it to a MySQL database. This post describes the setup, shows the results as a graph and summarises some of the things that were learned such as inaccuracies with the TinyOS timer component.

The application was written from scratch rather than adapted from an example, the idea being to prove that I really do understand how to program the Crossbow kit. The app runs on a Mica2 mote with a sensor board attached. The amount of light is measured every 30 seconds and the measurement with some metadata is send to a PC using the serial port. A Java application running on the PC interpreted data and inserted it into a MySQL database running on our development server. The application was left running over night and took 2000 measurements.


Time vs Light

The graph above (click for bigger version) shows the amount of light in the PEDAL lab between 6pm and 10am. You can clearly see when lights were turned on at 8 and 10am.

By looking at the timestamps in the raw data I could see the cumulative effect of inaccuracy in the mechanism used to wait 30 seconds. The mote completed the 2000 measurements in 58,500 seconds, this meant that on average it was waiting for approximately 29.3 seconds between measurements and not 30. This adds up to 24 minutes after 2000 measurements and shows that using the TinyOS timer component has inaccuracies that will need to be considered when developing mote applications. This was the expected result but as least now we have measured it’s effect first hand.

The next step in this work is to dynamically create graphs from the database. I will then look at improving the mote application.