Home > News & Updates > Electronics News Updates > DIY WiFi Outlet using ESP8266

DIY WiFi Outlet using ESP8266

Summary of DIY WiFi Outlet using ESP8266


This article guides users through constructing a DIY WiFi Outlet using an ESP8266 microcontroller and a relay module. The project involves modifying a standard cellphone charger to house high-voltage components safely, wiring a duplex outlet so one side is always powered while the other is controlled by Wi-Fi, and programming the ESP via an FTDI converter. Safety warnings regarding high voltage and local insurance regulations are emphasized throughout the build process.

Parts used in the WiFi Outlet:

  • ESP8266 (any version)
  • 5V Relay Module
  • AMS1117 Low Drop Out Regulator
  • 1K Resistor
  • Duplex Outlet
  • Wall Box
  • Wall Plate
  • Cellphone Charger (5V output)
  • Power Cord
  • FTDI Usb to Serial Converter (3.3V version)
  • Jumper wires

In this instructable, I will take you along on my journey of building this WiFi Outlet.

Step 1: Parts

The final box will contain:

  • ESP8266 (any version will do)
  • 5V Relay Module
  • AMS1117 Low Drop Out Regulator
  • 1K Resistor
  • Duplex Outlet
  • Wall Box
  • Wall Plate
  • Cellphone Charger (5V output)
  • Power Cord

Only needed while programming the ESP8266:

  • FTDI Usb to Serial Converter (3.3V version)
  • Some jumper wires

Step 2: WARNING!!!

High voltage definitely would hurt you and potentially could kill you! So please be careful. If you don’t know what precautions to take, please find someone who does. You’ve been warned.

Edit: fellow instructable brought up a good point. Thanks Spark Master!
“I would mention you will probably void any Home Owners Insurance you have if you do this in NYC. Ask the electrical inspectors listed in the phone book for your area.”

Step 3: Charger Surgery

I considered just soldering wires to the mains input and use a USB cable for the output. However, in the end I decided to keep all the high voltage inside the charger. A gentle pry with a box cutter popped it open.

I replaced the input wire with a slightly longer wire.

I also removed the USB connector because plugging in a USB cable would have taken more room.

I then put everything back into its original container.

Step 4: High Voltage Wiring

I recycled a computer power cable for this project.
Obviously, we want the relay to switch the live wire instead of the neutral.

I opted to break one of the tabs that joins the two outlets. This allowed me to wire up one of the outlets to be always on, while the other outlet is switched by the relay.

Step 5: ESP8266 & Relay Wiring

he wiring is fairly simple, so I opted to solder everything right around the ESP8266 instead of creating a custom PCB.

You could pretty much use any ESP model. I ended up using an ESP12.

The pushbutton switches and USB to Serial module are only necessary to program the ESP. That’s the reason for the “header pins” on the ESP:

  • Ground
  • RX
  • TX
  • GPIO0 (bring to ground at power up to put ESP in program mode)
  • Reset (optional)

Read more: DIY WiFi Outlet using ESP8266

Quick Solutions to Questions related to WiFi Outlet:

  • Which ESP model is recommended for this project?
    The author used an ESP12 but states you could pretty much use any ESP model.
  • How was the cellphone charger modified for this build?
    The input wire was replaced with a longer one, and the USB connector was removed to save space inside the original container.
  • Why did the author break one of the tabs on the duplex outlet?
    This allowed wiring one outlet to be always on while the other is switched by the relay.
  • What safety warning is provided regarding home insurance?
    Building this in NYC might void your Home Owners Insurance, so checking with local electrical inspectors is advised.
  • Which wire should the relay switch in the high voltage setup?
    The relay should switch the live wire instead of the neutral wire.
  • Are header pins necessary on the ESP for normal operation?
    No, the pushbutton switches and USB to Serial module with header pins are only needed while programming the ESP.
  • What specific GPIO pin must be grounded at power up for programming mode?
    GPIO0 must be brought to ground at power up to put the ESP in program mode.
  • Did the author create a custom PCB for the wiring?
    No, the author opted to solder everything right around the ESP8266 because the wiring is fairly simple.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top