logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CB2S] Inverted PCB layout of CB2S on FS-05R Mini Dimmable Switch

iotflasher 6315 30
Best answers

Why does the CB2S pinout on this FS-05R Mini Dimmable Switch look mirrored, and how should I wire or replace it?

The PCB silkscreen is wrong, so you should ignore it and use the standard CB2S/Tuya datasheet pinout instead; on this board the 3.3V/VDD and GND markings are incorrect, which makes the layout appear mirrored [#21005220][#21007009] Check the actual power connections on the PCB to verify the correct orientation rather than trusting the printed labels [#21007009] Once you follow the real pinout, replacement or wiring should be done as for a normal CB2S module, not according to the mirrored silkscreen [#21005220]
Generated by the language model.
ADVERTISEMENT
  • #31 21859199
    pierdata
    Level 6  
    Posts: 5
    Help: 1
    Rate: 1
    Update:
    i was able to get the module working, it is possible that the wrong flags were causing the device to be killed....

    pin setting:
    "7": "Btn;1",
    "8": "LED_n;1",
    "24": "Btn_ScriptOnly;0",
    "26": "Btn_ScriptOnly;0"

    autoexec.bat
    Spoiler:
    // this is not really tuyaMCU but we will treat it as such
    startDriver TuyaMCU
    // set baud rate
    tuyaMcu_setBaudRate 115200


    // create a toggle and a dimmer
    setChannelType 1 toggle
    setChannelType 2 dimmer256


    // invoke refresh on change
    addEventHandler OnChannelChange 1 startScript autoexec.bat refresh
    addEventHandler OnChannelChange 2 startScript autoexec.bat refresh


    refresh:
    // channel 5 is temporary variable, from 0 to 255*3, multiplied also by toggle value
    setChannel 5 $CH2*3*$CH1
    // split into two bytes
    setChannel 3 $CH5/256
    setChannel 4 $CH5%256
    // send the two bytes
    tuyaMcu_sendCmd 0x30 00$CH3$$CH4$



    OpenBK7231N web panel screenshot showing OFF, Toggle 1 button, and a Channel 2 slider

    after further reading of the related topics actually the slider or button does not always work, sometimes you have to press several times i.e. I understand that this is not yet a polished and closed topic....

    My request, because I'm not proficient enough to create these scripts myself, can someone help me to make a ready script without additional options such that I can configure this device properly for its intended use so that the button on the device turns on and off (can also be hold-dimming/brightening) and the 3 contacts power,+ and - as intended to perform their function ?

    thank you in advance
    kind regards
    prucho
  • ADVERTISEMENT

Topic summary

✨ The discussion addresses issues with the FS-05R Mini Dimmable Switch featuring the BK7231N/CB2S Wi-Fi module, specifically the inverted or mirrored PCB silkscreen layout that contradicts official documentation. Users report inability to communicate with the CB2S chip via USB-TTL and BekenWriter, observing continuous 0xFF data on serial lines. The root cause is identified as incorrect silkscreen pin labeling; the correct pinout aligns with Tuya documentation rather than the PCB markings. Solutions include ignoring the PCB silkscreen and following the classic Tuya pinout for connections. OpenBeken firmware and custom scripts (autoexec.bat) enable functional control, including button event handling (click, double-click, hold) and dimmer operation via TuyaMCU-like protocol, though the device uses a custom UART protocol rather than classic TuyaMCU. Wiring guidance for momentary switches in 2-way configurations is provided, emphasizing correct GPIO pin assignments (e.g., pins 24 and 26 for button inputs) and scripting roles (Btn_ScriptOnly) for flexible control. Some users report issues with stock firmware detection and device operation, suggesting firmware replacement or flashing with OpenBeken. Additional notes mention similar silkscreen issues on FS-02HW switches with CB2S modules. The discussion includes references to reverse-engineering resources and firmware flashing tools like Tuya-Cloudcutter, with success dependent on firmware versions.
Generated by the language model.

FAQ

TL;DR: The FS-05R issue is usually a 3.3V/GND pin-label error, not a mirrored CB2S. One expert reply says, "ignore the screen print" and use the standard Tuya CB2S pinout instead. This FAQ helps OpenBeken users identify the real pins, avoid bad flashing setups, and script the dimmer correctly on BK7231N hardware. [#21005220]

Why it matters: A wrong silkscreen can waste hours, block flashing, and make a working dimmer look electrically dead.

Option What the thread shows Practical result
Follow PCB silkscreen 3.3V and GND can be mislabeled on FS-05R Wrong wiring and failed flashing
Follow Tuya CB2S datasheet pinout Repeatedly confirmed in FS-05R cases Correct power and serial mapping
Replace with ESP-02S/TYWE2S Physical swap blocked by layout mismatch Poor replacement path
Use OpenBeken script Working dimmer control shown at 115200 baud On/off and brightness control

Key insight: The board is not truly mirrored in function. The main fault is the invalid CB2S silkscreen, so trace 3.3V and GND on the PCB and trust the Tuya pinout, not the printed labels.

Quick Facts

  • The failing board discussed first is FL-S117A-V2.2 and uses a BK7231N/CB2S setup in an FS-05R mini dimmable switch. [#21004711]
  • The working OpenBeken serial setup in the shared script uses 115200 baud and sends brightness with tuyaMcu_sendCmd 0x30. [#21014712]
  • A newer working revision was restored with pins 7 = Btn;1, 8 = LED_n;1, 24 = Btn_ScriptOnly;0, and 26 = Btn_ScriptOnly;0. [#21859199]
  • One recommended recovery step for odd stock-firmware behavior is to take a 2MB flash copy before further changes. [#21205363]
  • A real use case in the thread drives a 140W fireplace fan and asks to clamp output to 70%–100% to avoid stall or overheating. [#21279972]

Why does the CB2S silkscreen on the FS-05R mini dimmable switch appear mirrored or wrong, and how can I identify the correct pinout?

It appears wrong because the FS-05R has an invalid CB2S silkscreen, not a truly reversed functional pinout. A repeated fix in the thread is to ignore the printed labels and use the classic Tuya CB2S mapping. The quickest check is electrical: trace where 3.3V and GND actually go on the PCB, then align the remaining UART pins from that reference. That approach solved the March 15, 2024 flashing confusion on this exact model. [#21005220]

How do I verify the real 3.3V and GND pins on an FS-05R CB2S board when the PCB labels do not match the Tuya datasheet?

Verify them by tracing the PCB power connections, not by trusting the silkscreen. 1. Turn power off and inspect the CB2S pads. 2. Follow the copper to identify the real 3.3V supply and ground return. 3. Compare that electrical layout with the standard Tuya CB2S pinout. The thread states that once 3.3V and GND are checked this way, the invalid print becomes obvious. [#21007009]

What is CB2S, and how is it different from CB3S or ESP-02S/TYWE2S in Tuya-based dimmer modules?

"CB2S" is a Tuya Wi‑Fi module that provides the radio and GPIO interface for the dimmer, with a standard pin order used in Tuya documentation. In this thread, CB2S is the module mounted on the FS-05R, while CB3S is mentioned as another module the user had flashed successfully before. ESP-02S/TYWE2S is discussed as a replacement idea, but the bad board labeling and layout mismatch make that swap impractical here. [#21004711]

What is TuyaMCU in the context of OpenBeken, and why is the FS-05R described as using a TuyaMCU-like custom UART protocol instead of a classic TuyaMCU?

In this case, OpenBeken uses the TuyaMCU driver as a convenient transport, but the FS-05R does not speak classic TuyaMCU. The thread states that the dimmer uses a custom UART protocol with packets similar to TuyaMCU, so scripts treat it like TuyaMCU for command sending. That is why the working script starts the TuyaMCU driver, sets 115200 baud, and still notes that the protocol is actually simpler and custom. [#21200780]

How can I flash or configure an FS-05R BK7231N/CB2S dimmer with OpenBeken when BekenWriter only shows endless 0xFF output on serial?

Start by assuming the pin labels are wrong, because endless 0xFF can come from wiring against the bad silkscreen. The successful fix in this thread was to ignore the board print, use the Tuya CB2S datasheet pinout, and then continue with OpenBeken setup. After that correction, the user confirmed the approach worked and moved on to dimmer scripting. If the device still behaves oddly, take a 2MB flash backup before deeper changes. [#21007004]

Which OpenBeken pin roles should I assign on the FS-05R for GPIO 7, 8, 24, and 26 to get the onboard button, LED, and dimming controls working?

Use GPIO 7 for the main button, GPIO 8 for the LED, and GPIOs 24 and 26 for script-driven dimming buttons. A newer working setup in the thread used: 7 = Btn;1, 8 = LED_n;1, 24 = Btn_ScriptOnly;0, and 26 = Btn_ScriptOnly;0. The stock firmware dump also exposed the same functional mapping: bt_pin 7, display_led1_pin 8, lightminus_sw_pin 24, and lightplus_sw_pin 26. [#21859199]

How do I use autoexec.bat on OpenBeken to control the FS-05R dimmer, including on/off, dimmer256, and UART brightness commands?

Use autoexec.bat to create channels, refresh on change, and send a 2-byte brightness value over UART. The shared working method starts the TuyaMCU driver, sets 115200 baud, assigns channel 1 as toggle, assigns channel 2 as dimmer256, and calculates channels 3 and 4 from channel 5 before sending command 0x30. The script multiplies brightness by 3 and by the on/off state, then splits the result into high and low bytes. [#21014712]

What is the best way to set up single-click, double-click, and hold actions for the FS-05R buttons in OpenBeken scripts?

Use event handlers on GPIO 24 and 26, then map each gesture to a clear brightness action. The shared script uses single-click for off or on, double-click to jump to 15 or 255, and hold to change the dimmer by -5 or +5 within a 0 to 255 range. That setup gave reliable local and remote control on the reported unit. It is the most complete gesture example in the thread. [#21014712]

How should a 2-terminal momentary wall switch be wired to the FS-05R terminals labeled power, +, and -, especially for 2-way control?

A 2-terminal momentary switch should be wired between the selected GPIO line and N, so the switch simply shorts those two wires when pressed. The guidance in the thread says to follow the manual wiring, then assign the relevant OpenBeken pin as a button input. For the plus function, GPIO 26 was specifically suggested, and the explanation notes that the switch uses only two wires even though the dimmer exposes separate control terminals. [#21201830]

What troubleshooting steps should I follow when an FS-05R dimmer powers from L and N but shows no LED, is not detected by the Tuya app, or seems dead out of the box?

Check the load type before declaring the unit dead. The thread notes that this dimmer has no relay, so you will not hear a click, and a non-dimmable LED lamp may not behave as expected. Test with a classic dimmable bulb on the output, inspect the app state, and verify that the stock firmware actually boots. One user later found the unit was booting and joining Wi‑Fi after initial confusion. [#21204021]

How does Tuya-Cloudcutter compare with serial flashing for the FS-05R, and how much does the installed Tuya firmware version affect success?

Cloudcutter success depends on the installed firmware version, while serial work depends more on correct physical pin access. In the thread, the direct reply to the Cloudcutter question says the deciding factor is firmware version and asks whether the firmware was dumped first. No confirmed Cloudcutter success case appears in this discussion, so version awareness is the key practical limit mentioned here. [#21200557]

What does Btn_ScriptOnly mean in OpenBeken, and when should it be used instead of a normal Button role on BK7231N devices?

Btn_ScriptOnly is a button role that emits events but does not automatically toggle outputs. Use it when your logic lives in scripts, such as this FS-05R dimmer where GPIO 24 and 26 trigger custom click, double-click, or hold actions. A normal button role suits simple direct control, while Btn_ScriptOnly prevents unwanted automatic relay behavior and keeps the script in charge. [#21206747]

How can I limit the FS-05R dimmer control range in OpenBeken, for example to 70%–100%, to protect a 140W fireplace fan from stalling or overheating?

Limit the effective dimmer value inside the script before sending UART brightness. The thread’s fan use case asks for a 70%–100% range on a 140W fireplace blower so the motor always starts and avoids overheating. The right place to change behavior is the autoexec.bat calculation section, because that script already converts channel 2 into the transmitted two-byte brightness command. Clamp or remap the dimmer there instead of changing hardware wiring. [#21279972]

What causes an OpenBeken autoexec.bat script or template import to make a newer FS-05R PCB revision disappear from the network, and which flags or pin settings should be checked first?

The first things to check are template flags and pin assignments. A March 10, 2026 follow-up reports that a newer PCB revision vanished from the network after applying settings, then recovered once the user corrected the configuration and suspected wrong flags. The restored working setup used GPIO 7 as Btn;1, GPIO 8 as LED_n;1, and GPIOs 24 and 26 as Btn_ScriptOnly;0. Start there before blaming the script logic. [#21859199]

How could a rotary encoder like the KY-040 be integrated with an FS-05R running OpenBeken for dimming control, given that GPIO24 and GPIO26 are already used as button inputs?

The thread does not provide a finished KY-040 implementation, but it does show the practical constraint: GPIO 24 and 26 are already assigned as button inputs on this dimmer. That means an encoder needs either reassigned free pins or a redesign of the current button scheme. The discussion confirms that 24 and 26 are the active local control lines, so you cannot add an encoder there without giving up their existing button roles. [#21207752]
Generated by the language model.
ADVERTISEMENT