navigationGo.pngQuick Navigation
allprojects32.pngAll projects
hardware32.pngHardware
links32.pngLinks

favoriteStar32.pngTop projects
Alan numitron clock
Clapclap 2313/1386
SNES Pi Webserver
USB Volume/USB toys
Smokey amp
Laser cutter
WordClock
ardReveil v3
SNES Arcade cabinet
Game boy projects
cameleon
Home Presence Detector

github32.pngGitHub
AlanFromJapan

navigationMail.pngContact me

alanfjmail.png
3flags.pngWho's Alan?


Akizukidenshi
Elec-lab
Rand Nerd Tut
EEVblog
SpritesMods
AvrFreaks
Gameboy Dev
FLOZz' blog
Switch-science
Sparkfun
Suzusho
Datasheet Lib
Reddit Elec
Ermicro
Carnet du maker (fr)

sonoff

Last update: Thu Jun 5 22:25:41 2025
Sonoff from iTead.cc is a small box with an ESP8266, a transformer and a relay, 2 connectors for input and output AC, supports 110-220v AC and costs 5 USD on eBay! How to resist? Don't! Just buy it!

Usage? I use one of these puppies now to control my home file server: it's a Raspi 2 with an USB HDD connected. I use it once a month these days, it doesn't need to be always on (waste of energy and ageing of the Raspi & HDD). Now, my SonOFF controls them so I can turn on the pair, do what I need, watch that movie, and turn it off after. Big saving of energy ! (^_^)v

Presentation

Specification

  • Voltage range: 90-250v AC(50/60Hz)
  • Max current: 10A
  • Max Wattage: 2200 watts
  • Dimensions: 88*38*23mm (L*W*H)
  • Color: White
  • Humidity: 5%-95%
  • Frequency: 2.4Ghz
  • Working Temp: ﹣20℃-75℃
  • Schematics
  • Points of interrest

    An ESP8266 with transformer and realy for 5USD: do I need to say more??

    Review

    That has been done somewhere else on the net, just let me write down my thoughts about it.
    Positive points:
  • Very cheap (5USD) for what you get
  • The pads to upload your own code: that is superb foreward thinking! Many thanks.
  • Nice little box, with connectors. If you use the default app, nothing to solder.
  • General good quality for that price in that small form factor
  • Negative points:
  • Clearance between the pins of the AC connector: there's a nice wide gap, but they still seem a bit close-ish to me.
  • AC screw connector: couldn't they have made it a bit bigger? You can't use every wire size you'd find at home center, the bigger ones won't fit.
  • Edit: I tried with Ø 0.75mm (max 7A at 100V) and wire 1.25mm it works just fine. I think the max is Ø 1.25mm.
  • A little marking on the PCB board and in the box for the "IN" / "OUT" would have been most welcome
  • Implementation

    How to program

    Wiring schematics is below: plug your 3.3v voltage converter, and hit upload in your Arduino:
  • Board = Generic ESP8266 module
  • Flash mode = DIO
  • Flash freq = 40MHz
  • CPU freq = 80MHz
  • Flash size = 512k (64k SPIFFS)
  • Upload speed : 115200

    1. Turn off the Sonoff and UNPLUG it from the wall
    2. Press the Sonoff button and stay pressed
    3. Turn on the Sonoff (with the 3.3v serial usb converter and NOT with the AC plugged of course. Seriously, don't be an idiot and do unplug the AC)
    4. Release the Sonoff button
    5. You're in programming mode now, and your Arduino IDE should do that for you as a charm

    Schematics


    Pinout (taken here)

    Source code

    On GitHub as usual, the "sonoff_"... projects.

    Important things to know:
  • LED is on pin 13
  • RELAY is on pin 12
  • One free GPIO is available on the board and it's pin 14
  • Pictures

    Links

    Helpful sources

  • This one is great: just read it! http://randomnerdtutorials.com/reprogram-sonoff-smart-switch-with-web-server/
  • Tackling that reconnection problem ? https://github.com/esp8266/Arduino/issues/2186
  • Alternate firmware worth testing : https://github.com/arendst/Sonoff-Tasmota
  • Inspiration

    All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated)
    electrogeek.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2025])