In the first part of this tutorial, we have covered the basics of MQTT, How it works, its advantages, and insight into the Reyax MQTT broker. In this tutorial, we will apply our gained knowledge and create a home automation board that is like a board inside a smart plug. We will be using ESP8266 with a relay board and for the time being, we will use an LED in place of any appliance. When the board is powered ON and connected to the broker, we will be able to control the onboard LED over the internet through an app installed on our mobiles or tablets. Sound Fun isn't it? Another great thing is that we are going to mount all these on a PCB so there is no mess due to wires and also we can modify it to have 12 relays and control 12 different appliances through a single board. You are definitely going to like it so let's not waste any time and move straight to the business end.
You can check Part - I of this tutorial from here and you can also check the video description for Part- I from here.
Get PCBs for Your Projects Manufactured
You must check out PCBWAY for ordering PCBs online for cheap!
You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop.
What Is a Relay?
The Relay Module is a convenient board that can be used to control high voltage, high current loads such as lamps and AC loads. A power relay module is an electrical switch that is operated by an electromagnet. The electromagnet is activated by a separate low-power signal from a microcontroller. When activated, the electromagnet pulls to either open or close an electrical circuit It is designed to be easily interfaced with microcontrollers such as Arduino, ESP8266, etc. The relay modules generally have the following terminals:
NC(Normally closed)= The normally closed configuration is used when you want the relay to be closed by default, meaning the current is flowing unless you send a signal from the Arduino to the relay module to open the circuit and stop the current
NO(Normally Open)= The normally open configuration works the other way around: the relay is always open, so the circuit is broken unless you send a signal from the Arduino to close the circuit.
Common pin= It is generally in the middle
Input pins= These are the pins through which the relay is connected to the controlling device.
If not mentioned on the module we can find out the NC pin using a multimeter in continuity setting by connecting the common with the other terminal through multimeter probes if it creates a beep sound then the pin is NC.