
Connect Vcc or + pin of relay with Vin pin of ESP32. Connect ground pin of relay with ground pin of ESP32. You can read ESP32 GPIO pins tutorial for further details on GPIO pins. Connect GPIO22 with control signal pin of relay. We are using GPIO22 of ESP32 to provide active high signal to relay. We will connect low voltage side of relay with ESP32. Connect other terminal of lamp with COM pin of relay. Connect 220 volts connector one terminal with lamp one terminal and another terminal with NO pin. SRD-05VDC-SL-C 5V Relay module does not work on inverted logic.
You should check your relay module functionality before using it. Inverted logic means active low signal will activate the relay and active high signal will tur off the relay. Note: Some relay modules have transistors which works with inverted logic. In short, when we send an active high signal from ESP32, relay turns on and when we send active low signal from ESP32, relay turns off and similarly lamp turns on and turns off. As soon as we will apply active high signal to control pin of relay through GPIO pin of ESP32, relay will become activate and lamp lights up. Normally there will be no contact between COM and NO pins and lamp will remain off. To do so, we will use COM pin and NO pins of high voltage side of relay. Because we want to light up the bulb with active high signal. We will be using normally open configuration in this project. Now make this layout on breadboard according to the connection diagram shown here: You are using HIGH voltage in this project, please take all precautions before making this layout. Warning: Before making this circuit diagram, make sure you have not connected ESP32 and lamp with power supply.
Power supply connector Connection diagram of relay and lamp with ESP32. You will require following components to build ESP32 remote control relay project: Through which type of signal, you want to turn on or turn off relay. So, you can choose either pin according to active high or low signal. Normally closed: if you use normally close pin, active low signal activates the relay and active high signal on signal pin will deactivate the relay. Normally open: If you use normally open pin, relay will activate with active high signal on control pin and active low signal turn off the relay as shown in figure below: Depending on NC or NO, you will use active high or active low signal to control the relay. You always use common pin and either normally open pin or normally close pin to connect load. There are two contact pins that are normally open and normally closed. It makes the circuit complete and load turns on. When we apply active high signal at the signal pin from any microcontroller like ESP32, relay contact move from normally open to normally close. Table given below provides details on functionality of each pin Pin Name Pin function NC Normally closed terminal (120-240V) NO Normally open terminal (120-240V) Common Common terminal to connect one led of load Vdd 5V pin (connect with ESP32 Vin pin) Ground Connect with ground pin of ESP32 Signal pin Control pin for relayĪs shown in relay module picture, it also has other components and relay in the middle of board. electrical loads and 220 volts power supply and other three pins are used for low voltage side namely vcc, ground and control signal pin. Three pins are used to connect with high voltage side i.e.
It works on and can be used to control output loads from 120-240 volts and current range of 10A. However, I will be using SRD-05VDC-SL-C 5V Relay module. ESP32 will give signal to relay depending upon the button state from a web page. We will use a button on web page to control a relay. You will use a relay as a switch to control 120-220 volts lamps. We have to use a relay between ESP32 and lamp. We can not interface these AC loads directly with ESP32 development board. Light bulbs usually operate on 120 volts or 220 volts power supply in case of AC main supply.
ANDROID WEB SERVER LAMP HOW TO
How to control 5 volts relay with Arduino Why we need to use relay?. Introduction to Electromechanical relays. You can read these articles to gain further details on relays and their working. When coil fully energized, contact shift from normally open position to normally close position.
When we supply dc voltage across the coil, it starts to energize. We generally apply dc voltages to coil and connect load across normally open and close contacts. Relay is an electromechanical device that is used as a switch between high current and low current devices.
Video demo Introduction to a relay module. How to access Web Server to control lamp. Controlling relay module remotely with ESP32. Connection diagram of relay and lamp with ESP32.