ESP8266 - native switcher

ESP8266 + 2 relay module + usb charger.
As simple as possible two channels switcher controlled from web

Similar projects worth following
More of ESP8266 projects are quite complex. My main objective in this project is to use as less part as possible. Total cost of project is $9 (including power supply).



Project uses native software with standalone http server. Web site was tested on iPhone. Source code is GitHub and contains two Makefile: one for linux toolchain and one for Mac OS X.

Donate / support

If you like this project and want to support my work please donate HERE. Thanks !!!

From donations I'll buy other ESP types and different models of relays.

If you have any suggestions, ideas of new features which can be added to this project, please leave it in comments.

Missing features / things to do / ideas:

  • Add reset button - after reset ESP8266 should works as AP (Access Point). Step to this is done, I used two resistor instead of one.
  • Hitch ESP to relay and don't used cables to connect them
  • Test different ESP types/version with different number of relays and connections

  • 1 × ESP8266
  • 1 × 2 relay module
  • 1 × BA033 Voltage Regulator
  • 1 × 47uF capacitor at least 33uF
  • 2 × 3.3kΩ resistor

View all 8 components

  • New features implemented

    pawelka05/04/2015 at 19:58 0 comments

    New features:

    1. Ability to configure Access Point ESSID and password from website (/wifi page). If password is set then WPA PSK is used for wifi protection, otherwise network is open
    2. Ability to configure basic authentication to protect wifi configuration page. If user is black then basic authentication is off.
    3. Reset setting feature. After hard reset (power off and on) you have 5 sec to connect GPIO2 to GND for 3sec. You cannot set GPIO2 to LOW during booting because ESP will not boot. Normal boot takes 1 sec, after you have time to connect GPIO2 to LOW. You can watch counter on serial/COM output with speed 115200 bps.

View project log

  • 1
    Step 1

    ESP8266 modification

    Solder 3.3kΩ resistors to ESP


    • VCC and CH_PD
    • VCC and RST


  • 2
    Step 2

    Relay modification part 1/3 (voltage regulator)

    Solder voltage regulator BA033. Component's pinouts:

    I soldered it directly to bottom of relay. Below I marked places which I used. Before soldering I scratched electronic path in places 2 and 3:

    To solder pinout 2 to board you have to add piece of wire. I used wire from resistor. Result:

  • 3
    Step 3

    Relay modification part 2/3 (capacitor)

    Solder at least 33uF (max. 1000uF) capacitor to pinout VCC and GND. I used 47uF capacitor.

View all 8 instructions

Enjoy this project?



IW0HJZ wrote 03/28/2017 at 20:30 point

Hi, I build this switch time ago, it work very well. This was my first experiment in IOT and I'm happy.  Now the question:  can use the switch in monostable mode instead? At least 1 channel, 300ms or so is great. I'm not a software guy so don't know where change values to do this.


Alberto IW0HJZ

  Are you sure? yes | no

wifoca78 wrote 01/17/2017 at 04:28 point

hola buen dia. como hago para subir el codigo a la esp8266 gracias

  Are you sure? yes | no

naacholiza wrote 01/11/2017 at 05:18 point

Hi, do u have some videos, more photos, or another tutorial to see? I wanna do it but i think i will need more details to do it correctly! Thx for all ! Regards

  Are you sure? yes | no

Linux Newbie wrote 04/11/2015 at 10:20 point

Hi, Excellent tutorial. Do you have an init.lua file for this project available to download please? Thank you.

  Are you sure? yes | no

pawelka wrote 04/12/2015 at 10:40 point

Software for this project is written in C (see github), not in lua. Maybe in future I'll write lua script for this project as an alternative.

  Are you sure? yes | no

xnakxx wrote 03/22/2015 at 08:03 point

I like how you incorperated the Voltage Regulator into the relay board. Nice work!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates