logo elektroda
logo elektroda
X
logo elektroda

Disassembling Tuya-Based UK Smart Plug and Installing OpenBeken Firmware [LN882H] [FL-M118-V1.2]

divadiow 2244 5

TL;DR

  • A generic Tuya-based UK smart plug with BL0937 energy metering was opened, flashed from Tuya firmware to OpenBeken, and rebuilt around an LN882H FL-M118-V1.1 module.
  • The rear-mounted RX, TX, 3.3V and GND pads forced de-soldering the main PCB from the power prongs before backing up and flashing the module over UART.
  • The factory backup took about 40 minutes and produced a 2,097,152-byte main .bin file plus an _otp.bin file.
  • After flashing, the plug booted into an access point at 192.168.4.1, then joined Wi-Fi and was configured for BL0937, LED, button, and relay roles.
  • Grounding A9 is required for flashing boot mode, the B9 boot log is not routed out, and the casing still needs epoxy plus MQTT/Home Assistant setup.
Generated by the language model.
ADVERTISEMENT
📢 Listen (AI):
  • Here I'll take a look inside a generic Tuya-based UK smart plug with energy metering. The Tuya firmware on the main chip will be replaced with OpenBeken.

    This plug can be bought from Ali Express
    Tuya smart plug with energy monitoring available on AliExpress.

    Packaging and product externals:
    Close-up of a UK smart plug with electrical pins and specification label. Smart plug with three prongs and an instruction manual. Open box containing a Tuya smart plug, with the plug inside. Smart plug packaging with manufacturer details. Photo of Tuya smart plug packaging with a barcode.Smart device user manual. A smart plug user manual lies on the carpet, instructions are written in English.

    To open, I trapped the plug in a vice below the joining lip/edge knowing that that's where the two main case pieces would be glued. With some decent, but not extreme, clamping the glue can be heard to give way and crack apart. A thin spudger helps it along. Rotate unit so different points are put under pressure until the glue is cracked in more places than not and the unit can be pulled apart by hand. My device was not glued well so this sample was relatively easy compared to some.
    Close-up of a white UK smart plug with a three-pin connector and visible CE and RoHS certifications. Tuya smart plug in a vise with a tool for opening the casing. Image of a three-pin electrical plug placed in a vise, partially opened with a tool.

    Now that we're inside:
    Interior of a smart plug with electronic components on a circuit board. Interior of a smart plug showing the circuit board and components. Close-up of the interior of an electronic module labeled CB2S with Lightning LN882HKI chip. Interior of a smart plug with visible electronic components Close-up of the interior of a Tuya smart plug showing the module and components. View of the interior of a smart plug with electrical components on the PCB. Interior of a smart plug with electronic components on a circuit board. Close-up of a circuit board inside a smart plug with energy metering. Close-up of the interior of a smart plug with the FL-S138-V2.0 board.

    Some identified main components of interest:
    Belling BL0937 energy metering chip
    FL-M118-V1.1 Lightning Semi Conductor LN882HKI module
    ZK32F 005-HLT 16A@250VAC Shenzhen Zhongke Zhilian Electronics Co.,Ltd. relay
    Main PCB marked as FL-S138-V2.0
    AMS1117-3.3v linear voltage regulator

    The FL-M118-V1.1 module is what we need access to. We need to get to certain contacts on the module to be able to take a backup of the Tuya factory firmware and flash OpenBeken (OpenLN882H).

    Unfortunately RX, TX, 3.3v and GND module contacts are at the rear underside facing the centre of the plug - inaccessible without de-soldering the main PCB from the power prongs.
    Close-up view of the CB2S module mounted on a PCB inside a smart plug.
    To de-solder I added some flux to the solder points and then melted some 63/37 pb solder into the mix to reduce the melting point of the solder used by the factory
    Close-up of the main circuit board of a smart plug with highlighted solder points.
    This process was laborious because the whole power prong draws heat away from the solder point quickly, meaning it has to heat up a lot to get to melting point. Solder wick was used to soak up most of the solder but some stubborn bits remained - keeping the unit fixed in place. Switching sides slowly inching each upwards when melted was the solution.

    With the main PCB free the FL-M118-V1.1 can be de-soldered also using wick/pb/flux.
    Bottom of the smart plug's printed circuit board.

    The "CB2S" label is...interesting. "CB2S" is of course usually reserved for Beken BK7231N modules . This LN882H is a drop-in pad-compatible replacement for CB2S, so maybe that's the link trying to be made. I've labelled all pads for clarity:

    CB2S module board with LN882HKI chip View of the FL-M118-V1.1 module with labeled pins.

    RX/TX/VCC/GND and A9 (needs to be grounded for the flashing boot mode) all soldered ready:
    Electronic module with connected wires on a blue surface.

    Connect to USB-TTL UART adaptor as:
    USB-TTL RX -> Module TX
    USB-TTL TX -> Module RX
    External 3.3V PSU (XL4015 in my case) -> Module 3.3V
    USB-TTL GND + Module GND + A9 + PSU GND (all common ground)

    Insert USB adaptor then power on PSU. Using the attached flashdumper.py script in the attached zip the following was run to start the backup
    Code: Text
    Log in, to see the code


    After approximately 40 minutes the backup is complete - two files are output <filename>.bin and <filename>_otp.bin
    the main backup file should be exactly 2,097,152 bytes.

    Power off, unplug USB, replug USB and power on PSU so OpenLN can be flashed. Using the steps outlined in here we can flash the latest LN882H UART flash file.

    Without A9 grounded the next power-up of the module should lead to an AP broadcast that can be connected to in the browser on 192.168.4.1 after joining to AP. From there OpenBeken can be joined to your wifi through the Config-> Configure Wi-Fi & Web menu. After reboot check you can browse to the DHCP-assigned IP of your device.

    Wi-Fi network icon OpenLN882H_C2B0B167 on available networks list.

    OpenLN882H user interface on a computer screen.

    With the module back in the empty slot on the main PCB, stabilised with a bit of blu-tac, the module can be soldered back. Plenty of flux and small solder blobs, especially with the ground pad which tends to be wider and requires a little more contact to heat up. I have had to de-solder the whole module again in the past before because the ground blob has splurged into neighbouring pads and I couldn't clear it with wick. I always check there isn't continuity between contacts when soldering is complete.

    The result after clearing up flux residue with IPA:
    Close-up of a smart plug's printed circuit board with visible solder contacts.

    After clearing any remaining solder from the main PCB holes, the unit can be soldered back together in position
    View of the interior of a smart plug with FL-S138-V2.0 circuit.

    What remains now is to configure the BL0937, LED, button and relay roles within OpenBeken so the plug is fully operational, exactly like or close to factory behaviour.

    Through the use of the GPIO doctor, multimeter continuity tracing and a process of elimination (GPIO options are limited to just a few on this module), the following has been determined and tested to work;

    Code: Text
    Log in, to see the code


    which makes the whole template, which can be imported through the web application the following:

    Code: JSON
    Log in, to see the code


    BL0937 metering can be calibrated as per this post: https://www.elektroda.com/rtvforum/topic4030107.html#20920434

    What remains:
    Epoxy resin glue plug casing back together
    Setup MQTT/Home Assistant https://youtu.be/pkcspey25V4?si=hPcIBAFMfHqR22sa
    Ensure PowerSave 1 is set in startup command or autoexec.bat:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands-extended.md



    Notes since initial draft

    I note that the main PCB Marking starts FL- (FL-S138-V2.0) as does the marking on the module (FL-M118-V1.1). The name on one of the stickers on the box is for a Shenzhen Farylink Technology Co.,Ltd. It would be reasonable to assume FL = Farylink, also the store on Ali Express it was bought from. I don't think it would be a stretch to assume similarly-named modules like the FL-M61 V2, FL_M99_V1/2/3 are all Farylink.

    Electronic module with an integrated circuit and soldered components FL-M61 V2 module with visible IR620S1 chipset.

    How to flash FL_M99_V1/FL_M99_V2/FL_M99_V3/CB2S WiFi module - BK7231N Tuya Home Assistant guide
    https://fcc.report/company/Shenzhen-Farylink-Technology-Co-L-T-D



    UART boot log B9 is not routed out to a pad on the module so I had to use my sewing needle probe to capture the log, which is:

    Code: Text
    Log in, to see the code




    The factory firmware backup is file Tuya_3.5.4_Farylink-UK_Plug_(Smart-Plug-schemaID-g2xobg)_cptnnkbvpdxkkcvy_FL-M118-V1.1_1.0.0.bin at https://github.com/openshwprojects/FlashDumps/tree/main/IoT/LN882H




    Tuya app paired device pics

    Tuya app screen displaying smart plug energy usage information. Schedule screen in Tuya app with the option to add a new schedule. Screenshot of the Tuya app showing energy monitoring. Screenshot of Tuya app settings for a smart plug.

    Cool? Ranking DIY
    About Author
    divadiow
    Level 38  
    Offline 
    divadiow wrote 4832 posts with rating 851, helped 420 times. Live in city Bristol. Been with us since 2023 year.
  • ADVERTISEMENT
  • #2 21437194
    p.kaczmarek2
    Moderator Smart Home
    This is the first time I see CB2S module with non-Beken chip. So far I've only seen like 3 types of CB2S:
    - original CB2S (the most common one)
    - CB2S with BK7231M (different Beken keys, now supported by OBK)
    - CB2S with incorrect silk screen (wrong VDD, GND, UART placements)
    And your CB2S is now the fourth kind, interesting. This may certainly confuse beginners.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21437215
    divadiow
    Level 38  
    maybe it's their way of marking it as a CB2S replacement for interchangeable use internally within their product dev team? Dunno.

    What's also confusing, and I forgot to mention in the notes, is that the boot log looks like it contains all the pin assignments. eg:

    Code: Text
    Log in, to see the code

    but they don't line up with the correct GPIO# or IC pin# so 🤷🏼‍♂
  • ADVERTISEMENT
  • #4 21437502
    p.kaczmarek2
    Moderator Smart Home
    Do they match with the pin indexes as if it were a true BK7231N module? I mean, is the P23 on BK7231N CB2S location the same as bt1_pin here?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 21437530
    divadiow
    Level 38  
    good question! that would make sense.
    ...
    it started to look like that was the answer, until..

    Comparison table with columns related to Boot Log, FL-M118-V1.1, OBK, and Boot Log Match to CB2S.
  • #6 21437564
    p.kaczmarek2
    Moderator Smart Home
    but wait, LN882H has pins in port + index format:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/hal/ln882h/hal_pins_ln882h.c
    Code: C / C++
    Log in, to see the code

    and OBK mapping (indexes) is our own idea, maybe Tuya has there a different table order
    Helpful post? Buy me a coffee.
