"SONOFF Clone" - Mini-ESP8266 Power AC Relay Controller

I built a tiny AC switch which Im using to turn my garden and path lights on. Its replacing an old digital timer which turns the landscape and path lighting after sunset.

I hacked a 4-way power strip and put a single relay on the live wire (Brown in my case).

In terms of features:

OTA Updates
Manual Button (widget, not physical button)
Time Input (start/end time)
Remote Trigger with timeout (use bridge to trigger lights with a timeout via another ESP on a gate or PIR sensor)
Slider widget can set the delay from 1-10min.

When I build another one, I will also include the power supply for the ESP inside the case and splice it in to the main line. This time I didn’t have a big enough case.

I use the remote delay trigger when my gate is opened during night hours to help light up your way to the door.
The Timer widget trumps the delay too.


Build Photos:


Clone Project:


Wow!! @Jamin, you are reading my mind!!!
I’m doing my own Relay for other purposes with the ESP-01, at the moment my Dashboard has only One button! Lol, I will pay attention to your code! Thanks for sharing!!

You may consider the “Hi-LinK” power supply, it’s really small and works fine. You can find it HERE as example.



Thats a great little product! :slight_smile: Cheers!

Similar to mine I built some time back, I used a 2.1a USB charger and broke it out of its case to fit.

I included a AC Dimmer on one of the circuits (The board on its side up top).

I bought a bunch of the Sonoff devices now due to the price, I am not able to make ^ for the same cost as a Sonoff, I run custom MQTT firmware on the Sonoff.


Nice !!! :slight_smile:

1 Like

That’s cool man!
I have a thing about empty space and making stuff as small as possible hah so much room in your case! :wink:

I havn’t looked at the price of SONOFF in New Zealand but this cost me:

Case $1.50
4-way AC splitter: Free
Relay: Free (laying around the workshop for months)
Mini-ESP: $5.50

NZD$7 = USD$4.9 … good?

1 Like

@Jamin you can find mi D1 for around $2.50USD from Alibaba, one thing you have to wait little longer than usual :slight_smile:

Yup I just got a few from Banggood.com but I discovered a few days after ordering that I could get them far cheaper on aliexpress! So I have another 15 in the mail now :stuck_out_tongue:

1 Like

Wow :smiley: , then more cool projects coming in the future then :stuck_out_tongue:

LOL Yeh I love the ESP!

Building a new workshop/shed in 4 weeks and will be setting up solar on it so will be designing my own solar charge monitor too!
Also will be able to control the lights and setting up an electronic lock just for fun

Me too, especially D1 mini is my favorite.

Cool, can’t wait to see that;)

Me now working on remote car start project for old cars. I accomplished it, but neets to be tune up for feedback from the car to esp and to blynk app to get notification like “cars’ engine is istarted” or " stopped" cant figure it out that part :wink:

Have you got a signal confirming that the engine has started? Maybe measure current from the battery using a current sensor?

Not exactly, but I added terminal and led widget to show button is pressed. So what kind of sensor I have to use to achieve that?

Hmm well there are a few methods you could try.

A car use a large amount of current when running so you could measure the spike using a current measuring module like this

Or you could try and find the speedo signal and use a ADC module like this to convert the analog signal to digital.

Another option is splice in to the pulse coming from the ignition coil?

Once you have a signal, you can easily use that to trigger the LED widget.

So if I get pulse from ignition coil, Can I able to turn off one of the relay and trigger the LED widget?

You just need the signal. Once you have it… use a voltage divider to bring the voltage from 12V down to 1-3.3V… then pop it in to your A0 analog input.

You can then just use analogRead(A0) and look for a change, attach an interupt to it then use that to trigger any widget you like.

Really thank you Jamin :+1: , I will order the sensor today. I might need help with code when I get sensor :smiley:

1 Like

Hi can you post the picture how wire esp on reley board

Hi @Josip_Boc,

I just built this schematic on EasyEDA … it will be better than photos.

Im currently building a Github repo and tutorial for this project.