ESP32/ESP8266 Relay Module - Control AC Appliances (Web Server)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video you'll learn how to use and control a relay module with the ESP 32 RESP d2 66 a relay is an electrically operated switch that allows you to safely control voltages with lower voltages like the 3.3 volts provided by the ESP GPIO there are relay modules with one two four eight or more channels the number of channels determines the number of outputs you are able to control the relay module has a high voltage side for the mains voltage connections and the low voltage side for the control pins on the I voltage side you have sockets with three connectors common normally closed and normally open the current you want to control goes to the common socket and then you can choose to get the output on the normally closed or normally open connectors in the normally-closed configuration these pins are connected by default meaning the current is flowing and unless you send a signal from the ESP to the relay module to open the circuit and stop the current flow in the normally open configuration there's no connection between these pins so there's no current flow and unless you send a signal from the ESP to trigger the relay on the other side of the relay module you have VCC and ground to power up the module and input pins to control the relays if you are really module only has one channel you'll have just one input pin if you have eight channels you'll have eight input pins and so on the signal is sent to the input pins determines whether the relay is active or not the relay is triggered when the input pin goes below about two volts this means that you'll have the following scenarios in a normally open configuration you should send a low signal to activate the relay and have the current flowing in a normally closed configuration it works the other way around in many relay modules there is an extra set of pins these pins allow you to choose if you want to power the relay electromagnet using an external power supply or use the same power supply you provide through the VCC pin in this case the ESP power pin with a jumper cap on this pins are connected that means the relay later magnet is directly powered from the ESP power pin so the relay on your board are not physically isolated from each other without a jumper cap you need to provide an independent power source to power up the relays lateral magnet through this pin that configuration physically is elates the relays from your board with a modules built-in up the coupler now let's control a relay module with the ESP 32 RESP d2 66 using an Arduino sketch in this example we're dealing with mains voltage misuse can result in serious injuries if you are not familiar with mains voltage ask someone who is to help you out while programming the ESP are wiring your circuit make sure everything is disconnected from mains voltage the Cocteau controller relay with the ESP 32 RESP D 266 is as simple as controlling an LED or any other output in this example we're using the normally open configuration we need to send a low signal to let the current flow and the I signal to stop the current flow if you're using a normally closed configuration you send signals the other way around after uploading the code why are your circuit as shown in this schematic diagram if you are using an ESP 32 or follow this one if you're using an ESP D 266 then you'll see our lamp turning on when you send a low signal and turning off when you send a signal to control a relay module remotely you can use any web server example that controls outputs we've created a code that builds a web server example that allows you to control as many relays as you want whether they are configured as normally open or as normally closed you just need to modify a few lines of code this example requires that you have this libraries installed you can find the complete code and instructions in the companion blog post just click the first link in the video description in this example set is variable to true for a normally open configuration are set it to false for a normally closed define the number of relational you want to control in this variable for demonstration purposes we're setting it to five in this array variable you can define the ESP turkey to our yes PD 266 GP iOS that will control each of the relational we recommend taking a look at our ESP 32 RESP d2 66 GPIO guides to learn which pins are better to use to control relays finally insert your network credentials in these variables a plata culture board open the serial monitor press the reset button and you should get your board IP address follow one of these schematic diagrams dwyer the relay module tier board copy the IP address to your browser and you should get the web server with as many buttons as the number of relays you've defined in your code now you can control your relays remotely with your smartphone using this example for the final project make sure you place your relay module and ESP inside an enclosure to avoid any AC pins exposed we hope you find this video useful for the complete tutorial visit random nerd tutorials calm thanks for watching and don't forget subscribe
Info
Channel: Rui Santos
Views: 131,018
Rating: undefined out of 5
Keywords: rui santos, randomnerdtutorials, random nerd tutorials, ESP32 ESP8266 Relay Module Tutorial, ESP32 ESP8266 Relay Module Code Wiring Schematic Arduino sketch, ESP32 ESP8266 Control AC Appliances Relay Module, ESP32 ESP8266 Web Server Control Relay Module AC voltage, ESP32 ESP8266 Arduino wiring sketch web server multiple relay channels 1 2 4 8 16
Id: giACxpN0cGc
Channel Id: undefined
Length: 6min 10sec (370 seconds)
Published: Wed Dec 18 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.