These ESP8266-based boards are cheap and easy to work with, costing around $2.50 when purchased from Chinese suppliers online. The ESP8266 is a popular chipset for prototyping IoT devices in Arduino and happens to be perfect for this application.īecause the ESP8266 chip is so easy to program, we can select a development board like the D1 Mini or the NodeMCU to combine with a power relay.
When the microcontroller we connect it to also has the ability to connect to Wi-Fi, it becomes possible to operate the relay remotely from any device connected to the same network. Once we have a relay able to respond to a sensor, we can control it even more precisely by communicating with it through a microcontroller. By choosing which terminal we plug into, we can decide if we want our switch to normally be connected or disconnected to power before we sent it a signal to switch. When the signal input gets power, the electromagnet turns on and completes the circuit, causing the normally disconnected circuit to connect to power, as well as the normally connected terminal to disconnect from power. Another three inputs are used to connect the relay to a power source and signal used to switch on and off an electromagnet inside the relay. On the inside, a relay has three power inputs: a terminal that is normally connected to power, a terminal that is normally disconnected from power, and the "common" terminal where we plug in the power we want to switch.
A relay is an electrical component that works like a light switch, where it's turned on or off with an electrical signal.