ESP8266 WIFI Remote Relay Switch




Introduction: ESP8266 WIFI Remote Relay Switch

About: Software, electronics, do-it-yourself

In this tutorial I will show you how to convert an old power strip into WIFI remote control. This will allow us to control electrical devices from the Internet via HTTP. For example we will be able to turn on and turn off a heater, fan or light over the internet. To build i will use a popular electronic circuit ESP8266 D1 mini. ESP8266 is a good platform for iot (the Internet of things)

This article can also see here:
ESP8266 WIFI Remote Relay Switch

Step 1: Components

  • ESP8266 D1 mini
  • Power strip
  • Relay Module 250V 10A
  • AC-DC buck step-down module 220V turn 5V
  • Button switch
  • Some wires

Step 2: Preparing the Power Strip

At the beginning I removed the broken switch and everything cleaned.

Step 3: Measuring and Cutting

I measured and cut the plexiglass board for electronic circuits. For cutting I used Hot wire foam cutter from the previous project. Follow this link to see how I built this tool.

This article can also see here:
Hot wire foam cutter

Step 4: Drilling

I drilled mounting holes, for plexiglass board. Then I mounted the plexiglass board inside the power strip.

Step 5: Scheme

Step 6: Mounting the Plexiglass Board

The next step is assembling the plexiglass board and electronic circuits together.

In this project, I only use one relay to control power strip.

Step 7: Mounting ESP8266

Because my power strip is made of metal, I'm afraid there might be a problem with the WIFI connection.That's why the ESP8266 is assembled inside a plastic case and screwed to the power strip.

Step 8: ESP8266 Flashing Firmware

I had a problem with flashing firmware. My version of the ESP8266 D1 mini has something wrongwith the RST pin, it does not work. That's why, I disconnect the USB cable from the computerinstead of using the RST button. In this article, step by step, I described the entire software flashing procedure.

SONOFF - ESP8266 Update Firmware With Arduino IDE

Download source code: ESP8266_on_off.ino
Before you upload the software to ESP8266 setup your WiFi connection.
#define WIFI_SSID ""

#define WIFI_PASSWORD ""

Step 9: Testing HTTP Server on ESP8266

  1. Open serial monitor in Arduino IDE.
  2. Get your server IP from serial monitor.
  3. Now open WWW page in your browser.

Now we can control the power strip using the web browser, we can also use the button on the plastic box.

Other related projects:
SONOFF - ESP8266 update firmware with Arduino IDE
ESP8266 and multiple temperature sensors DS18b20 with HTTP server
Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    5 Discussions


    Question 1 year ago on Step 1

    Sir ESP8266MOD wifi cannot connect in ESP basic channel relay wifi help please


    Question 2 years ago on Introduction

    Hi sir is build esp8266 remote switch , but I get just as in the video 1 switch to operate.

    Can u advise what I have to add to the http software from the esp8266

    to get the other 3 switches in and work

    So i can operate them to.

    Regards, Martin .


    Question 2 years ago

    Can you reupload sketch?


    3 years ago

    I made smth similar. And then I didn't use it cuz local ip connection just not convenient enough.


    Reply 3 years ago

    Hi, thanks for the comment. This is a right, the use of ip is not very comfortable. Instead of ip, you can also use HOST_NAME.