logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

[BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs

armcamberos 2388 12
ADVERTISEMENT
  • #1 20567128
    armcamberos
    Level 2  
    I just bought a 3-way smart switch with a CB3S chip and I'm planning on flashing it. I have a vague idea of the process after watching several videos and doing some reading. When I disassembled it, I found that instead of relays, it has triacs. My question is whether they can be used as dimmers?.. I would appreciate any help, I've searched this forum and other pages but haven't found a similar device.

    [BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs [BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs [BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs [BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs [BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs [BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs [BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs [BK7231N - CB3S] Generic Tuya Wall Switch Touch Buttons 3 Gang No Neutral with Triac Outs
  • ADVERTISEMENT
  • #2 20567157
    p.kaczmarek2
    Moderator Smart Home
    Hello, I don't think that you can convert a non-dimmer device to dimmer that easily. I think triacs are present here because it's a no-neutral device. They must have some kind of mechanism used to power device without neutral wire.

    Still, you can easily use it as a simple on/off light controller.

    Can you provide a 2MB flash dump and/or OBK template for this switch?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20568011
    armcamberos
    Level 2  
    p.kaczmarek2 wrote:
    Hello, I don't think that you can convert a non-dimmer device to dimmer that easily. I think triacs are present here because it's a no-neutral device. They must have some kind of mechanism used to power device without neutral wire.

    Still, you can easily use it as a simple on/off light controller.

    Can you provide a 2MB flash dump and/or OBK template for this switch?



    thank you...I have just ordered the USB adapter. I hope that next week I will be able to perform the dump. Is this process made with
    hid_download_py? like this https://youtu.be/2e1SUQNMrgY?t=370

    I'm also working on pinout for buttons and outputs hope someone have it.
  • ADVERTISEMENT
  • #4 20568022
    p.kaczmarek2
    Moderator Smart Home
    You can also use our newer tool with GUI for windows:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    BK7231GUIFlashTool is a very simple and easy to use BK7231T/BK7231N flasher that can both read 2MB backup and flash automatically OBK firmware.
    Helpful post? Buy me a coffee.
  • #5 20625990
    dead2112
    Level 5  

    Hello @armcamberos, I got the same model of switch. Did you successfully flash it? If so, could you share the pinout for buttons and outputs?
  • ADVERTISEMENT
  • #6 20626159
    p.kaczmarek2
    Moderator Smart Home

    Hello @dead2112, we can extract GPIO from Tuya binary if you do a 2MB backup.
    Helpful post? Buy me a coffee.
  • #7 20627718
    dead2112
    Level 5  
    Unfortunately I can not get the firmware backup I get the following error:
    
    Backup name is set to cb3s.
    Starting read!
    Now is: Thursday, June 22, 2023 3:09:46 PM.
    Flasher mode: BK7231N
    Going to open port: /dev/ttyUSB0.
    Serial port open!
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus failed, will try again - 0/100!
    Getting bus failed, will try again - 1/100!
    Getting bus failed, will try again - 2/100!
    Getting bus failed, will try again - 3/100!
    Getting bus failed, will try again - 4/100!
    Getting bus failed, will try again - 5/100!
    Getting bus failed, will try again - 6/100!
    Getting bus failed, will try again - 7/100!
    Getting bus failed, will try again - 8/100!
    Getting bus failed, will try again - 9/100!
    Reminder: you should do a device reboot now (do power off/on of the device, but don't disconnect UART or do a CEN short to ground for 0.25sec)
    Getting bus failed, will try again - 10/100!
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    Flash MID loaded: 1560EB
    Will now search for Flash def in out database...
    Flash def found! For: 1560EB
    Flash information: mid: 1560EB, icName: TH25Q_16HB, manufacturer: TH, szMem: 1000000, szSR: 2, cwUnp: 0, cwEnp: 7, cwMsk: 407C, sb: 2, lb: 5, cwdRd: 05-35-FF-FF, cwdWr: 01-FF-FF-FF
    Entering SetProtectState(True)...
    sr: 34
    sr: 34
    final sr: 34
    msk: 407c
    cw: 0, sb: 2, lb: 5
    bfd: 0
    sr: 0
    sr: 0
    final sr: 0
    msk: 407c
    cw: 0, sb: 2, lb: 5
    bfd: 0
    SetProtectState(True) success!
    Going to start reading at offset 0x00...
    Reading 0x00... failed with serial.BytesToRead 4095 (expected 4111)
    The beginning of buffer in UART contains 040EFF01E0FCF4061009000000200069 data.
    Failed! There was no result to save.
    


    Added after 3 [hours] 18 [minutes]:

    >>20626159

    I was able to get the firmware with the hid_download_py but get CRC mismatch
    1150976
    CRC should be 693c3de2
    CRC is 3aff1c6c
    CRC check failed
    Wrote 119000 bytes to firmware.bin


    And succeed to flash with hid_download_py

    I figured out the pinout from another post and it is this:
    Code: JSON
    Log in, to see the code


    Thank you, I really love this program now (:
    Attachments:
    • firmware.bin (1.1 MB) You must be logged in to download this attachment.
  • #8 20632402
    dead2112
    Level 5  
    The device is working correctly. The switch stays blue if the light is OFF and red if the light is ON.
    Can this light be switched? I find it more comfortable as red: OFF and blue: ON.

    I have already downloaded the Tuya GPIO config, but I can't figure it out.
  • #9 20632487
    p.kaczmarek2
    Moderator Smart Home
    You can invert LED roles by switching LED to LED_n or WifiLED to WifiLED_n. This, of course, works only if LED is on the separate GPIO.

    If your device has LED on the same GPIO as the relay, then it's impossible to switch LED via software. You would have to do the hardware hack.
    Helpful post? Buy me a coffee.
  • #10 20633109
    dead2112
    Level 5  
    Apparently the LED is in the same GPIO as the relay. Setting Rel_n also changes the LED color.
  • #11 20633174
    p.kaczmarek2
    Moderator Smart Home
    So you can change it only if you can solder and route some jumper wires.
    Helpful post? Buy me a coffee.
  • #12 20633600
    dead2112
    Level 5  

    I got the firmware dump from the OpenBK web app and put it in the BK7231GUIFlashTool to get the config:
    JSON:
    
    {
    	"rl1_lv":"1",
    	"netled_lv":"0",
    	"bt_type":"0",
    	"bt1_pin":"14",
    	"rl3_pin":"9",
    	"rl3_lv":"1",
    	"rand_dpid":"18",
    	"net_trig":"2",
    	"cd_flag2":"1",
    	"led_dp":"15",
    	"jv":"1.0.0",
    	"backlit_select":"0",
    	"nety_led":"1",
    	"netled_pin":"6",
    	"total_stat":"2",
    	"bt3_lv":"0",
    	"bt1_lv":"0",
    	"reset_t":"5",
    	"rl2_lv":"1",
    	"ch_flag1":"1",
    	"ch_flag3":"1",
    	"inch_dp":"19",
    	"module":"CB3S",
    	"bt3_pin":"24",
    	"ch_cddpid1":"7",
    	"init_conf":"14",
    	"rl2_pin":"8",
    	"light_status_select":"0",
    	"bt2_pin":"26",
    	"ch_cddpid2":"8",
    	"ch_cddpid3":"9",
    	"backlit_dp":"16",
    	"cyc_dpid":"17",
    	"ch_num":"3",
    	"bt2_lv":"0",
    	"rl1_pin":"7",
    	"ch_dpid3":"3",
    	"netn_led":"0",
    	"ch_dpid1":"1",
    	"ch_dpid2":"2",
    	"crc":"111"
    }
    

    Text Description:
    
    Device configuration, as extracted from Tuya: 
    - Button (channel 1) on P14
    - Relay (channel 3) on P9
    - WiFi LED on P6
    - Button (channel 3) on P24
    - Relay (channel 2) on P8
    - Button (channel 2) on P26
    - Relay (channel 1) on P7
    


    Device is working fine, it is a shame you can't control the LED with software, but it is a minor thing.

    Hope this helps anyone.

    For flashing using the BK7231GUIFlashTool fails under Linux with mono, but it can be successfully flashed with the hid_download_py with:
    sudo python uartprogram OpenBK7231N_QIO_1.17.151.bin -w -s 0x0 -u 


    Thanks for the support and development.
    Attachments:
    • BK7231N_QIO_3GangSwitch.bin (2 MB) You must be logged in to download this attachment.
  • #13 20633944
    p.kaczmarek2
    Moderator Smart Home

    I have come across only a few devices that have two independent LEDs. In their case, I used to set one LED role to WiFiLED_n and the second to just LED (or LED_n, with inverted state).
    Helpful post? Buy me a coffee.

Topic summary

✨ The discussion revolves around the flashing and functionality of a 3-way smart switch utilizing the CB3S chip, specifically addressing the use of triacs instead of relays. Users express skepticism about converting the device into a dimmer due to its design as a no-neutral device. The conversation includes inquiries about flashing processes, tools like hid_download_py and BK7231GUIFlashTool, and the extraction of GPIO configurations from firmware dumps. Participants share experiences with LED configurations, noting challenges when LEDs share GPIO pins with relays, and discuss potential hardware modifications for LED control. The importance of obtaining a 2MB firmware backup for further customization is emphasized.

FAQ

TL;DR: 2MB backup recommended; this triac no‑neutral CB3S switch is best as a "simple on/off light controller," not a dimmer. Flash OpenBK, map GPIOs, and invert LEDs only when on separate pins. [Elektroda, p.kaczmarek2, post #20567157]

Why it matters: It helps you avoid dead‑ends (like trying to dim) and shows the fastest, proven flashing path for this exact model.

Quick facts:

Quick Facts

Can this CB3S triac-based switch work as a dimmer?

No. The triacs are used to power a no‑neutral device, not for dimming control. Use it as a reliable on/off controller instead. As the expert put it, “simple on/off light controller.” Dimming would require hardware that this board lacks. [Elektroda, p.kaczmarek2, post #20567157]

What’s the exact GPIO pinout for buttons, relays, and the Wi‑Fi LED?

From the Tuya config: Relays on P7 (CH1), P8 (CH2), P9 (CH3). Buttons on P14 (CH1), P26 (CH2), P24 (CH3). Wi‑Fi LED on P6. The module is CB3S and ch_num is 3. This mapping works with OpenBK roles Rel;1–3, Btn;1–3, and WifiLED. [Elektroda, dead2112, post #20633600]

How do I flash OpenBK on Linux for this CB3S/BK7231N?

Use hid_download_py’s UART method. 1) Install hid_download_py. 2) Run: sudo python uartprogram OpenBK7231N_QIO_1.17.151.bin -w -s 0x0 -u 3) Wait for completion and reboot. This procedure was confirmed working when the GUI approach under Mono failed. [Elektroda, dead2112, post #20633600]

How do I back up the stock 2MB firmware on Windows?

Use BK7231GUIFlashTool. It is a simple GUI flasher for BK7231T/N that can read a full 2MB backup and auto‑flash OpenBK. Connect UART, select the COM port, and use the backup function before flashing. [Elektroda, p.kaczmarek2, post #20568022]

My UART backup fails with “BytesToRead 4095.” What should I do?

Reboot the device during “Getting bus…” and try again. You can power‑cycle or briefly short CEN to GND for about 0.25 s. The tool uses 115200 baud in the log. If UART reads still fail or CRC mismatches, switch to hid_download_py; users succeeded flashing that way. [Elektroda, dead2112, post #20627718]

Can I invert the touch backlight colors (red/blue) in software?

Only if the LED is on a separate GPIO. Set LED to LED_n or WifiLED to WifiLED_n. If the LED shares a GPIO with the relay, software inversion is impossible. A hardware rewire is required in that case. [Elektroda, p.kaczmarek2, post #20632487]

How do I configure two independent LEDs (Wi‑Fi and channel)?

If your board has two LEDs, set one role to WiFiLED_n and the other to LED or LED_n, depending on desired polarity. “I used to set one LED role to WiFiLED_n and the second to just LED,” notes the maintainer. [Elektroda, p.kaczmarek2, post #20633944]

What baud rate and reset method should I use during flashing?

115200 baud appears in the tool log. When prompted, reboot the device by power cycling or briefly shorting CEN to GND for around 0.25 seconds. This helps the flasher capture the bus and proceed. [Elektroda, dead2112, post #20627718]

Can someone extract the GPIO mapping for me?

Yes. “We can extract GPIO from Tuya binary if you do a 2MB backup.” Share that backup, and maintainers can decode the pin roles for your exact variant. [Elektroda, p.kaczmarek2, post #20626159]

How many channels does this model support?

Three. The extracted Tuya JSON shows ch_num set to 3, matching a 3‑gang touch switch. Channel pins map to P7/P8/P9 for relays and P14/P26/P24 for buttons. [Elektroda, dead2112, post #20633600]

Does the Windows GUI flasher work on Linux via Mono?

A user reported the GUI failed under Linux with Mono. They succeeded by flashing with hid_download_py using the provided uartprogram command instead. Consider using the CLI path on Linux. [Elektroda, dead2112, post #20633600]

Can I use this triac switch without a neutral wire?

Yes. The triacs are there because the device is designed for no‑neutral installations. They also explain why firmware dimming is off the table on this board. [Elektroda, p.kaczmarek2, post #20567157]

How do I get the GPIO config from the Tuya firmware?

Dump the firmware using the OpenBK web app, then load the dump into BK7231GUIFlashTool. It outputs the JSON mapping with pins and roles, which you can apply in OpenBK. [Elektroda, dead2112, post #20633600]

What’s the default LED behavior after flashing OpenBK on this unit?

On this model, the switch stays blue when the light is OFF and turns red when the light is ON. This behavior reflects the shared LED/relay design on the PCB. [Elektroda, dead2112, post #20632402]
ADVERTISEMENT