Monday, February 7, 2011

Arduino HTLSensorNode with Android data visualization

It has been some time since my last post, but I wasn't lazy at all. I combined some of the tutorials you might have seen before on this blog, to build a HumidityTemperatureLight Sensor Node. In short HTLSensorNode.
It is basically an Arduino Uno board with an extension shield for HTTP communication and sensors for environmental measurements.

I used a WiFly Shield on top of an Arduino Uno, but you could also use an Ethernet Shield with some minor code modifications.
The additional parts I used are the SHT15 breakout board from sparkfun, a simple photoresistor which you can find in any electronics store, a 10k resistor, a plastic enclosure designed for the Arduino and some connector cables.

Stack either of the shields on top of the Arduino and connect the sensors to the shield in the following way:






My setup looks a little raw and I will clean up the cable mess in the future but here it goes:

WiFly Shield with Sensors

Humidity and Temperature Sensor (left), Photoresistor (bottom right)


Project neatly embedded in enclosure
To address each sensor individually or all sensors at once, I implemented primitive pseudo JSON responses in the Arduino code to provide a really primitive REST interface. There is a JSON library for Arduino called aJson which you might want to check out if you want to do more JSON like projects. For my purpose however it was overhead to use it as I only needed some predefined responses.

To visualize the sensor readings I built a simple Android app which shows the sensor readings in a 5 second interval. By choosing a smaller interval you risk that the Arduino can't catch up with the responses. However sometimes the request got stuck anyway on the Arduino side, so I configured a timeout in the Android code.

Here is a quick demo of the project. Sorry for the bad video quality. My cheap camera had no autofocus.



Update:
I deleted this version of the Arduino code and the Android code from github. Have a look at the extended HTLPSensorNode project instead. The new project code can be found at github. Feel free to download and improve it. Have fun!