The relay module is a simple but powerful tool that allows hacking and controlling any external device easily
<aside> ⛔ Relays allow you to control the power in an external circuit. This is really useful for controlling appliances like lamps, sockets, etc. If you do this, keep in mind that when working with a relay and wiring in high current (amp) or high voltage (V) circuits you should be extremely careful. We will cover best practice in class
</aside>
For this we will use the SRD-03VDC-SL-C Relay
Depicted above is the SRD-03VDC-SL-C Relay on a breakout board
This is a breakout board containing a relay. A relay is very similar to a transistor in operation in that it’s designed to allow you to use a low powered microcontroller to act upon another high powered circuit. However, the two circuits are kept completely independent.
The relay is a mechanical switch (see below). It uses a magnetic coil to open or close a switch internally allowing power to flow to the other circuit. This is depicted below.
A relay can be used to quickly, and safely wire in and control external power.
A relay has three pins that you wire into, depending on what you want to achieve:
COM
- Stands for COMMON. you connect one side of the external circuit to this.NC
- Stands for NORMALLY CLOSED. In the default state, wiring to this pin will set the state of the other circuit to be closed, whereby electricity is always flowing. UNTIL you activate the coil (HIGH) and change the switches state, then electricity stops flowingNO
- Stands for NORMALLY OPEN. This means that electricity is unable to flow by default. You must activate the coil, to trigger the switch and allow electricity to flow.You get to choose the default behavior.