📢 Listen (AI):

FAQ

TL;DR: This FAQ shows how to open a glued UK Tuya smart plug, back up its 2,097,152-byte LN882H firmware, and flash OpenBeken. As one expert noted, "This may certainly confuse beginners." It is for users facing CB2S-labeled hardware that is actually an FL-M118-V1.1 LN882H module, not a standard BK7231N board. [#21437194]

Why it matters: CB2S silkscreen, hidden UART pads, and LN882H-specific flashing steps can cause wrong wiring, bad pin mapping, or failed recovery if you treat this plug like a normal Tuya BK7231N device.

Module variant Main chip Labeling note Flashing implication
Original CB2S BK7231N Normal CB2S identity Use standard BK7231N expectations
CB2S with BK7231M BK7231M Different Beken keys Needs OBK support for BK7231M
CB2S with incorrect silk screen Varies Wrong VDD/GND/UART markings High risk of miswiring
FL-M118-V1.1 replacement LN882H Marked "CB2S" but not Beken Needs LN882H/OpenLN882H workflow and A9 boot handling

Key insight: The safest path is to treat FL-M118-V1.1 as an LN882H module first and a CB2S-compatible footprint second. The label helps mechanical compatibility, but it does not guarantee BK7231N pinout, boot behavior, or UART access. [#21437564]

Quick Facts

  • The plug uses a BL0937 energy-metering IC, an LN882H Wi‑Fi module marked FL-M118-V1.1, a 16A @ 250VAC relay, and an AMS1117-3.3V linear regulator on PCB FL-S138-V2.0. [#21437054]
  • The factory flash dump takes about 40 minutes and should produce two files: <filename>.bin and <filename>_otp.bin. The main binary should be exactly 2,097,152 bytes. [#21437054]
  • UART flashing needs crossed serial lines and a separate 3.3V supply: USB-TTL RX→TX, TX→RX, plus common GND shared with module GND and A9 during boot-mode entry. [#21437054]
  • Verified OpenBeken pin roles for this plug are Btn on 0, LED on 3, BL0937CF1 on 6, BL0937SEL on 7, Relay on 11, and BL0937CF on 12; the template also enables powersave 1. [#21437054]

How do you safely open a glued Tuya-based UK smart plug without cracking the case or damaging the PCB?

Open it by compressing the case seam, not by prying the PCB area directly. 1. Clamp the plug in a vice just below the joining lip where the glue line sits. 2. Apply firm, controlled pressure until the glue audibly cracks. 3. Work around the perimeter with a thin spudger and rotate the unit so different points take pressure. This sample opened fairly easily because the glue bond was weak, but heavily glued units need more patience and more seam rotations before hand separation is safe. [#21437054]

What is the FL-M118-V1.1 module, and how is it related to the Lightning Semi LN882H chip?

The FL-M118-V1.1 is a Wi‑Fi module built around the Lightning Semi LN882H chip. "FL-M118-V1.1" is a Wi‑Fi module that carries the LN882H SoC, uses a CB2S-compatible pad layout, and lets the smart plug connect to Tuya or OpenBeken firmware. In this plug, it is the target board that must be desoldered, backed up, and reflashed. The thread also notes that the board and module names likely point to Farylink, with markings such as FL-S138-V2.0 and FL-M118-V1.1. [#21437054]

Which UART connections and power wiring are needed to back up and flash an LN882H module with OpenBeken/OpenLN882H?

You need crossed UART, a separate 3.3V supply, and one common ground. Wire USB-TTL RX to module TX, USB-TTL TX to module RX, external 3.3V PSU to module 3.3V, and tie USB-TTL GND, module GND, A9, and PSU GND together. The author used an XL4015 supply and powered the USB adaptor first, then enabled the PSU. That wiring supports both the backup stage and the later OpenLN882H UART flashing stage. [#21437054]

Why does the FL-M118-V1.1 LN882H module carry a "CB2S" label even though it is not a Beken BK7231N module?

It likely uses the CB2S label to signal pad compatibility, not chip identity. The thread states that LN882H is a drop-in, pad-compatible replacement for CB2S, so the marking may help an internal product team reuse footprints. A moderator also notes this is the first CB2S-marked module they have seen with a non-Beken chip, after already seeing original CB2S, BK7231M CB2S, and misprinted CB2S variants. That label can mislead beginners into assuming BK7231N tooling and pin maps will work unchanged. [#21437194]

What is the BL0937 energy metering chip, and how is it configured in OpenBeken for this UK smart plug?

The BL0937 is the plug’s power-measurement IC, and OpenBeken uses three assigned pins to read it. "BL0937" is an energy-metering chip that measures electrical usage, exposes pulse-based outputs, and needs dedicated CF, CF1, and SEL signal assignments for correct voltage, current, and power reporting. On this plug, the working roles are BL0937CF1 on GPIO 6, BL0937SEL on GPIO 7, and BL0937CF on GPIO 12. Those assignments were confirmed with GPIO Doctor, continuity checks, and elimination. [#21437054]

Where are RX, TX, 3.3V, GND, and A9 located on the FL-M118-V1.1 module, and why do you need A9 grounded for flashing mode?

They sit on the rear underside of the module, facing the center of the plug, so you cannot access them in-circuit. The author says RX, TX, 3.3V, and GND are inaccessible until the main PCB is removed from the power-prong assembly. A9 must be tied to ground during power-up to force the LN882H into flashing boot mode. After flashing, you remove the A9 ground so the next boot starts normal firmware and the temporary AP appears at 192.168.4.1. [#21437054]

What steps are involved in dumping the factory Tuya firmware from an LN882H using LN882H_Flash_Dumper.py, and what output files should you expect?

The dump process needs boot-mode wiring, a Python script, and patience. 1. Solder leads to RX, TX, 3.3V, GND, and A9, then ground A9. 2. Connect UART and power, then run LN882H_Flash_Dumper.py with a COM port and output name. 3. Wait about 40 minutes for completion. You should get two files: a main .bin and an _otp.bin. The main backup must be exactly 2,097,152 bytes, or the dump is incomplete or suspect. [#21437054]

Why does desoldering the main PCB from the UK plug prongs take so much heat, and what role do flux, solder wick, and 63/37 leaded solder play?

It takes so much heat because the large metal prongs act like heat sinks and pull energy away from the joints. The author added flux and mixed in 63/37 leaded solder to lower the effective melting point of the factory solder. They then used solder wick to remove most of the solder, but some stubborn residue still held the PCB in place. The practical fix was to heat alternating sides and inch the board upward gradually rather than forcing one side free. [#21437054]

How do you reassemble and resolder the FL-M118-V1.1 module and main PCB after flashing without creating shorts on the ground pad?

Reassembly works best when you stabilize the module, use extra flux, and check continuity before final closure. The author placed the module back into the empty PCB slot, held it with blu-tac, and soldered it with small solder blobs. The ground pad needs special care because it is wider and heats slowly; excess solder can bridge neighboring pads. They specifically warn that ground-pad overflow once forced a complete rework, so they always test for unwanted continuity before resoldering the main PCB and gluing the case shut. [#21437054]

Which OpenBeken GPIO roles and template settings make the relay, button, LED, and BL0937 power metering work on this Farylink 16A UK smart plug?

The working template uses six GPIO assignments and one startup command. Set GPIO 0 to Btn;1, 3 to LED;1, 6 to BL0937CF1;1, 7 to BL0937SEL;0, 11 to Rel;1, and 12 to BL0937CF;1. The JSON template identifies the device as a Farylink 16A UK smart plug on LN882H board FL-M118-V1.1. It also sets flags to 1024 and uses the startup command powersave 1, which the author lists as a remaining post-flash requirement. [#21437054]

How do you calibrate BL0937 voltage, current, and power readings after installing OpenBeken on a Tuya smart plug?

Calibrate BL0937 after flashing by following the dedicated calibration post linked from the thread. The main post confirms that BL0937 metering can be calibrated for voltage, current, and power after the GPIO roles are working. It does not repeat the coefficients or command sequence inline, so the critical prerequisite here is correct BL0937 pin mapping and a functioning OpenBeken setup first. Without that, calibration values would tune the wrong signal path and produce misleading energy data. [#21437054]

What is the GPIO Doctor in OpenBeken, and how does it help identify unknown pins on LN882H-based devices?

GPIO Doctor is an OpenBeken diagnostic tool that helps discover what each pin does on an unknown board. The author used it together with a multimeter continuity test and elimination because the LN882H module exposed only a few realistic GPIO options. That workflow let them identify the button, LED, relay, and BL0937 lines and verify the final mapping. On hardware with misleading silkscreen or reused module labels, GPIO Doctor reduces guesswork and avoids repeated bad templates. [#21437054]

How does a true Tuya CB2S module compare with this CB2S-labeled LN882H replacement, and why can that difference confuse flashing and pin mapping?

A true CB2S normally implies Beken-family expectations, while this replacement only copies the footprint. One moderator lists four CB2S categories now seen: original CB2S, CB2S with BK7231M, CB2S with incorrect silk screen, and this LN882H-based version. That matters because a user may assume BK7231N UART positions, power labels, keys, or GPIO numbering and then wire the board incorrectly. The confusion is strongest here because the module is physically CB2S-like but logically LN882H-specific. [#21437194]

Why don't the Tuya boot log pin numbers seem to match the discovered LN882H GPIO assignments on this smart plug?

They do not match because Tuya’s internal numbering appears different from the OpenBeken LN882H mapping used during reverse engineering. The author notes that boot-log values such as bt1_pin: is 23 do not line up with either the correct GPIO numbers or the IC pin numbers they found by testing. A later reply adds that OpenBeken’s index mapping is its own convention and suggests Tuya may use a different table order. So the log is informative, but not directly usable as a one-to-one GPIO map here. [#21437564]

How might the boot log pin numbers map if the module were treated like a real BK7231N CB2S, and why does that theory appear to break down here?

The first theory was that the numbers might map like a real BK7231N CB2S footprint, but that model stops fitting the evidence. One participant asks whether P23 on a BK7231N CB2S lands where bt1_pin: 23 would suggest. The author says that idea started to look right until further checking contradicted it. The follow-up explains that LN882H uses port-plus-index naming such as A0–A15 and B0–B9, so Tuya’s logged values may follow a different lookup table than either BK7231N positions or OpenBeken indexes. [#21437564]
Generated by the language model.
ADVERTISEMENT