HackSpace_-_April_2020

(Frankie) #1

TUTORIAL


WiFi heater upgrade with NodeMCU


YOU’LL NEED
NodeMCU
(hsmag.cc/zibTUx)
5 V PSU module
(hsmag.cc/L466kj)
S3003 Servo
(hsmag.cc/LJDKyp)
10 kΩ thermistor
10 kΩ
potentiometer
10 kΩ resistor
3 × 1N2001 diode
(or similar)
3D-printed dial
and gear
10 A 220 V Solid
State Relay
(hsmag.cc/KHNtWb)
Signal wire
(an old network
cable is ideal)
13 A mains
flex cable
(length to suit the
requirements of
your heater)
IP55 1-gang
enclosure
(hsmag.cc/dVhAgB)
IP55 2-gang
enclosure
(hsmag.cc/LK6TrD)

should display a simple webpage that tells you the
current temperature and the target temperature of
the heater.
The dial assembly connects to the mains control
box via three low-voltage wires. Two of the wires
carry the 5 V power to the dial assembly, connecting
to the Vin and GND pins of the NodeMCU. The third
wire connects to D5 (GPIO 14) on the NodeMCU, and

carries the trigger signal to the solid state relay. With
all of the low voltage wiring complete, now is a good
time to check everything is working as expected.
Power the NodeMCU with 5 V, and experiment with
the servo settings. You might have to fiddle with
the positioning of the gears on the servo and dial to
get the range of movement you need. It’s easiest to
remove the dial temporarily, set the temperature to
5°C (the minimum allowed temperature) using the

Right
The enclosure for
the dial houses the
NodeMCU and the
thermistor, which
is the metallic tube
poking out on the
left-hand side of
this image. The
thermistor could be
mounted remotely,
and the circuit
and app could be
modified to use
multiple thermistors
and relays. This
might be useful if
you want to monitor
indoor and outdoor
temperatures
from your phone,
or activate a fan
to circulate air
if one area gets
significantly warmer
than another

GOING ANALOGUE


The NodeMCU has one analogue input, but this project
uses two analogue devices. One solution would be to
use an I^2 C sensor to measure the temperature, or use a
chip like the MCP3008 to add a second analogue input.
A simple room heater doesn’t really need anything
that complex, and you can use a technique called
multiplexing to combine the outputs from the sensors
into a single input, and read them sequentially. There
are dedicated chips (like the 74HC4051) that will let you
multiplex eight or more different analogue signals, and
these are great if you want to expand this project to
read from multiple temperature sensors.
For working with just a couple of analogue sources,
it’s easier (and uses fewer digital pins) to isolate the
sensors from each other with a couple of diodes.
The diodes will prevent the output from the sensors
from interfering with each other, but you should be
aware that they will also cause the readings from
each sensor to be slightly lower than expected. This
isn’t a big problem, but it does mean that when you’re
doing something like calculating temperature from
a thermistor, you will need to adjust the input value
slightly to account for the effect of the diode on the
input. Adding 97 to the input from the ADC works well
for the temperature range used in this project.

You should now be able to
control the temperature
of your workspace with a
neat, reactive dial


Free download pdf