Fun with JeeNodes and temperature sensors

Today (29th March) is Arduino Day 2014. I recently bought a JeeNode, a low-power Arduino compatible board. I chose a JeeNode USB module that has a built-in USB interface.

JeeNode USB

The USB interface can operate as a power supply, a programming port (using the open source Arduino IDE software). It also acts as a serial port, which is automatically installed on a windows machine and appears as a regular COM port. It’s also automatically detected on a Raspberry Pi running Raspbian, and normally appears as /dev/ttyUSB0.

The JeeLabs website is full of example code, and has downloadable zip that can be used in the Arduino IDE in minutes. One neat feature of the JeeNodes is that is has a wireless module that can easily send and receive data to another JeeNode. They are addressable, so you could place JeeNode sensors in different rooms, all reporting back to one central node. The radio modules are licence-free, with UK models running at 868MHz and 433Mhz, with a 915Mhz option if you’re in the US. I wanted to experiment with a few different temperature sensors, and see how they behaved.

I got hold of two modules. The first was a budget DS18B20 one-wire temperature sensor (I got this one on EBay as a module that has a pullup resistor and power LED built in), but you can buy the three-pin transistor-style device or a probe-on-a-wire for about £2. The data sheet describes an accuracy of ±0.5°C.

The second module was a JeeLabs Pressure Plug which has a BMP085 barometic pressure and temperature sensor. This is much more expensive at £15, but also gives us air pressure readings. The data sheet describes an accuracy of ±2.5 hPa pressure, and ±2°C.

The unexpected third sensor comes from the ATmega328 microcontroller at the heart of the JeeNode. It can measure its own internal temperature, and whilst not calibrated, if an offset is used it should be reasonably accurate assuming the processor does not overheat.

I pulled it all together, with the two temperature sensors plugged into the JeeNode USB. Samples are taken every second, averaged over 30 samples, and then a delimited string of average values is written to the serial port every 30 seconds. The JeeNode is plugged into a Raspberry Pi that is running a basic shell script. This reads the serial port for data, and once complete, runs curl to do a http post of the values to a web server.

On the web server, I store the different sensor values in an SQL database. I present the details using the Google Chart API, and a bit of jQuery to refresh things automatically. The results from the temperature sensors were interesting, here are 200 data points over 90 minutes:

Comparison of temperature sensors

Comparison of temperature sensors

Here we can see that the sensors follow the same temperature pattern, and have a reasonably constant offset. Given we know that the DS18B20 has the highest level of accuracy, and my lack of other temperature calibration tools, I decided to calibrate the other two sensors against the DS18B20. I took those readings and created an average offset of -1.4°C for the BMP085, and +1.7°C for the internal measurement.

Adding the offsets has helped bring them back into line. My temperature website now shows the sensors with almost identical values:

Sensor readings after offset values

Sensor readings after offset values

Once I have a few more days of data, I’ll re-average these and see if there is a more reliable offset value.

The final question comes from barometic pressure. My readings for today come from the device as 1008hPa. I live roughly half way between Heathrow and Farnborough airports. The QNH values for these airfields (the barometric pressure adjusted to sea level) has been a pretty constant 1013hPa. I live at 24m above sea level (again, based on the nearby airfield at Fairoaks) which means that my local air pressure (QFE in aviation terms) should be 1010hPa. This is within the accuracy of the sensor. I’ve therefore added an offset on my sensor of +2hPa.

I’ve added this to my final display:

Final temperature and pressure dashboard

Final temperature and pressure dashboard

I’ll see how this behaves over the next few weeks, and will use this to log how our heating usage varies over the next few weeks when our central heating controller is swapped for a British Gas Hive controller.

Leave a Reply