MQTT and RRDTool

I mentioned in one of my earlier posts that Xively was nice as a quick test setup, but in the end I would like to have my data locally.

To this end I have installed Mosquitto as an MQTT server on a spare Linux machine in the office.  I changed the nRF receiver Arduino to send the sensor data to topics in Mosquitto. I used the PubSubClient for the MQTT connection.

The format of the topics are


device-id is the address of the remote sensor device

sensor-number is the sensor on the device 1, 2, 3 … etc

type is the type of the sensor temperature, light, battery, etc

This is working as expected, but the data is more or less thrown away unless we have something to subscribe to it!

So on the subscription side i wanted something up and running quick, so I found this snippet of perl code that subscribes to a topic extracts data from the message content and updates an RRD database. For the moment it just does the temperature data.

I then have a script that runs every so often to create some graphs from the rrd data.

The results can be seen here.

You Can Never Have Enough Sensors

Day 1

What to do today now the lawns weeds have been mowed? The solar powered sensor is back out in the garden and seems to be working and recharging its battery in the sun today. The receiver is pumping the data into Xively nicely. I have these bits laying about …

  • 2 x Arduino TwentyTens
  • 2 x nRF24L01 modules
  • 2 x ProtoShields
  • 2 x 10K NTC sensors
  • 2 x Dallas 18B20 temperature sensors
  • 2 x Light sensors
  • 1 x DHT11 humidity sensor
  • 1 x BMP085 pressure sensor
  • Plenty of time

Parts Please

Yes its pretty obvious – more RF sensors. Might also be handy to do some indoor range testing and a network/mesh of the nRF modules.

Day 2

Today I partially assembled the two prototype boards. So far the LDR and DS18B20 are fully functional, and the nRF module is soldered in place but not yet wired up. Looks neat and tidy.

Partially Assembled

Of course now it is partially assembled its always nice to know if everything is working. So here is some simple test code. Same story and usual, Google for some existing libraries, no need to write your own.

I ended up with these OneWire and Dallas Temperature

And the output (including other debugging not in the code)

Day 3

Another day with progress. Today I wired up the nRF modules and added some more code to send the readings to the receiver. Other than a snafu with one incorrectly wired pin, it all went without other issues.

Here is what the protoshield looks like now. Still pretty neat. I added the 10uF cap to the 3.3V line, cant remember why or if it is really needed, but my receiver has one so I figured it can’t hurt to have it installed. Yes the wires I have used (single cores from security cable) are really too think for anything too elegant but it was all I had laying about.

Radio Installed

Latest is now live on the Xively Stream.

  • 1000 is the external sensor in the garden
  • 07f3 & d1ad are the new internal sensors

Next up, Add the screw terminal and send readings for the remote NTC temperature sensor …