Saturday, July 10, 2010

Message in a Bottle

The Smart Heating Controller took a step further today with the addition of an ethernet shield from NuElectronics. I bought this back in 2008 but it took some aspiration and some updated code from Andrew Lindsay in order to get it to work.

The Arduino measures the temperature from six analogue thermistor channels and then PUTs them up to Pachube in a CSV format - but you can also browse them locally or remotely at the IP address of your router.

The readings are updated to the net about every 10 seconds, whilst the LCD is refreshed every second. The LCD shows the time, the 6 temperature readings and whether the circulation pump is on or off.

The rather scruffy breadboard below the Arduino terminates the cables to the thermistors - which are about 10m away. It also holds the potentiometer for setting the set-point temperature and the 433MHz wireless module for turning the boiler on and off.

I'm still trying to get the device to work reliably with Pachube. It showed signs of promise this afternoon, briefly PUTting data up to a Pachube feed, but when I integrated my LCD code, I have clearly introduced a bug to the overall program. After some serious back-tracking its now working correctly on Pachube Feed 8729

Personally, I've found the whole web client business a bit of a ball-ache, possibly because I'm a C newbie plus the fact that I'm unfamiliar with the methods involved. There has to be an easier method to get small low cost microcontroller systems to send messages to one another.

I've been thinking about how microcontrollers could communicate with one another efficiently, with low resource overhead, across a variety of communications links - ethernet/internet, wired and wireless networks.

I recently came across the MQTT messaging system developed by Andy Stanford-Clark and his team at IBM Labs, Hursley. Andy has demonstrated MQTT in his automated home and has a number of interesting applications - as described in this video.

Nick O'Leary, also at IBM, has developed a MQTT Client for the Arduino

To make use of MQTT you need to run a message broker application such as Really Small Message Broker RSMB - and in this document, Mark E. Taylor describes the end to end implementation of a network connected temperture sensor, using an Arduino with the RSMB running on a Linux machine.

RSMB is a proprietary IBM product, but there is at least one open source alternative - such as mosquitto by Roger Light.

Hopefully it will achieve momentum amongst the hacking community as an efficient way of messaging between low cost micros and other applications including Twitter etc.

2 comments:

Unknown said...

Whilst RSMB is IBM proprietary and MQTT is developed by IBM, the protocol is available online for anybody to implement.

I'm continuing work on an open source (BSD) licensed MQTT broker that can replace RSMB. It doesn't replicate all of the RSMB functionality yet, but it's probably fair to say that it covers about all of the most common needs. There are details and downloads at http://mosquitto.org/

Nick's arduino code is MIT licensed so you can use MQTT pretty well unencumbered.

Ken Boak said...

Roger,

Thanks for clarifying the origins of RSMB and your own mosquitto open source broker. I'll check out mosquitto later.

I'm not quite at that point yet - still strugging with print formatting in C code to get some linearised thermistor readings in centigrade up to Pachube.

I'm on a steep C learning curve right now - one step at a time.