To control 230V/110V devices we mostly use a relay module. What is a relay? We may describe it as a button but instead of a mechanical switch, we have an electric switch. Bluntly speaking it has 230V switchable by 5V. This describe any relay but what about a module?
The module gives us better protection, a control circuit and a device circuit has galvanic separation, often a led to show status and nice mount points. And such module can have more that one channel, it is a group of relays nicely mounted on a single board.
Okey.. so what?
With such a module it is easier to control ‘big’ devices via small one. The light togglable via NodeMCU or Arduino. The fan that adjusts temperature or the gate opens when we get close. Or we may time-program a heater in winter. Easy to plug and easy to program.
We can distinguish two main construction of relays, electromagnetic and solid state.
Each of them has a control signal to switch outputs. A control signal can be AC or DC and relay can be made to switch AC or DC outputs. The module can have one or more channels, one channel is one relay with control signal and output.
The electromagnetic relay is more common. It’s cheaper, has a lower resistance but it has this annoying click sound and its life is limited, shorter than SSR (solid state relay). It is not heating too much. Can work with either DC or AC.
Two channel module looks like that (those big blue boxes are relays):
Solid state one is silent, has a longer life and is fast. It has no moving parts so it is less sensitive to an environment. It also does not generate sparks – can be used in the flammable environments. But when operating with big powers a heater is needed. Works only with DC or only with AC.
Two channel module (those small but long black boxes are relays):
I mentioned galvanic isolation. Why it is so important?
Imagine that we have a relay (not a module), we hooked a heater and to control it we use hmm.. Raspberry Pi. It works nicely until something goes wrong and there is a short circuit in the heater. Relay takes too much power and burns, connecting control circuit and heat circuit, power 230V goes directly to Raspi and it burns… taking other connected devices with it (and hopefully not starting a fire). Not good 😦
How can we protect? By drawing an uncrossable line between a heater and Raspi.
Bu using an opto-isolator in the control circuit. It is a nice device that has a photoresponsive transistor that turns on when internal LED is turned on. So we have a circuit connected to RPi that control LED and everything else is separated. This is good :).
See that two small black things? They are opto-isolators.
And that is why relay modules are so good 🙂