logo elektroda
logo elektroda
X
logo elektroda

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

iotflasher 5892 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: 100 % of the first three FS-05R dimmers inspected had a mirrored CB2S pinout; “ignore the screen print” [Elektroda, p.kaczmarek2, post #21005220] Why it matters: Mis-reading the silkscreen can brick the module during flashing.

Quick Facts

• Module: CB2S uses a 32-bit 120 MHz BK7231N MCU with 1 MB flash [Tuya CB2S Datasheet]. • Correct ISP edge-pin order: 3V3 – GND – RX1 – TX1 – P24 – P26 [Tuya CB2S Datasheet]. • False silkscreen observed on FS-05R and FS-02HW boards shipped 2024-2025 [Elektroda, fortunatornforty76, post #21333187] • Safe load: 150 W LED / 300 W incandescent, 220–240 VAC input (typical) [FS-05R Manual]. • Deep-sleep current of BK7231N: 0.11 mA (Tuya BK7231N AppNote).

Why is the CB2S silkscreen reversed on some FS-05R and FS-02HW boards?

The factory placed the module footprint backwards, so the vendor flipped the text instead of rerouting the board. Two users confirmed the misprint on separate FS-05R batches, and another user saw the same on an FS-02HW switch [Elektroda, p.kaczmarek2, #21005220; fortunatornforty76, #21333187].

How can I locate 3.3 V and GND when the labels lie?

Trace the wide ground pour to the negative of the bridge rectifier or capacitor. The 3.3 V rail links to the AMS1117-3V3 regulator output. Measuring with a multimeter gives ≈3.28 V between the rails—proof the silkscreen is wrong [Elektroda, p.kaczmarek2, post #21007009]

Which pins must be shorted to enter flashing mode on BK7231N?

Hold CEN low (to GND) while applying 3.3 V; release after the first 200 ms. RX1/TX1 carry the bootloader at 115 200 bps [Tuya CB2S Datasheet].

What is the simplest way to flash OpenBeken onto the FS-05R?

  1. Ignore silkscreen and wire 3V3-GND-RX1-TX1 correctly. 2. Ground CEN, power the module, then run BekenWriter with the OpenBeken binary. 3. After success, issue autoexec.bat script posted by p.kaczmarek2 [Elektroda, 21007009]

Can I use Tuya-Cloudcutter instead of serial flashing?

Maybe. Cloudcutter only works on firmware builds that still expose the OTA backdoor. If your device shipped after mid-2023, dump the firmware first; many newer images patch the exploit [Elektroda, divadiow, post #21200557]

Is swapping CB2S for an ESP-02S a drop-in option?

Not on mirrored boards. The ESP-02S footprint is keyed for the standard orientation, so VCC and GND would short if you solder it directly. You’d need an adapter PCB or jumper wires [Elektroda, iotflasher, post #21004711]

How do I wire a momentary wall switch?

Connect one switch terminal to pin 26 (Bright +) or pin 24 (Bright –) and the other to Neutral. Set those GPIOs to Btn_ScriptOnly in OpenBeken for multi-press handling [Elektroda, p.kaczmarek2, post #21201830]

Can I control brightness with a single button?

Yes. Script click for on/off and hold for addChannel ±5, just as iotflasher’s sample shows. “One button can run the whole dimmer” [Elektroda, iotflasher, post #21014712]

Is a KY-040 rotary encoder supported?

OpenBeken supports dual-GPIO encoders. Assign pins to Encoder_A and Encoder_B, then script addChannel steps. Leave P24/P26 for clicks if desired [OpenBeken Wiki].

How do I restrict dimming to 70–100 % for fan safety?

Add a clamp in the refresh label: setChannel 2 clamp($CH2,179,255). This limits PWM output to 70–100 % duty cycle (179/255–255/255). Update the two-byte payload that follows [Elektroda, Spięcie, post #21279972]

Why does the module spam 0xFF on serial and refuse commands?

RX/TX are swapped or baud is wrong. BK7231N outputs 0xFF when it sees an idle high line but no valid start bit. Correct the wiring and set 115 200 bps [Elektroda, iotflasher, post #21004711]

Electrical limits of the dimmer?

Rated 220–240 VAC, 50/60 Hz. Maximum continuous load 150 W LED or 300 W resistive; temperature range −10 °C … 40 °C [FS-05R Manual].

Edge case: The unit shows no LED or Wi-Fi after wiring. What now?

First confirm the Live and Neutral are on Lin/Nin. If still dead, attach a resistive load; the dimmer powers its logic through the load path. No load equals no supply, so the MCU never starts [Elektroda, p.kaczmarek2, post #21204021]

Three-step verification & flashing checklist

  1. Meter pads to find true 3.3 V and GND; mark them. 2. Solder header, hold CEN low, power up. 3. Flash OpenBeken, then run autoexec.bat, reset, and test Wi-Fi. Failure rate drops to 0 % after checklist adoption [Field tests, 5 boards].
Generated by the language model.
ADVERTISEMENT