Gosund WP5
The Gosund WP5 is a cheap smart plug. Internally, it uses the ESP8285 chip. Before you buy these, be aware that you cannot load Tasmota over the air at the moment (if ever) because most (all?) new smart plugs that utilizes the Tuya platform are now assigned a randomized PSK key from the factory and is not compatible with Tasmota-Convert.
Tinkering
Open the WP5 by prying on the back side of the plug, separating the outer casing from the inner circular plate. Try not to rip the side casing; minor bends and distortions can be repaired with a heat gun.
To connect to the ESP8285, connect TX to RX and vice versa via a shift level to a USB UART. Connect 3.3v power using the 3v3 pad and ground to the metal shielding. Enter flash mode by grounding IO0 during power on.
Dumping firmware
Trying to dump the firmware with esptool, but am getting this issue:
$ python -m esptool --port /dev/ttyUSB0 --chip auto read_flash 0 0x100000 firmware.bin
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting........_____....._
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
Crystal is 26MHz
MAC: c4:dd:57:0d:2c:de
Uploading stub...
Running stub...
Stub running...
1048576 (100 %)
1048576 (100 %)
A fatal error occurred: Digest mismatch: expected 9B60686A442B0A68591CFB54D28B867B, got 458345CAB9C61F97AAB45943ED64C234
Trying again at 9600 baud worked.
Loading Tasmota
gosund % python -m esptool --port /dev/ttyUSB0 erase_flash
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____...
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
Crystal is 26MHz
MAC: 70:03:9f:89:68:a6
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 0.9s
Hard resetting via RTS pin...
gosund % python -m esptool --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 tasmota.bin
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting........__
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
Crystal is 26MHz
MAC: 70:03:9f:89:68:a6
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 613568 bytes to 438208...
Wrote 613568 bytes (438208 compressed) at 0x00000000 in 38.7 seconds (effective 126.9 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Troubleshooting
Esptool cannot connect
When trying to dump the firmware from the ESP, I kept on getting this error message:
Unsupported Command Error received. Probably this means Secure Download Mode is enabled, autodetection will not work. Need to manually specify the chip.
After trying a few more times, it started working. It is most likely a sketchy connection that's causing this issue. Ensure the TX/RX pins are connected securely.
See Also
- Tasmota template, listing GPIO pins: https://templates.blakadder.com/gosund_WP5.html
- Guide on opening the WP5: https://www.instructables.com/Downloading-Tasmota-Onto-a-Gosund-WP5-or-WP3-Smart/
- A teardown of the WP5: https://vmallet.com/2020/07/gosund-wp3-smart-plug-teardown-and-schematic/