Introduction

The temperature-machine is a low cost, do-it-yourself data logger built around the Raspberry Pi and the DS18D20 temperature sensor. You can track ambient temperature over days, weeks and months and display some pretty graphs.

Distributed Design

The temperature-machine can run on one or more Raspberry Pis connected to one or more temperature sensors. One Pi acts as the hub or server whilst additional machines act as clients and upload their temperature data to the hub. The hub itself should be connected to a temperature sensor.

Each Pi can have up to five physical sensors attached. This is so that you can get an average temperature for the room (say, placing one sensor high in the room and another at floor level) or up to five individual temperatures. All temperatures will be graphed.

By convention, each machine will identify itself by it’s hostname. So, if you have a machine in the office, change the hostname (via raspi-config) to office.

The server broadcasts it’s address over the network. When clients start up, they wait to hear the broadcast and perform a basic handshake. The server’s broadcast message includes the servers address. So when a client hears it, it knows where to send it’s temperature data.

Example Setup

The following uses three physical Pi Zeros setup in the following configuration. Each has the room name set as the machine’s hostname.

  • study has the server with one sensor
  • bedroom 1 has a client with two sensors
  • kitchen has a client with one sensor

Hardware

Build it yourself with the following.

Item Price
Raspberry Pi Zero W £ 10
SanDisk 8GB microSDHC memory card £ 4
2.54mm Header strip £ 0.89
DS18B20 1-Wire temperature sensor £ 1.45
1 x 4.7k Ω resistor £ 0.10
Some jumper wires or otherwise recycled wires with connectors £ 0.97
Software (you’re looking at it) FREE
   
Total £ 16.44

Optional extras You could go for a regular Pi Zero (£ 4) and USB Wifi adapter (about £ 6), a case (I like the one from Switched On Components at £ 3.80) and a USB to TTL serial connection for headless setup. Something with a PL2302TA chip in it like this module or the Adafruit console cable. See my post on using a Pi Console Lead.