Secondary Menu

Wifi Relay With ESP8266

This wifi relay can controls any device like lamps or your soldering station with your smartphone or your computer.

Step 1: Materials and Tools

To make this wifi relay you will need:An Esp8266, which can be program like an arduino and have wifi built inAn USB to TTL converter for programming the esp82662 relays 220vac control by 12v2 transistors TIP1226 diodes IN4007A few resistances (2x1k, 2x10k, 330, 220)Some screw terminal and pin headers A plug in2 plugs outA transformer 12vA power switch2 meter of 3 wires cableA lm317Capacitors 50v of 1000uf and 10ufPrototypes pcbSome screws

For the tools you will need a solder iron, a drill, a 3d printer (optional) and sandpaper.

Step 2: The Relay Board

I divided the electronic in two boards:- the relay board with the 2 relays and 2 transistors- the esp8266 board with the module and all the power part (transformer, bridge rectifier and the lm317 for the 3v3 regulate)

This board is very simple, it consists of 2 mosfets how control 2 relays.I made this board by placing all the components on the Prototype pcb and then I cut the it in the right size with a saw. I solder all the components and after I link them with wire. Pay attention of the diameter of the wire when connecting relay, you should use bigger one for the high voltage.

Step 3: The Main Board

The main board has 3 parts:-the 12v power which is a bridge rectifier (four diodes) and a capacitor.-the 3v3 power regulated with the lm317 and the 2 resistors. It creat a constant voltage for the esp8266.-the module esp8266 with resistorsTo make the second board, repeat the same process of the first one. When it's done, check the voltage at the power pin of the module.Once the 2 boards are done, connect them together wire wire.

Step 4: Make the Box

I made a box with sketchup and 3d print it. If you have access to a 3d printer, download the stl file and print it (20% infill and 0,3mn layers). Sand the box and clean holes. If you don't, you can made a box out of a Tupperware or any plastic box.

Attachments

Step 5: Finish Everything

You can now finish everything. Place first the electronics and the transformer into the box and glue them. Take the 3 plugs (one in and 2 out), strip the end and connect each wire with the terminals screw by following the schematic. Don't forget to connect the transformer.

Step 6: Program the Esp8266

The last step is to program the esp8266 like an arduino. Follow this tutorial if you don't now how to do it: https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-arduino-ide Download my program and upload it into the module. Don't forget to change the wifi name and the password. Enter the IP of the module into any web browser and you will see 2 on/off virtuals switches. This switches control the 2 gpio pins connected to the transistors.After plug in the module, close the box witch 4 screws. And that's it you can now control any device with your smartphone or PC.

Is it because the ip of the esp change every time it's connecting to the wifi?If yes, the problem comes maybe from your router and not the module. But I have no idea how to solve this problem.Try others sketches from the web to see if you have the same problem.

Ok I have made this and it worked like a charm first go. However I have had some experience with the ESP8266. But unfortunately its still unstable. The device becomes unresponsive to the webpage after a day or two. I am trying to use this in a real world situation where I need it to ALWAYS work as its installed remotely (outside controlling a pet door) The power supply is rock solid and I used an older version of this software programed by a different method (before it was intergrated into arduino IDE) and IM getting the same result.

Yours works exactly the same. Works great but you come back after a day of it running and it wont load another webpage. The original webpage open on the laptop or phone simply doesnt respond either. I have changed devices several times, programmed with different programers, used different webpage clients , everything. The things I have not changed are the brand of ESP (version 1) and my wifi router, which is a Netgear dual band wireless router, only 2 years old. It works flawlessly with my other devices.

Hi there,I just wanna know I've 3 ESP8266 boards connected to my router.Each board can be accessed by putting their individual IP and thus the corresponding devices can be controlled.But if I wanna access all the boards simultaneously, what Have I to do for that?? I'm asking this question because the 3 ESPs are controlling each of my room. If I've to control the appliances of my room-1, I need to connect to corresponding ESP8266. For room-2, need to connect to corresponding ESP8266 and so on. But what if I wanna control all rooms simultaneously.

My only suggestion, would be only one device should handle the UI, but know the URL for each device, I.E. sending page as one solid, but each button pressed would send back the device's URL, and which port to control. You would then need each device to report back it's status to the main device. could get complicated, but not impossible..

i made this project with esp8266 12E...but i am facing a problem...when i connect the relay to the esp when it is already ON it works fine but when i connect the relays first and then turn the circuit ON it turns the relays automatically ON and i can't turn the relays on or off...

Such a nice work. It pushed me to make such a project for my Home devices.

But during executing the same, I am facing some problem that the 5V Relay, I am using in my project, works when I connect IN1 or IN2 of Relay to Low (ground) but the digital output of the GPIO0 and GPIO2 is high (positive). And it causes the relay ON when I click to OFF button on Web and OFF when I click ON.

In case of LED it works fine bcoz no matter what the output GPIO pin is providing, the second LED pin will be connected accordingly (either to high or low).