logo elektroda
logo elektroda
X
logo elektroda

Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis

bogdanelhh 5076 45
ADVERTISEMENT
  • #31 21597976
    p.kaczmarek2
    Moderator Smart Home
    Well, with some extra caution the basic testing can be done still with 230V. Just carefully probe where the low voltage should be, usually the input and the output of AMS1117-3.3V, or, in the case of the board from the first photo, VDD and GND pins.

    Of course, detach flash tool first. Otherwise you'd short mains to your PC and damage it.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 21599283
    blacksun2
    Level 8  
    >>21597920
    The socket in question doesn't make a sound anymore. The chip doesn't even activate when I use the contact pins.
    The same thing happens with the 19V power supply.

    I bought a whole collection of these smart sockets on AliExpress.
    There was one among them that also had a Lightning LN882HK1.
    It finally worked with that one.

    Is it still current that with an LN882H chip you have to set "Powersave 1" via autoexec.bat?
    And is it still current that you can't do this via "Startup Command Text," but only via autoexec.bat?

    I created a backup with LN882H_Flash_Dumper.py. How can you extract the Tuya OBK information from "flash.bin"? The Elektroda Flasher tool for Beken can't handle flash.bin.

    Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis

    How can I get for example the PIN-config?
  • #33 21599335
    divadiow
    Level 34  
    blacksun2 wrote:
    How can you extract the Tuya OBK information from "flash.bin"? The Elektroda Flasher tool for Beken can't handle flash.bin.


    your dump is from a device with schema e1k70tx4 which we've seen before. Is your device template not this?:

    Code: JSON
    Log in, to see the code


    Easy Flasher cannot extract every config from dump file.

    As far as I know, this is still correct:

    Code: Text
    Log in, to see the code
  • #34 21599346
    blacksun2
    Level 8  
    divadiow wrote:

    Is your device template not this?:
    Code: JSON
    Log in, to see the code


    Easy Flasher cannot extract every config from dump file.


    ah, ok, I didn't know that. I thought Easy Flasher can extract any Tuya Templates from any dump of Tuya-devices.
    The PIN-Setting worked for the device, but it was pure coincidence that I guessed correctly.
    I ordered 10 different smart plugs from AliExpress. They were all from different retailers. The packaging and labeling don't usually reveal much. The only thing you can figure out is which original app is required, whether Tuya or eWeLink.

    would you be so kind and have a look at this dump file:
    https://www.elektroda.com/rtvforum/topic4128200.html#21599325
    It is a bk7231N and the Easy Flasher cannot extract config too.

    Big thanks.
  • ADVERTISEMENT
  • #35 21602831
    blacksun2
    Level 8  
    >>21599346
    Is there a known problem with these smart Plugs with LN882H Chip and WiFi?

    Yesterday, I installed an OBK update on my plug. Since then, I've been having the problem that the plug no longer connects to the Wi-Fi network.
    At first, I thought it was a problem with the newer version of OBK and I reinstalled 1.18.131 via tx and rx and configured it newly. But the problem still persists.
    I have to plug and unplug the outlet at least 10 times before it reconnects to the Wi-Fi network. Often, but not always, the connection works as long as you don't unplug the outlet again.
  • #36 21602843
    divadiow
    Level 34  
    I do keep hearing about such an issue. Which version did you upgrade from that worked ok?
  • #37 21602868
    blacksun2
    Level 8  
    >>21602843

    Before the update, the device was running version 1.18.131. Then I installed the OTA.bin file for 1.18.133 (via -> config -> Wi-Fi OTA, not via web app). After that, the device stopped coming online, and the button stopped responding.
    I thought something had gone wrong with the update, so I installed 1.18.133 serially, using the bin file without OTA in the filename.
    I was wondering why the socket with the OBK, with its factory settings, wasn't sending out a Wi-Fi AP. I disconnected and reconnected the power several times. Eventually, OBK started, and I was able to integrate the socket into my Wi-Fi network and reconfigure it. Then I noticed again that the connection was lost during the configuration.
    Since I suspected a problem with 1.18.133, I was annoyed and reinstalled 1.18.131 via serial, thinking everything would be fine again. Unfortunately, that's not the case. Even with the older version, it takes countless unplugging and plugging ins before the outlet connects to the Wi-Fi. It could be a coincidence, but with 1.18.131, the connection at least doesn't drop while you're working on the web interface.

    I wouldn't swear that the outlet worked perfectly with 1.18.131 before. It could also have been a coincidence that I didn't notice the problems.

    There's also a minor flaw in the web app for OTA. The web app expects an rbl file as an update file. For LN882H, however, there are only bin files.

    What I can say, however, is that since I reinstalled and configured the outlet, the button is working again, which wasn't the case after the online update. The button works even when there's no Wi-Fi connection. This indicates that OBK is at least running.
  • #38 21607646
    Drakarah
    Level 2  
    I've made a dump of my plug, which seems to be the same or at least very similar with the same chip. I've checked the SHA256 with the firmware that was already posted earlier in the thread and they are different.

    Flashing OpenBeken worked fine as well with the wiring instructions posted earlier in the post
  • ADVERTISEMENT
  • #39 21614453
    olivluca
    Level 7  
    I'm trying to get this device working with esphome (sorry folks) and I cannot get any data from the BL0937.
    Are you sure it is working with openbeken?
    The BL0937 driver uses interrupts to count the CF and CF1 pulses, but according to the datasheet only bank A can use interrupts while CF and CF1 are in bank B.

    Edit: I'd try openbeken myself but I broke the A9 pad while soldering, so I cannot flash it via serial.
  • #40 21614460
    divadiow
    Level 34  
    I have this running currently.
    gif
    Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis

    I can't remember if I calibrated it and I'm not sure if the reading behaviour indicates something is off, but it looks like it's working

    Added after 10 [minutes]:

    olivluca wrote:
    but I broke the A9 pad while soldering, so I cannot flash it via serial.
    could scrape some of the coating off the leading trace? like: https://www.elektroda.com/rtvforum/topic4028087-30.html#20966104

    Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis
  • ADVERTISEMENT
  • #41 21614489
    p.kaczmarek2
    Moderator Smart Home
    @olivluca I would advice against flashing not tested solutions, especially when you can't go back easily when pads break.
    Do you have module version, or like from first post?
    Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis
    Helpful post? Buy me a coffee.
  • #42 21614514
    olivluca
    Level 7  
    divadiow wrote:

    I can't remember if I calibrated it and I'm not sure if the reading behaviour indicates something is off, but it looks like it's working


    So the datasheet is wrong then?

    divadiow wrote:

    could scrape some of the coating off the leading trace?


    It's actually like the picture posted below and I'm quite bad with a soldering iron, I'll see if I can get help from a colleague with better equipment and abilities :-D

    p.kaczmarek2 wrote:
    @olivluca I would advise against flashing not tested solutions, especially when you can't go back easily when pads break.
    Do you have module version, or like from first post?
    Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis


    Yes, it's like that, but if nobody tests untested solutions they'll never become tested ;-)
    In any case I broke the pad while re-soldering the cable to flash openbeken....
  • #43 21614541
    divadiow
    Level 34  
    olivluca wrote:
    So the datasheet is wrong then?


    unsure. I see this

    Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis

    Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis

    my assignments:
    Teardown and Reflashing of Tuya Smart Socket EU20A with LN882HKI Chip Analysis

    Added after 11 [minutes]:

    are external interrupts a different thing? I don't know enough..
  • #44 21614566
    olivluca
    Level 7  
    In your configuration both CF and CF1 are in bank A, in this device (according to the json in the first page which I copied here) are in bank B, it's a different device.

    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "ISPTEC Tuya Smart Socket EU16/20A Wifi Smart Plug With Power Monitoring",
      "model": "EU20A",
      "chip": "LN882H",
      "board": "TODO",
      "flags": "1024",
      "keywords": [
        "LN882HKI",
        "BL0937"
      ],
      "pins": {
        "6": "LED_n;0",
        "7": "Btn;0",
        "19": "Rel;0",
        "20": "BL0937CF;0",
        "21": "BL0937CF1;0",
        "22": "BL0937SEL;0"
      },
      "command": "",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic4091325.html"
    }


    Added after 3 [hours] 59 [minutes]:

    It turns out that, in spite of the documentation, even GPIOs of bank B can generate interrupts. I fixed the problem in libretiny with this modification.
    I found the missing calls by looking at the BL0937 driver in OpenBeken, so thank you.
  • #45 21619377
    brazoayeye
    Level 4  
    Oh, I probably cooked my plug.
    I welded as described and all worked well till I grounded A9. When I did it usb device had an overcurrent, the cpu became very hot and stopped blinking the led.

    Maybe welding I also grounded the near capacitor, or is it because I grounded A9 with the 3v3 connected?
  • #46 21619424
    olivluca
    Level 7  
    brazoayeye wrote:
    Maybe welding I also grounded the near capacitor, or is it because I grounded A9 with the 3v3 connected?


    It depends: if you shorted the side of the capacitor near the chip then, yes, you shorted 3.3V to ground. If you shorted the other side it's already ground. In fact one of the pins (in theory) is 1.1V output from the chip, so if you shorted it to ground you probably destroyed the chip.

