Monthly Archives: April 2013

Raspberry Pi temperature logger

Raspberry Pi (boxed) temperature logger

OK, so a while ago I built a little temperature measuring system using an Arduino Uno, an Arduino ethernet Shield, a real time clock module and some digital 1-wire temperature sensors. I hooked up a serial interfaced LCD display to display information such as IP address, time, date and the temperature readings and sat it running and logging data to a micro SD card.

Where I left the post, I was planning on implementing more functions to the system, basically to serve web pages containing graphics (temperature charts) as well as store data and to implement an email alerting system.

But I ran into a basic problem that is the limited memory on the Uno. From yesteryear I remembered doing some Z80 assembler programming and writing some BASIC programs on a Sinclair Spectrum with only 32 kB of memory. I think that probably led me into a false sense of freedom on the Uno; with my skills limited to programming in wiring, I just could not cram in all the functions I wanted on this small device.

Truth be told, the Uno was really a stopgap whilst I was waiting for my Raspberry Pi to be delivered.

Well, now it’s here, or rather they are here, as I ended up buying two. Well, actually three, but the last one is owned by work …

I decided that the best way forwards with the higher resolution temperature logger/server project was to do it all on a Raspberry Pi. I bought one to start playing with and then realised that some of the configurations I had set up on the Pi had to be changed to trial alternative software hardware solutions and rather than keep changing the same single Pi, I bought a second one to experiment with. This also let me take a Pi away for Xmas leaving the other one running 24/7 to continue logging, as a sort of unattended test.

Having arrived at the optimum software/hardware configuration, I got work to order the various parts from their main electronics supplier (RS) and then built a copy if the optimised system for them, modifying the SD card contents to match the IT systems at work (and getting permission from the IT department to connect the device). So now three Raspberry Pis are running different versions of my system, two at home and one at work. All three log temperatures. One logs my router and itself (!) as well. That was my first Pi and the one that I crammed with most trials.

All three Pis are running Raspbian, generally the latest version (2013-02-09) but Pi1 is lagging slightly behind on the updates. For some reason, I had issues getting it to accept the main updates via sudo apt-get upgrade – it tended to red-light (the Pi’s version of BSOD) after restarting. I might try another upgrade soon after taking an SD card backup.

Pi1 is running MRTG and CACTI, for data capture. It interfaces to a pair of DS18B20s via a breadboard and to the same Sparkfun serial interfaced LCD (PPLCD-09395) that I used on the Arduino.

Pi2 is running a modified version of the code from NETTEMP for data capture, and display. A single DS18B20 is interfaced using a 1-wire to USB adaptor from Sheepwalk (model: DS9490R). At the moment, NETTEMP requires a device like this since it relies on Digitemp for its 1-wire interfacing. It also runs an experiment using Dygraphs to produce a zoomable temperature graph.

Pi3 is running CACTI for data capture, a pair of DS18B20 temperature sensors (RS: 5402805), a 16 x 2 LCD display (RS: 5326436) and sits inside a slightly too large plastic box (RS: ) which our nice engineering team machined to fit the ethernet and USB sockets of the Pi and a cutout for the LCD screen. A couple of extra holes for the sensor cables and a hole for the USB power lead complete the hardware. Inside the case, the LCD is connected to the GPIO using a 26 way ribbon cable and push fit IDC connector. Several of the ribbon wires are separated (torn away…) to connect to the DS18B20s in a rather amateurish way. So I don’t think I’ll be showing pictures of that bit of the build !

More about the choices behind the various hardware/software options will follow in a later posting. Essentially, I was trying to find a system that had all the functionality I needed but that would also be robust, maintainable, scalable, and usable by people other than me.

PS if anyone is looking for a nice engineering/kickstarter project for the Raspberry Pi, I would love to see the following case:

Big enough for a Pi and a display (e.g. 16 x 2 LCD, 16 x 4 LCD, small display screen).
Nice material, perhaps aluminium.
Ability to mount to something (e.g. magnetic back plate, plus wall mounting screw holes).
Integral PSU or moulding for USB power lead to the socket on the Pi with cable relief gland.
Light pipes for the LEDs.
Some form of breakout connector for the GPIO pins.


There are several nice cases out there, but few of them are much bigger than the Pi itself, meaning there is no room to mount other items in the case, such as an LCD display and the necessary cabling. I really would like a case that fits all of the above hardware inside in a neat and tidy fashion, and lets the case mount somewhere. For home use, I would like a really nice looking case, perhaps something like the Proto Armour Raspberry Pi Enclosure Kit which has almost everything I want, except the extra room for the display, same with this case from PiHolder.com (both these are USA based but ship to Europe, but I’m wary of the import duties and tax on such items).

 

Anyway, time for a few pictures from the logs.

 

Monthly temperature plot from modified Nettemp code - click to enlarge

 

2 DS18B20 temperatures tracking each other (from Cacti)

 

snr Traffic Graph

MRTG's ADSL modem SNR ratio - oh dear, what happened at 7 pm?

 

 

Raspberry Pi - load average (from Cacti)

 

Finally a rather large graph generated by Dygraph, based on a simple text file data store, updated every minute:

 

Dygraph temperature plot - click to enlarge