IoT - Sonoff
		
		
		
		
		
		
		Jump to navigation
		Jump to search
		
		
		
		
		
		
		
	
Contents
Sonoff Devices on Hand
- Sonoff Basic (R1 & R2)
- T D T Repository
 - Currently flashed with TasmOTA
 
 - Sonoff Dual
- T D T Repository
 - Currently flashed with TasmOTA
 
 - Sonoff S20
- T D T Repository
 - Currently flashed with TasmOTA
 
 - Sonoff S31
 - Sonoff S31 Lite
 - Sonoff D1 dimmer
 - Sonoff RM433
 - Sonoff RF-Bridge 433
- T D T Repository
 - TasmOTA Wiki
 - Currently flashed with TasmOTA & RF-Bridge-EFM8BB1
 
 - Sonoff Micro
 
Things I've learned
- Apparently, quality control could be better...
- If you find you're getting silly errors that have you chasing your tail, try reflowing the whole damn board...
 
 
Hardware Notes
GPIO Assignments
| GPIO Pin | Useage | Notes | 
|---|---|---|
| 0 | Button 1 | |
| 2 | ||
| 4 | Relay 3 | |
| 5 | Relay 2 | |
| 9 | Button 2 | |
| 10 | Button 3 | |
| 12 | Relay 1 | |
| 13 | LED | |
| 14 | Button 4 | |
| 15 | Relay 4 | 
Tasmota
SuperHouse #31: Sonoff Tasmota installation and configuration
Fuck Arduino... Moving to PlatformIO
If all else fails... go exploring the Tasmota Wiki.
In particular, keep an eye on the What's New page.
- How to setup and configure Arduino IDE for Tasmota compilation and upload.
- Board: "Generic ESP8266 Module"
 - Flash Mode: "DOUT"
 - Flash Size: "1M (no SPIFFS)"
- This is based on the Sonoff & the ESP07
- The ESP12 seems to have 4M & the ESP01s on hand have 2M
 
 
 - This is based on the Sonoff & the ESP07
 - Debug port: "Disabled"
 - Debug Level: "None"
 - IwIP Variant: "v1.4 Prebuilt"
- Not sure why not the newer version
 
 - Reset Method" "nodemcu"
 - Crystal Frequency: "26 MHz"
 - Flash Frequency: "40 MHz"
 - Upload Using: "Serial"
- OTA_upload is also an option
 - or was until "Upload Using" disappeared... WTF?
 - SONOFABITCH... updated esp8266 stuff (2.4.1) may have broken shit!
 - I've put the 2.4.0 files into the 2.4.1 configuration on Lise... must test...
 - BUGGER ME! had to revert ESP8266 to 2.4.0 & redo the setup...
 
 - CPU Frequency: "80 MHz"
 - Upload Speed: "115200"
 
 - Initial Configuration
 - Button usage
 
| 1 short press | Toggles the relay either directly or by sending a MQTT message like cmnd/sonoff/1/light on. This will blink the LED twice and sends a MQTT status message like stat/sonoff/LIGHT on. If cmnd/sonoff/ButtonRetain on has been used the MQTT message will also contain the MQTT retain flag. | 
| 2 short presses | Toggles the relay. This will blink the LED twice and sends a MQTT status message like stat/sonoff/POWER on. For Sonoff Dual this will switch relay 2. | 
| 3 short presses | Start Wifi smartconfig allowing for SSID and Password configuration using an Android mobile phone with the ESP8266 SmartConfig app. The MQTT server still needs to be configured in the user_config.h file. The LED will blink during the config period. A single button press during this period will abort and restart sonoff. | 
| 4 short presses | Start Wifi manager providing an Access Point with IP address 192.168.4.1 and a web server allowing the configuration of both Wifi and MQTT parameters. The LED will blink during the config period. A single button press during this period will abort and restart sonoff. | 
| 5 short presses | Start Wifi Protected Setup (WPS) allowing for SSID and Password configuration using the routers WPS button or webpage. The LED will blink during the config period. A single button press during this period will abort and restart sonoff. | 
| 6 short presses | Will restart the module | 
| 7 short presses | Start OTA download of firmware. The green LED is lit during the update | 
| Long Press (4 seconds+) | Reset settings to defaults as defined in user_config.h and restarts the device | 
- Commands
 - MQTT Features
 - Works just fine on a generic ESP-01, ESP-07 & ESP-12 too :)
 
Notes
Links
- EWeLink
 - Search: alternative control for sonoff
 - SuperHouseTV #17: Home automation control with Sonoff, Arduino, OpenHAB, and MQTT
 - SuperHouseTV #21: Six Sonoff Secrets: Storage, Safety, Switches, Sensors, Software, and Sites
 - SuperHouse #30: Reflash ANY Sonoff, even if you don't know the pinout
 - Esptool - arendst/Sonoff-Tasmota Wiki
 - Flashing TASMOTA Firmware on the Sonoff Basic using Arduino (Guy seems a little dumb... but...)
 - Flashing TASMOTA on a Sonoff OVER-the-AIR !!! (Same guy again...)
 - #125 MQTT meets SONOFF: QoS, Last Will, Keep-Alive, etc. explained and shown
 
Next Steps
Hook the Tasmota Sonoff into Node-Red- Pretty darn easy...
- Just use MQTT
 - Should take a look at:
- node-red-contrib-sonoff-tasmota
 
 
 
- Pretty darn easy...
 - Figure out the whole "OTA" part... :P
 - Get Google Home talking to Tasmota
 
See Also
- Armtronix
- ARMTRONIX WIFI SINGLE Dimmer Board
 - Wifi AC Dimmer Two Triac Board
- Kinda seems like an improved Sonoff clone... (dimmable)