logo elektroda
logo elektroda
X
logo elektroda

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

armcamberos 1449 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?
  • #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.
  • ADVERTISEMENT
  • #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 (:
  • #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.
  • #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.
Summary generated by the language model.
ADVERTISEMENT