DIY Connected Espresso Machine: Relays (Part 2)

The second article continues the Connected Espresso Machine project (part 1) and will cover the question of how to control AC load via the microcontroller programmatically.

Theory

There are only two AC components in my espresso machine that can and should be managed with the microcontroller: boiler and pump. Both have two states only: on and off. So when an electric current is going through them they work, otherwise — not.

Hardware

What I had in my storehouse are TTi TRV-5VDC-SC-CD relays requiring 5V control signal and able to commutate 16A of AC current. That’s quite enough for the boiler and pump I have. The datasheet is available in the GitHub repository: https://github.com/loginov-rocks/Connected-Espresso-Machine/blob/main/docs/Hardware/Components/TRV-5VDC-SC-CD.pdf

Connect a Relay
BC337
Relay controlled by Arduino
Relay controlled by NodeMCU

Firmware

The hardest part of this article is done! :) Now to the software part — I will call it firmware as later we will introduce actual software like GUI or any back end components to support planned capabilities.

Test

Let’s do a quick sketch to test the Relay class:

Test Relay

Next Steps

The next step will be to onboard the second relay and thermistors and implement a separate class to control the boiler!

Solution Architect, IoT hobbyist, petrolhead