Topic summary

The discussion focuses on the teardown and reflashing process of the Tuya Smart Socket EU20A, which uses the LN882HKI chip and supports power monitoring via the Smart Life app with Google Assistant and Alexa integration. The original poster successfully soldered wires to the chip's UART pins (notably A9 to GND for download mode) and flashed the device using an external 3.3V power supply and a CH340 USB-to-serial adapter. Key UART pins identified include RX0/TX0 on A3/A2 (pins 11 and 10) and RX1/TX1 on B8/B9. The reflashing process involves entering download mode by pulling A9 to ground, with LED behavior indicating mode status. Users reported challenges with unstable web configuration interfaces and long firmware dump times (~40 minutes). A configuration template was shared, mapping pins for LED, button, relay, and BL0937 power metering chip signals. Calibration of the BL0937 chip is necessary for accurate power measurement, achievable via the device's web app tools. Backup of original firmware before flashing is recommended but often difficult due to instability. Alternative flashing methods and device variants with different chips (e.g., T34, BK7231N) were noted, with OpenBeken firmware supporting multiple chipsets. Practical advice includes using short cables, lowering serial baud rates (e.g., 115200 or 921000), and ensuring solid ground connections to improve flashing reliability. The community provided links to related resources, firmware repositories, and configuration guides to assist in reflashing and configuring the device for custom use cases such as solar panel energy monitoring.
Summary generated by the language model.
ADVERTISEMENT