Wireless temperature sensor network

(November 2013)

Introduction

A few years back, I set up some 1-wire temperature sensors around my flat, hooked together with long runs of telephone wire. A small board converted 1-wire to RS232, and a mini-itx PC watched the temperatures with rrdtool making pretty graphs. This all worked great, but eventually I moved house and the new place wasn’t so amenable to long cable runs.

So, clearly I needed to build a v2, sans-wires!

The options

My main requirements were cost and low power. I wanted these things to be low maintenance so they needed to run off batteries for a long time. A while back, XBee seemed to be where it was at. But they’ve always been pricey - £20+ or so. Nowadays, there’s plenty of 802.11 options too, but 802.11 wasn’t designed with low power in mind.

In the end, I found a neat kit called a JeeNode which ticked all my boxes. It’s based around an Atmega328, and comes with an 868MHz FSK radio unit. So, I got three of those kits plus a Jeelink, which is the same board with a usb connector and a usb-serial FTDI chip built in. The plan was to hook up a ds1820 sensor to each jeenode, and have it chirp out the current temperature to the jeelink receiver, which would be attached to a server.

These jeenodes are ‘arduino compatible’, in the sense that you can use the arduino IDE (ick) and libraries (yay). They come with a decent bootloader, which is infinitely more pleasant than decanting the chip off to a hardware programmer like I used to.

Solder, solder

A few evenings later, I had my three Jeenodes soldered together and working. The first one took about two hours, but I managed the last one in an hour. I hooked up one to a ds1820 temperature sensor on a breadboard, and succesfully plotted the room temperature overnight with rrdtool.

Unfortunately, the ds1820 has the ground-data-vcc pins in a different order to the jeenode’s headers. I needed to make a little daughtboard to get the connections in the right order.

In my electronics box, I have some modern lead-free solder and some retro fully-leaded solder. I do keep trying to use the lead-free version, but every single time I crack and go back to the fully leaded variety. It’s just so much more suited to purpose. I’m not sure what I’ll do when my stash runs out - can you still buy leaded solder?!

Normally when I build circuits, I stuff one component into the board, solder it, and then add the next component. But when building several identical boards it became attractive to stuff several components at a time. Someone on the internet suggested using painter’s tape to hold the components in place. This worked quite well, and meant that I could leave the components legs unbent resulting in neater solder joint.

Software, barely.

One of the nice things about the post-arduino world is that everything is like playing with lego. To read the ds1820, there’s a library. To send packets over the rf12 radio, there’s a library. So the coding was disappointingly trivial. I’ve previously always written software for PIC and Atmega microcontrollers in assembly, mostly because the programs are always simple enough that it’s not a problem. But partly I did it because I originally learned to program on 8-bit cpus writing machine code, so I like the retro nostaligia. Given that my ‘real’ job involves coding at a high level of abstraction, I always think it’s nice as a hobby to eschew all that and get back the bare metal, irqs and no dynamic allocations.

But, having said all that, going the arduino route meant that I managed to solder together a 4 node sensor network and have it operational within a few evenings. And managing to complete a hobby project before my focus drifts elsewhere is not to be sniffed at!

– Andrew