HackSpace_-_April_2020

(Frankie) #1
FORGE

MOVING BY HAND


If you’ve ever tried to move a live servo by hand, you’ll
know that even if you can get it to move, it will just
spring back to its set position as soon as you let go.
That isn’t very useful behaviour for this project, because
the user needs to be able to turn the dial by hand, and
have it stay where it’s put. The answer is to only power
the servo when it’s needed, and let it free-wheel when
it’s not being used. Although cutting the power to the
servo using a relay or transistor might seem the most
obvious way to get this behaviour, there’s a much simpler
solution. If you detach a servo using the detach()
function in the Servo.h module, the NodeMCU will
stop transmitting the position signal to the servo, and it
will free-wheel. Obviously, this only works with servos
that use conventional gearing – high torque servos
and servos that use a worm gear will be difficult, or
impossible, to move when they are powered off.

the dial is both a control and a display. If you change
the thermostat remotely, you need to adjust the
position of the dial to reflect the new settings.
This project relies on a low-cost servo connected
to a potentiometer to control the position of the dial.
When the user changes the target temperature using
the webpage, the NodeMCU starts moving the servo,
and checking the value of the potentiometer on the
dial. When the potentiometer value reflects the target
temperature, the servo disconnects. The project


requires minimal additional circuitry, but it does require
access to a 3D printer to make the gears that connect
the servo to the potentiometer. The best place to start
is by printing these parts and assembling the dial. The
printed parts are designed to fit into the lid of an IP55
junction box with all of the low voltage components,
but there’s no real limitation
on the enclosure that you use
as long as it is electrically safe.
Mains voltage parts of this project
are fitted into a separate IP55
junction box near to the heater.
This second box contains a 5 V
power supply for the NodeMCU
and servo, and a high-power solid
state relay to control the heater.
With the dial assembled,
you can start wiring up the
potentiometer and thermistor
as shown in the circuit diagram
for the project. Flash the
heater control sketch onto
the NodeMCU, edit the code
to match the username and
password of your WiFi, and use
the Arduino IDE’s serial monitor
or your router to find out the
IP address assigned to the
NodeMCU. Visiting the device’s
IP address in your browser

Main Live
Heater Live

V3.0 LolinNodeMCU

Servo
pulse

+





U2

J1

U1

R310kΩ

R110kΩ

1N4001D1

D21N4001

R2NTC

VinGNDRSTEN3V3GNDSKS0SCS1S2S3VUGNDA0

3V3GNDTXRXD8D7D6D5GND3V3D4D3D2D1D0

Above
The pinout of the
NodeMCU can be a
bit confusing if it’s
the first time you’ve
used it. The pin
labels on the board
(D1, D2, etc.) don’t
actually refer to the
pin numbers used
in the Arduino IDE.
The pin numbers
recognised by the
Arduino IDE are
the GPIO numbers
shown in this
diagram. So, D1 on
the NodeMCU is
digital pin 5 in the
Arduino IDE, and
D2 is pin 4. There
are some other
constraints with the
digital pins, because
only pins D2, D5, D6,
and D8 can be used
for PWM control
Left
The low voltage side
of this project is
quite straightforward
Free download pdf