IoT - Sonoff

From The TinkerNet Wiki
Jump to navigation Jump to search

Sonoff Devices on Hand

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

Sonoff Basic 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
    • 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

 

 

Notes

Links

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
  • Figure out the whole "OTA" part...   :P
  • Get Google Home talking to Tasmota

See Also