3

(coco) #1
FORGE

mark off the intermediate positions. Use this
information to calculate how much cable is required
between each sensor. Also work out where you will
mount the Raspberry Pi (somewhere easily visible
and near a power supply), and how much cable is
needed between the Pi and the first sensor.

PREPARING THE HARDWARE
The next step is to solder the header pins to the
Raspberry Pi. The Blinkt! LED module is ideal as
it’s nice and easy to connect to the Pi, and the
existing Python library makes setting the colour and
intensity of each individual LED really simple. The
downside is that it covers all 40 GPIO pins, making
it difficult to connect anything else.
Even though it covers all the pins, it actually only
uses four of them – numbers 2 and 6 for 5 V power
and ground, and 16 and 18 for LED control.
The DS18B20 digital temperature sensors
run off the 1-Wire protocol. This means all data
communication is transmitted on one wire, no matter
how many sensors are connected. The Raspberry Pi
can read these signals on pin number 7 (GPIO 4). The
sensors also need a 3.3 V and ground connection,
which are taken from pins 1 and 9 respectively.
By pushing pins 1, 7, and 9 of the header through
the plastic strip before it’s soldered, the three
pins required for the temperature sensors are left
sticking out of the back of the Pi, while the other
37 stick forwards in the normal way. The Blinkt!

module is connected to the front, leaving the
three connections for temperature sensors easily
accessible behind.

WIRING THE SENSORS
The sensors used here are pre-wired, with
red (+3.3 V), black (ground), and yellow (data)
cables attached.
A 4.7 kΩ pull-up resistor is required between the
data wire and +3.3 V. After this, it’s a simple matter of
daisy-chaining the sensors together, connecting red
to red, black to black and yellow to yellow, each time
extending the chain by the length required to place
the next sensor further down the tank.

Above
Eight sensors are fitted at equal intervals from the top to the
bottom of the hot water tank

YOU’LL NEED
Raspberry Pi
Zero W (but
not the latest
version with pre-
soldered header)
Case
Power supply
40-pin 2 × 20
male header
Blinkt!
8 LED array
8 × DS18B20
temperature
sensors (it’s
easiest to buy these
pre-wired in a
waterproof casing)
4.7 kΩ resistor
30 g tube
of thermal
compound paste

As the hot water is used up, the level of cold
water rises up the tank. When the cold water
reaches the top, that’s it: cold showers all round.
This project works by having a series of
temperature sensors fitted to the side of the tank
at regular intervals. By connecting these to a
Raspberry Pi, the rising level of cold water can be
measured – so you can keep an eye on your hot
water consumption and put an end to unnecessary
cold showers.


MEASURING UP
The Blinkt! LED module has eight LEDs, so this
project uses eight sensors – each sensor controls
the colour of one LED, changing it from red when
the water is hot, to blue when it is cold.
The first step is to determine how far apart the
sensors need to be. The top sensor should be
close to the outlet in the middle of the cylinder.
The bottom sensor should be about 5 cm above the
point where cold water enters. Mark these points
on the outside of the insulation with a marker pen.
Measure the vertical height from the top sensor
location to the bottom one, divide by eight, and


Using a Raspberry Pi Zero and a series of
digital temperature sensors, this project
will show you exactly how much hot water
remains in the tank


Free download pdf