Sonoff S60TPG iPlug UK Smart Plug Investigation [ESP32-C3] [CSE7759B] [SM-049]

Here are my experiences with a Sonoff S60TPG iPlug UK smart plug, along with teardown, flashing information and OpenESP32 experiments (OBK port).






The plug was bought from Ali Express
https://nl.aliexpress.com/item/1005006764953793.html
Glue seemed to be too strong and I didn't have the right width tools to contort it in a vice to crack it open. I resorted to drilling a hole at the chassis join from which it could be pried apart. Main PCB removed from power pins and then module de-soldered.

















A module I've not seen before. A Coolkit SM-049 V1.3 - an ESP32-C3 with 4mb flash integrated. On the reverse of the module is a Chipsea Technologies CSE7759B energy metering chip. Module takes 5V from main PCB but then 3.3v supplied to ESP32 thanks to a MicrOne (Nanjing Micro One Elec) ME6211A33PG-N 6211A 2438/33 LDO.

from IO21/TX at 115200 baud, factory boot log
Code: Text
eWeLink app experience. fw ver 1.1.1 with update to 1.2.0 offered






IO9/Key grounded gets ESP into download mode
Code: Text
info gathering with esptool
esptool.exe --port com73 get_security_info
Code: Text
good, no secure boot or flash encryption.
espefuse.exe --chip esp32c3 --port COM73 summary
Code: Text
dump to file
esptool.exe --chip esp32c3 --port COM73 --baud 921600 read_flash 0x000000 0x400000 flash_dump.bin
Flashed OpenESP32C3 factory image with esp-flasher.exe from https://github.com/Jason2866/ESP_Flasher/releases
Module contact tracing and labels



Meaning the assignments are
Code: JSON
The blue wifi LED is controllable but the second red LED is linked to the relay. On=relay closed, Off=relay open.
ESP builds are missing the CSE7766 driver (compatible with CSE7759B), so I enabled it with this PR https://github.com/openshwprojects/OpenBK7231T_App/pull/1642 but @insmod warned me in the comments that it may not work. This is my first CSE7759B - from what I've seen in other posts it seems only the driver needs starting and perhaps flag 26 ([UART] Use alternate UART for BL0942, CSE, TuyaMCU, etc) needs enabling in some situations. Unfortunately no readings on ESP32 with or without flag. IO7 is connected to TX on the CSE7759B.


and that's the current state of play.
Comments
Add a commentInteresting, which brings us the question how we can futher test and improve the CSE and UART drivers.... maybe try to get a valid CSE packet and then do remaining operations on the ESP dev board, while... [Read more]
I'll try to set up some kind of CSE simulation. Hopefully it'll be more reliable and indicative of a real CSE than the BL0937 simulator attempts with PWM and Arduino sketch. No idea about how good the... [Read more]
I've also got Sonoff but the one with CSE7761, which has different UART protocol. I will have few spare hours today and I will try porting some driver, but I'm not sure if it will work with unstable UART.... [Read more]
cool. ESP Sonoff I assume? Added after 22 [minutes]: yes :) https://github.com/openshwprojects/OpenBK7231T_App/commit/e64ccf49abd3adc078753feffe893ca2587ce424 [Read more]
Is PROTA working for you on ESP?" I get: 2025-05-22 14:02:40: [Found matching file: OpenESP32C2_1645_merge_1d63268bd632.img] 2025-05-22 14:02:40: [Sending... [Read more]
yikes. a lot of artefacts now. worked though https://obrazki.elektroda.pl/1523743000_1747916891_bigthumb.jpg 025-05-22 13:26:17: [Checking zip file: C:\Users\divad\Downloads\PROTATool (1)\1645/97086a1b8ac6e01527a6a726f6260bf5af25c7e1\OpenBK7231T_App_cse_97086a1b8ac6_OpenESP32C2.zip] 2025-05-22... [Read more]
2025-05-22 14:32:23: [Found matching file: OpenESP32C2_cse_97086a1b8ac6.img] 2025-05-22 14:32:23: [Sending OTA data to http://192.168.0.162/api/ota attempt... [Read more]
Not sure what you mean. I was testing on C3 SuperMini and that was matched OK. Is your Sonoff not C2? [Read more]
No, it's ESP32 but code in PROTA uses Contains and it tries first binary with ESP32 in name - obviously a bug [Read more]
oh i get you. yes my ESP32 gets sent C2 ota too 2025-05-22 13:51:16: [Found matching file: OpenESP32C2_cse_97086a1b8ac6.img] 2025-05-22 13:51:16: 2025-05-22 13:51:29: [Error sending OTA update:... [Read more]
I've added a fix, the substring approach was treating ESP32S2 as ESP32. [Read more]
How's it going with the CSE7761 experience on ESP? [Read more]
I've did some tests but I couldn't get receiving to work. I've also realized that we need HAL to choose custom UART pins on ESP32 (@insmod but I also may do it soon). My current plan is to just take an... [Read more]
I thought about playing with UART again and adding ESP pin selection after w800/berry and then bk7231u/7252 is merged. Initial idea is to add something like HAL_AddPlatformSpecificCommands() and executing... [Read more]
this would be good. I'm just flashing new BK7252U device with same tests as in doorbell thread. [Read more]
So w800 + berry is ready to merge? [Read more]
Yes. The only recommendation for BL602 is to use partition layout toml from here: https://github.com/openshwprojects/OpenBK7231T_App/pull/1629#issuecomment-2876874850 You can even try to enable berry... [Read more]
Permanent or recoverable via UART? Would it possible to add a safe check for that? [Read more]
Recoverable. I don't know how OTA is performed on BL602, but if there is a header with unpacked size, then perhaps it's possible. [Read more]