• You've been granted Beta access to this site, allowing you to explore some of the new features while they're still under construction. More information can be found in the Beta forum.

DIY Espurna firmware upgrade to ITead S20 Smart Socket switch

pete_c

Guru
Picked the S20 over the S26 and S30 because it is easier to update. Note this is my first WiFi switch test device that I have purchased.

ITead product page

Switch comes in three models.

The Sonoff S20 is a smart plug that comes with different plug standards: EU (both Schuko-F and French-E) , US, UK, CN and AU. It is meant turn any regular wall outlet into a smart outlet. It sports a button for manual operation and two LEDs, one in sync with the relay status and the other one for user notifications.
 
[sharedmedia=gallery:images:1275]
 
Generic picture of open S20 case.  The case is held together by one screw.
 
[sharedmedia=gallery:images:1276]
 
1 - There is a labeled header in the front of the PCB and the button is connected to GPIO0.

2 - Solder a 4 pin male or female header and connect it to your USB-to-UART bridge.

3 - Then press and hold the button and connect the programmer to your computer. The micro-controller will boot into flash mode and you are ready to update the firmware.

Note: you can flash device here utilizing your USB powered device. Personally doing this via Linux Python command line and utilizing Espurna firmware.


S20 Espurna Bin File download ==> espurna-1.14.0-itead-s20.bin

Here is a picture of my S20. Notice date and firmware version. IE: this was purchased new last week from Amazon.

My preference is here the wire versus wireless any how. The board appears glued to the base so soldering can only be done from the top of the board. It was easy to do. I used a small tip on the soldering iron but no flux and so there are little balls of solder there but it will not affect anything anyhow. Have a box o terminals purchased a while ago. Haven't done any soldering since modifications of the magichome controller which was much more difficult to do than the SonOff S20 switch. I have read that newest SonOff WiFi switch has a separate module but is more difficult to update. This firmware update will utilize the 3.3VDC voltage.
 
[sharedmedia=gallery:images:1277]
 

[sharedmedia=gallery:images:1278]
 

[sharedmedia=gallery:images:1279]
 
Linux command line step by step. Powering to program switch will be done at 3.3VDC. No need to plug the switch in.

Linux command line step by step.

Had a little issue here with the new USB to TTL. It would error out with the 3.3VDC pin and I would not ever see an LED lite.

Tried erasing the flash but had the same error.

[email protected]:/home/pete/Downloads# esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 espurna-1.14.0-itead-s20.bin
esptool.py v2.3.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 484528 bytes to 346038...
Wrote 484528 bytes (346038 compressed) at 0x00000000 in 30.5 seconds (effective 126.9 kbit/s)...
File md5: c28049d971cd068d6f0dacbc28cbc531
Flash md5: e1f43a6401930a95b7fa8f3b65d2798c
MD5 of 0xFF is e2b933bac685c79e6215cb3456c1f855

A fatal error occurred: MD5 of file does not match data in flash!

Then switched over to using the 5.0 VDC pin; LED did light up with the 5.0 VDC pin.

First erased the flash

[email protected]:/home/pete/Downloads# esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py v2.3.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 0.0s
Hard resetting via RTS pin...

Then wrote newest Espurna S20 firmware - worked fine with 5VDC pin

[email protected]:/home/pete/Downloads# esptool.py --port /dev/ttyUSB0 write_flash --flash_size 1MB --flash_mode dout 0x00000 espurna-1.14.0-itead-s20.bin
esptool.py v2.3.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 484528 bytes to 346038...
Wrote 484528 bytes (346038 compressed) at 0x00000000 in 30.5 seconds (effective 126.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Configuration

1 - boot either powering up with USB to TTL or just plugging in the device.
2 - look for "ESPURNA-XXXXXX" network and connect to it using admin / fibonacci
3 - attach to the network via hxxp://192.168.4.1 and change your password, log in
4 - configure to connect to your WiFi network and enter a static IP or use DHCP. (I utilize a static IP).

Enabled telnet on the device.

ntp sync
[513356] [NTP] UTC Time : 2019-12-18 03:07:28
[513358] [NTP] Local Time: 2019-12-17 21:07:28
[513358] +OK
[517680] [MQTT] Sending ESPURNA-S20A/app => ESPURNA (PID 1)
[517681] [MQTT] Sending ESPURNA-S20A/version => 1.14.1-dev (PID 1)
[517681] [MQTT] Sending ESPURNA-S20A/board => ITEAD_S20 (PID 1)
[517687] [MQTT] Sending ESPURNA-S20A/host => ESPURNA-S20A (PID 1)
[517694] [MQTT] Sending ESPURNA-S20A/desc => ITead S20 Switch 1 (PID 1)
[517699] [MQTT] Sending ESPURNA-S20A/ssid => ICS-5 (PID 1)
[517704] [MQTT] Sending ESPURNA-S20A/ip => 192.168.244.227 (PID 1)
[517710] [MQTT] Sending ESPURNA-S20A/mac => XX:XX:XX:XX:XX:XX (PID 1)
[517716] [MQTT] Sending ESPURNA-S20A/rssi => -36 (PID 1)
[517724] [MQTT] Sending ESPURNA-S20A/uptime => 1517 (PID 1)
[517725] [MQTT] Sending ESPURNA-S20A/datetime => 2019-12-17 21:07:33 (PID 1)
[517733] [MQTT] Sending ESPURNA-S20A/freeheap => 20360 (PID 1)
[517738] [MQTT] Sending ESPURNA-S20A/relay/0 => 1 (PID 1)
[517742] [MQTT] Sending ESPURNA-S20A/vcc => 3149 (PID 1)
[517747] [MQTT] Sending ESPURNA-S20A/status => 1 (PID 1)
[517753] [MQTT] Sending ESPURNA-S20A/loadavg => 1 (PID 1)
 
 
Top