Saturday, June 27, 2009

Wireless Sensors

For some time I've been interested in creating mashups with sensor data and something like Yahoo Pipes. This post describes the solution I created for data acquisition, which consists of Wireless Sensors and Wireless to Ethernet Bridges. Feature posts will be about applications that use this infrastructure to create interesting sensor data mashups.

The diagram bellow shows the solution architecture.



Using the Google App Engine I created a Java/Groovy application that provides a Whiteboard for sensors to post messages and to register for notifications about new messages from other sensors. The Whiteboard is made up of Topics, and each Topic has a Public Key and a Private Key. The Private Key controls write access to a Topic, and the Public Key controls the read access to a Topic (typically each sensor has a Private Key that it uses to publish data and zero or more Public Keys that it uses to read data created by other sensors) .

New message can be posted on a Topic by sending an HTTP POST request to the Topic Uri (i.e.http://cloudutilsj.appspot.com/topic/PRIVATE_KEY). After a message has been posted it can be retrieved by interested clients using the Public Key, this URI for example http://cloudutilsj.appspot.com/topic/c7ba6e1b6c849d37 returns XML representing the data published by a temperature sensor installed in my garage.

The API also allows access to the history of a Topic by appending the version number after the public uri, this for example http://cloudutilsj.appspot.com/topic/c7ba6e1b6c849d37/5868 will return the reading with version 5868 on the topic.




Bellow are some screenshots with the Wireless Sensor Boards I built. Each sensor board is made of 2 smaller boards: one has the microcontroller and it is connected to temperature, humidity or other types of sensors and the other one is the radio interface (I built these with nRF24L01+). The reason I separated them like this is extensibility: I can build new types of sensor boards or change the microcontroller and I will be able to reuse the same radio interface.





The Wireless to Ethernet Bridges receive messages from the Wireless Sensor Boards, format the messages as JSON and then they update using HTTP POST the Topic specified by each sensor.