logo elektroda
logo elektroda
X
logo elektroda

Mapping Pins and Flashing Firmware on WB2S/BK7231T Chip from La Foir'Fouille Smart Plug

bmarchais 1443 2
ADVERTISEMENT
📢 Listen (AI):

  • Hello,

    I've recently found this smart plug at a France store (La Foir'Fouille) for really cheap (less than 5 dollars on sale).
    Packaging of That's smart WiFi plug with QR code on a white background.
    White smart electrical plug.
    So I teardown the device (using a flat screwdriver and some brute force), and found the chip is a WB2S with a BK7231T. Great news!
    Dismantled smart plug showing internal circuit board.
    I flash the firmware using the bk7231flasher_1.0.3 app with the latest 7231T firmware. Works great!
    I follow the traces on the PCB, and after a little bit of trial and errors I successfully map the following pin :
    ButtonPWM5
    LEDPWM1 (inverted !)
    RelayPWM4


    If you have any questions, I am at your disposal!
    Happy hacking!

    Cool? Ranking DIY
    About Author
    bmarchais
    Level 5  
    Offline 
    bmarchais wrote 7 posts with rating 2. Been with us since 2023 year.
  • ADVERTISEMENT
  • #2 20803551
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14612
    Help: 655
    Rate: 12630
    Thanks, can you post JSON template from the Web App?

    PS: I recently had to fix a similiar plug. Electrolytic capacitor had to be replaced due to the lack of enabled PowerSave 1 in OBK. So, please consider enabling PowerSave in OBK startup command. This may prolong the device life.
    Helpful post? Buy me a coffee.
  • #3 20804505
    bmarchais
    Level 5  
    Posts: 7
    Rate: 2
    Hi,
    I successfully added the command "PowerSave 1" in the startup command tab. Thanks for the info.
    Here's the json :
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Thank's smart plug",
      "model": "Thank's smart plug",
      "chip": "BK7231T",
      "board": "TODO",
      "flags": "1024",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "7": "LED_n;1",
        "24": "Rel;1",
        "26": "Btn;1"
      },
      "command": "PowerSave 1",
      "image": "https://obrazki.elektroda.pl/2272951900_1699291211.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic4012920.html"
    }

    I didn't know what to put on the "keywords" value. If this is important, please let me know
    Thanks !
📢 Listen (AI):

FAQ

TL;DR: For a sub-$5 smart plug, “Works great!” is the key result: this La Foir'Fouille model uses a WB2S/BK7231T, maps button/LED/relay to PWM5, PWM1 inverted, and PWM4, and runs OpenBeken with a simple JSON template plus PowerSave 1. This FAQ helps owners flash it and configure it correctly. [#20802666]

Why it matters: This thread gives a working pin map and a usable OpenBeken template for a very low-cost Tuya-style plug.

