logo elektroda
logo elektroda
X
logo elektroda

Disassembling and Flashing Tuya BSD29 UK Smart Plug + DS18B20 Sensor Mod [WL2S] [LN882H] [BL0937]

divadiow 1485 3
ADVERTISEMENT
  • Here is a look inside a generic 20A Tuya BSD29 UK smart plug with energy metering capabilities. I will unsolder the main PCB, the module and then flash it to run OpenBeken, cutting it off from all Tuya cloud services. I'll also add a DS18B20 temperature sensor so the temperature inside the casing can be measured.

    This black BSD29 was purchased from the Cerhot Smart Store on Ali Express https://www.aliexpress.com/item/1005006573066580.html
    Image of the AliExpress listing for the Tuya BSD29 20A smart plug.

    Like many plugs, this was welded/glued together very well, meaning some brute force and pressure is required to open. In my vice I clamped the device several millimetres just below the circular rim of the bottom of the plug. This should allow the vice to squash the side wall of the case in very slightly, opening up some small gaps along the glue gap.

    Tuya BSD29 smart plug in a vice with model markings visible.

    I did not film this process (next time!), but the vice was pretty tight. As small gaps opened I used a scalpel to dig down into those gaps, the glue audibly cracking apart as this is done. Rotated the unit around repeatedly until it was more broken apart than not. Be prepared to give it some force. Be careful crushing the button in.

    Once inside we can see its guts, including a Lightning Semiconductor LN882H based WL2S module.

    Close-up of the PCB board of a smart plug with WL2S module. Close-up of the interior of a Tuya BSD29 smart plug, showing electronic components. Image of the interior of the Tuya BSD29 UK 20A smart plug. Photo of the interior of a Tuya BSD29 smart plug with a visible WL2S module. Close-up of the PCB of a Tuya BSD29 smart plug with visible WL2S module. Interior of Tuya BSD29 UK 20A plug with visible PCB components. View of the inside of a smart plug with electronic components. Close-up of the internal electronics of the Tuya BSD29 plug showing a FANHAR module and capacitors.

    And to reach the bottom of the module the live and neutral pins need to be desoldered. This can be achieved with plenty of flux, solder braid and some patience. Heating and lifting each side of the PCB fractionally, in turn, until the legs are freed.

    View of the interior of a smart plug with a round PCB and metal connectors.

    Then the same with flux and braid to remove the WL2S. After which the module can be soldered ready for power and UART flash/backup.

    Image of a PCB with connected wires.

    (Those convenient GND and 3.3V test pads have given me an idea.)

    I have not been able to obtain a datasheet for the WL2S yet. It is not a Tuya module. I made this to add missing detail for me and others in the future:

    Diagram and photos of WL2S module with pin descriptions

    And with connections soldered as follows

    WL2S TXD1 -> USB-TTL RX
    WL2S 3V3 -> 3.3V external PSU
    WL2S GND - > PSU GND/USB-TTL GND

    we get the following boot log captured at 921600 baud

    Code: Text
    Log in, to see the code


    switching to TXD0/RXD0 to the USB-TTL adaptor and grounding A9 we put the LN882H into UART download mode when powered. Which means the attached zipped Python script and exe file can be run to download the 2mb factory firmware to a file. This process takes about 40 minutes.

    Code: Text
    Log in, to see the code


    As detailed in this thread I flashed OpenLN to the module using the separate GUI program.

    I have a bag of 10 Dallas/Maxim fake DS18B20 sensors and those nicely placed 3v3 and ground pads seemed like they could be put to good use. There are also the unused GPIOs A1 and A5 on the back of the module.

    With a 4.7k resistor between the data and VCC legs I tested the sensor working on GPIOA1 on an LN882H test device.

    Diagram of DS18B20 temperature sensor connection with a 4.7 kΩ resistor.

    DS18B20 temperature sensor with heat shrink tubing on a wooden background. DS18B20 sensor with resistor on a wooden table Resistor and DS18B20 sensor on a wooden table.

    With some heatshrink protection, hot glue gun blobs and some careful routing of some wires, the sensor seems to sit fairly happily in this gap in the plug

    Interior of Tuya BSD29 UK smart plug with visible electronic components. Interior of a smart plug with exposed PCB and WL2S module. View of disassembled Tuya BSD29 smart plug with DS18B20 sensor installed.Interior of a smart plug showing the main PCB and electronic components.

    At this point I've soldered the WL2S back into the PCB and tested OpenBeken boots and broadcasts an access point as expected. As luck would have it, the BSD34 template is identical for this device, so that was easy. With the DS18B20 this means:

    Code: JSON
    Log in, to see the code


    which looks like

    OpenLN882H control panel with device information and measurements.

    But for the basic BSD29 OBK template is:
    Code: JSON
    Log in, to see the code


    And finally, some more pics of the packaging, manual and device

    WL2S electronic module on a wooden surface User manual for Tuya BSD29 smart plug with energy monitoring. Smart plug user manual unfolded on the floor. Top view of the Tuya BSD29 UK 20A smart plug. Black Tuya BSD29 UK 20A smart plug with instructions on carpet. Smart plug packaging. Packaging of Tuya BSD29 UK 20A smart plug.Interior of Tuya BSD29 UK 20A smart plug with energy metering, showing the main PCB.

    https://github.com/OpenBekenIOT/webapp/pull/158

    Cool? Ranking DIY
    About Author
    divadiow
    Level 34  
    Offline 
    divadiow wrote 2742 posts with rating 470, helped 245 times. Live in city Bristol. Been with us since 2023 year.
  • ADVERTISEMENT
  • #2 21304053
    p.kaczmarek2
    Moderator Smart Home
    Very nice mod, but aren't the internals of the plug heating up the sensor? Maybe it would make sense to let the DS18B20's head peak out a little bit out of the device case. Still, take care, it seems the power supply here is not isolated, so it should never be exposed...
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21304077
    divadiow
    Level 34  
    yes, but I was only after an idea of the temps inside rather than the environment outside. But mostly so I have a DS18B10 always paired with LN882H ready for immediate testing.
  • #4 21511246
    divadiow
    Level 34  
    in the unlikely event anyone swaps the WL2S for a WB2S, the pin assignments would then be the following for this device

    Code: Text
    Log in, to see the code
ADVERTISEMENT