Option Firmware Control notes Thread evidence
Original setup Stock Tuya firmware Factory state before modification Plug was bought as a retail smart plug [#20802666]
Modified setup OpenBeken on BK7231T Confirmed flashed successfully; custom JSON and startup command shared Flashing and template reported working [#20804505]

Key insight: The most valuable takeaway is the confirmed mapping: Button = PWM5, LED = PWM1 inverted, Relay = PWM4. Once those three assignments are correct, the shared JSON template is enough to make the plug usable in OpenBeken.

Quick Facts

  • Sale price was less than 5 dollars, which makes this plug a low-cost OpenBeken target for experimentation and local control projects. [#20802666]
  • The radio module is WB2S, and the main chip identified on it is BK7231T. That combination is the basis for the flashing and pin-mapping work shown here. [#20802666]
  • Confirmed functional map from PCB tracing and testing: Button = PWM5, LED = PWM1 inverted, Relay = PWM4. These are the three critical control points. [#20802666]
  • The shared OpenBeken JSON uses module pin numbers 7, 24, and 26 with roles LED_n;1, Rel;1, and Btn;1, plus startup command PowerSave 1. [#20804505]

How do I flash OpenBeken firmware onto a WB2S module with a BK7231T chip using bk7231flasher_1.0.3?

Use bk7231flasher_1.0.3, select the latest BK7231T firmware, and verify boot behavior after flashing. The reported process was: 1. Open the plug and identify the WB2S module. 2. Flash the BK7231T with bk7231flasher_1.0.3. 3. Test the device, then map button, LED, and relay in OpenBeken. The thread reports a successful flash and states, “Works great!” after using the latest 7231T firmware. [#20802666]

What are the correct pin mappings for the La Foir'Fouille smart plug with a WB2S/BK7231T module?

The confirmed mappings are Button = PWM5, LED = PWM1 inverted, and Relay = PWM4. These were found by tracing the PCB and validating behavior with trial and error after flashing OpenBeken. In the shared JSON, those functions appear as module pin 26 for button, 7 for inverted LED, and 24 for relay. [#20804505]

Why is the LED on this BK7231T smart plug configured as PWM1 inverted in the JSON template?

The LED is configured as inverted because the tested hardware behaved that way during mapping. The thread explicitly marks the status LED as “PWM1 (inverted !),” and the final JSON uses LED_n;1, where _n indicates inverted logic. If you omit inversion, the LED state will likely appear backward. [#20804505]

What JSON template should I use in the OpenBeken Web App for the La Foir'Fouille smart plug with BK7231T?

Use the shared JSON with chip set to BK7231T, pin 7 as LED_n;1, pin 24 as Rel;1, pin 26 as Btn;1, and startup command PowerSave 1. The posted template also sets vendor to Tuya, flags to 1024, and includes the product image and wiki link. Those values are the only complete working template provided in the thread. [#20804505]

Which startup command should be added in OpenBeken for this plug to enable power saving and reduce stress on the power supply capacitor?

Add the startup command PowerSave 1. That exact command was recommended in the thread and then confirmed as successfully added in the OpenBeken startup command tab. It is the only power-saving command discussed for this plug. [#20804505]

Why can a missing "PowerSave 1" command in OBK shorten the life of the electrolytic capacitor in a smart plug?

Because one repaired plug in the thread needed its electrolytic capacitor replaced after OpenBeken ran without PowerSave enabled. The expert warning was direct: the capacitor “had to be replaced” due to the lack of enabled PowerSave 1, so enabling it may prolong device life. This is a concrete failure case, not a theoretical note. [#20803551]

What should I put in the "keywords" field of an OpenBeken device JSON template, and how important is that field?

The thread does not provide final values for keywords, and the shared template leaves all three entries as TODO. That means you can still create and use a working template without completing that field. The author explicitly asked whether it was important, but no answer defining required values appears in the provided posts. [#20804505]

What is a WB2S module, and how does it relate to the BK7231T chip inside Tuya-based smart plugs?

"WB2S" is a wireless module that hosts the main smart-plug control silicon, exposing the hardware platform used for firmware flashing and GPIO mapping. In this plug, the opened device revealed a WB2S module carrying a BK7231T chip, and that discovery is what made OpenBeken flashing possible. The shared JSON also names the chip as BK7231T and vendor as Tuya. [#20804505]

What is OpenBeken (OBK), and why do people replace the stock Tuya firmware with it on smart plugs?

"OpenBeken" is replacement firmware that lets users reconfigure pins, startup commands, and device behavior on BK7231T-based hardware. In this thread, it was used to flash a cheap Tuya-style plug, apply a custom JSON template, map three functions, and add PowerSave 1. People replace the stock firmware here to gain direct control over relay, LED, and button behavior. [#20804505]

How can I trace the PCB and identify which BK7231T pins are connected to the button, LED, and relay on a smart plug?

Trace each PCB path from the button, LED, and relay back to the module, then confirm each guess by testing in firmware. The author followed the board traces and, after “a little bit of trial and errors,” confirmed three working assignments: PWM5, PWM1 inverted, and PWM4. That combination is the validated result for this exact plug. [#20802666]

What's the safest way to open and tear down a mains-powered smart plug like the La Foir'Fouille model without damaging the board?

Open it carefully and expect a tight enclosure. The only teardown method described used “a flat screwdriver and some brute force,” which worked but clearly risks cosmetic or board damage. A safer interpretation of the thread is to use a flat tool, apply controlled force, and stop once the shell begins separating. [#20802666]

When mapping a relay, button, and status LED on BK7231T, how do PWM pin labels in OpenBeken correspond to the actual module pins in JSON?

In this plug, the functional labels map to JSON pin numbers as follows: PWM1 inverted becomes pin 7 as LED_n;1, PWM4 becomes pin 24 as Rel;1, and PWM5 becomes pin 26 as Btn;1. The thread first gives the PWM-level mapping, then provides the final JSON that ties those functions to actual module pin entries. [#20804505]

Stock Tuya firmware vs OpenBeken on a BK7231T smart plug — which is better for local control, reliability, and customization?

OpenBeken is the better choice in this thread for customization because it was actually flashed, configured, and validated. The evidence is concrete: the plug worked after flashing, the pin map was published, and a startup optimization was added. Stock Tuya firmware appears only as the original factory state, with no comparable customization details provided. [#20804505]

If a BK7231T smart plug flashes successfully but the relay or LED does not respond, what troubleshooting steps should I try next?

Recheck the pin roles first. On this plug, the relay must map to PWM4 and JSON pin 24, while the LED must be inverted on PWM1 and JSON pin 7. If flashing succeeds but behavior is wrong, the most likely issue is an incorrect pin assignment or missing inversion. The thread’s tested map gives you the exact three points to verify. [#20804505]

Where can I buy low-cost smart plugs that use WB2S or BK7231T modules, and how can I identify compatible models before opening them?

This thread only confirms one source: a La Foir'Fouille store in France, where the plug was bought on sale for less than $5. Compatibility was confirmed only after opening the case and finding a WB2S module with a BK7231T chip inside. The thread does not give any external buying guide, model list, or non-destructive identification method. [#20802666]
Generated by the language model.
ADVERTISEMENT