logo elektroda
logo elektroda
X
logo elektroda

[Solved] BK7231 T34 Chip 1-Gang Light Switch Not Controlling Relay After OpenBeken Flash

uid1123444 1218 16
Best answers

Why does my BK7231 T34 1-gang touch switch change state in OpenBeken but the relay never switches, and how should I configure it?

Use a Btn role for the touch sensor, not `TglChanOnTgl`, and if needed enable the instant touch reaction flag; `TglChanOnTgl` is meant for bistable switches and will toggle on both touch and release [#21570005][#21570110] If the web button changes state but the relay stays silent, verify the relay GPIO with GPIO Doctor and inspect the hardware for bad solder joints or an incorrect relay connection [#21570028] In this case, the real fault turned out to be soldering: pin #15 was not soldered properly, and after resoldering the T34 the relay started working from the touch button [#21570995][#21573749]
Generated by the language model.
ADVERTISEMENT
  • #1 21569766
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    Hello everyone! Had some issues with 1-gang light switch, bought here, (not AD's), which based on T34 chip.

    When I used BK7231 GUI Flash Tool for backup original FW - got an error that flasher cannot get configuration from FW, then i checked lastRawDecryptedStrings.bin via Notepad , got this list

    Spoiler:


    {
    "device_configuration": {
    "rl1_lv": "1",
    "bt1_pin": "23",
    "on_off_cnt": "10",
    "onoff_rst_m": "1",
    "onoff_clear_t": "10",
    "rand_dpid": "42",
    "net_trig": "4",
    "onoff_n": "10",
    "netled1_lv": "0",
    "jv": "110.0.0",
    "onoff_rst_type": "2",
    "ffc_select": "0",
    "total_bt_pin": "10",
    "key_rst_en": "1",
    "nety_led": "0",
    "total_stat": "2",
    "bt1_lv": "0",
    "reset_t": "5",
    "netled1_pin": "8",
    "remote_add_dp": "49",
    "remote_list_dp": "50",
    "net_type": "0",
    "inch_dp": "44",
    "rf_width": "345",
    "module": "T34",
    "ch_cddpid1": "9",
    "remote_io": "6",
    "clean_t": "5",
    "init_conf": "38",
    "zero_select": "0",
    "onoff_type": "2",
    "series_ctrl": "0",
    "bt_self_type": "1",
    "total_bt_lv": "0",
    "cyc_dpid": "43",
    "remote_select": "1",
    "ch_num": "1",
    "rl1_pin": "26",
    "netn_led": "1",
    "ch_dpid1": "1",
    "crc": "100"
    }
    }



    Right after flashing Openbeken i tried to configure switch via template which is posted under spoiler - we have the issue when we touch button - state of it changes successfully, but relay didnt react at all. Maybe i had some errors in configuring of this one? Will be really appreciate if somebody can help me to figure out whats going on there.

    Photos of this board under next spoiler (on photos relay and T34 are desoldered just in case):

    Spoiler:



    Blue PCB with mounted integrated circuits, connectors, and a quartz crystal.
    A blue printed circuit board (PCB) with visible tracks and mounting holes lies on a wooden surface.
    Round printed circuit board with electronic components on a wooden surface.
    Blue PCB with visible traces and solder points, lying on a wooden surface.



    Please LMK if you need additional info (photos/files/etc)

    Thanks and have a great day!
    AI: Could you please share the exact template or configuration settings you used in OpenBeken for this switch? A screenshot or copy-paste of your current setup would be really helpful.
    ClearIO // clear old GPIO/channels
    lfs_format // clear LFS
    StartupCommand "" // clear STARTUP
    stopDriver * // kill drivers
    backlog setPinRole 26 Rel; setPinChannel 26 1
    setPinRole 8 WifiLED
    backlog setPinRole 23 Btn; setPinChannel 23 1
    setPinRole 10 Btn_Tgl_All
  • ADVERTISEMENT
  • #2 21569886
    divadiow
    Level 38  
    Posts: 4835
    Help: 420
    Rate: 851
    what if you change p23 to

    Code: JSON
    Log in, to see the code
  • #3 21569902
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    >>21569886 If we use physical button on switch - it changes status to On for a while, right after - automatically changes to Off by itself. If we're changing state via webapp - it switches and nothing more happened.

    P.S: You need to tap a lot of times in a row, randomly it can be changed to On, but right after it changes itself to Off.

    If we're using P23 as a Button - nothing similar happens, button works perfectly.
  • ADVERTISEMENT
  • Helpful post
    #5 21570005
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14390
    Help: 650
    Rate: 12313
    Can you please post your current device configuration? It's very hard to follow without it. If this is a touch button device, as it looks like, then you should use Btn role. Maybe also set instant touch reaction flag.

    It's hard to understand what's going on now. Which problem do you have:
    - touch button does not work correctly (so relay can be controlled correctly from web panel, especially if you disable button)
    - relay does not work at all (toggling in the web panel does not switch relay)
    Helpful post? Buy me a coffee.
  • #6 21570012
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    >>21570005

    Spoiler:
    {
    "vendor": "Tuya",
    "bDetailed": "0",
    "name": "Full Device Name Here",
    "model": "enter short model name here",
    "chip": "BK7231N",
    "board": "TODO",
    "flags": "1024",
    "keywords": [
    "TODO",
    "TODO",
    "TODO"
    ],
    "pins": {
    "8": "WifiLED;0",
    "10": "Btn_Tgl_All;0",
    "23": "Btn;1",
    "26": "Rel;1"
    },
    "command": "",
    "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
    "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }


    That's current template which is using right now.

    If we trace to a transistor pin and solder a wire there and if we will take it in hand - relay is working with 50Hz freq. But relay didn't switch to On if we're using sensor button.
  • #7 21570019
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14390
    Help: 650
    Rate: 12313
    On OBK main panel, there is a button, right?
    This button:
    Screenshot of a web page showing a large green button labeled “Toggle 0” with “ON” above it, circled in red.
    1. Do you have that Web Page button visible? Yes/No
    2. If you touch and release touch button on switch (physical one), does Web Page button state change (green to red, red to green)? Yes/No
    3. If you click Web Page button, does Relay state change?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #8 21570022
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    >>21570019
    OpenBK7231N device control panel with OFF status and red Toggle 1 button.
    OpenBK7231N web panel with a green Toggle 1 button and ON status displayed.

    1. Yes
    2. State changes thru physical button and via button in web page as well
    3. Relay is completely silent, nothing happened.
  • #9 21570028
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14390
    Help: 650
    Rate: 12313
    There are two options.
    1. Relay pin is incorrect - use GPIO doctor from web app to find which pin toggles relay. Backup your template from web app first!
    2. Did you desolder T34? Maybe there is a cold solder joint for relay and signal does not go out.
    Helpful post? Buy me a coffee.
  • #10 21570032
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    >>21570028

    1. To be honest, I tried to use GPIO Doctor, tried every combination of pin/assignment/channel type, don't even understand, but nothing, maybe there is some mistake from my side.
    2. Yes, cause there is no such other option in my case for flashing of T34 without desoldering :(
  • ADVERTISEMENT
  • Helpful post
    #11 21570043
    divadiow
    Level 38  
    Posts: 4835
    Help: 420
    Rate: 851
    just to add that the Tuya dump the user sent me has the same schema as my T34 here https://www.elektroda.com/rtvforum/topic4036975-60.html#21117908

    It seems to be physically similar with longer PCB

    Code: Text
    Log in, to see the code


    I have dug out that device and this is my working template

    Code: JSON
    Log in, to see the code


    Screenshot of a device configuration interface with pin settings and dropdown menus.





    I've not had it toggle itself off/on yet
  • #12 21570051
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    divadiow wrote:
    "pins": {
    "8": "WifiLED_n;0",
    "10": "Btn;1",
    "23": "TglChanOnTgl;1",
    "26": "Rel;1"
    }

    If we're using this code - when we touch physical button - it changes for a while, right after - changes to Off by itself.

    But relay is still silent anyway.
  • #13 21570110
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14390
    Help: 650
    Rate: 12313
    uid1123444 wrote:
    divadiow wrote:
    "pins": {
        "8": "WifiLED_n;0",
        "10": "Btn;1",
        "23": "TglChanOnTgl;1",
        "26": "Rel;1"
      }

    If we're using this code - when we touch physical button - it changes for a while, right after - changes to Off by itself.

    But relay is still silent anyway.

    TglChanOnTgl will change on each state change, so it won't work good for touch button. It will toggle first when you begin to touch, and then it will toggle when you lift finger. It's 100% normal. Do not use TglChanOnTgl for touch buttons. It's for old-style bistable switches where they have two states.
    Helpful post? Buy me a coffee.
  • #14 21570113
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    >>21570110

    Tomorrow will try to resolder T34. Will keep you updated, guys
  • #15 21570117
    divadiow
    Level 38  
    Posts: 4835
    Help: 420
    Rate: 851
    >>21570110

    oh! so

    Code: Text
    Log in, to see the code


    instead?

    Added after 1 [minutes]:

    which does work for me..
  • #16 21570995
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    Update: looks like was an issue with soldering of T34. Now - when we touch physical button - relay is working, but switch is going to reboot :) Will continue investigation.

    @divadiow @p.kaczmarek2 sorry for taking your time guys, looks like its my fault, but i appreciate your time and help! Thanks a lot!
  • #17 21573749
    uid1123444
    Level 3  
    Posts: 9
    Rate: 2
    Soldering issues, PIN #15 wasn`t soldered as needed.

Topic summary

✨ A 1-gang light switch based on the BK7231 T34 chip was reflashed with OpenBeken firmware but failed to control the relay despite the button state toggling correctly. The original firmware backup process reported errors retrieving configuration. The relay and T34 chip were desoldered for flashing. Attempts to configure the device using various pin assignments and templates, including "TglChanOnTgl" and "Btn" roles, showed that the physical button state changed but the relay did not activate. The relay produced a 50Hz signal when manually triggered via a transistor pin, indicating hardware functionality. Suggestions included verifying relay GPIO pin assignments using the GPIO Doctor tool and ensuring proper soldering of the T34 chip and relay connections. A working template from a similar T34 device used pins 8 (WifiLED_n), 10 (Btn), 23 (TglChanOnTgl), and 26 (Rel). It was noted that "TglChanOnTgl" is unsuitable for touch buttons due to toggling on both press and release events; "Btn_Tgl_All" was recommended instead. The root cause was identified as a soldering fault on pin #15 of the T34 chip, which once corrected, restored relay operation though the device rebooted on button press, requiring further investigation. The issue was resolved by resoldering the T34 chip properly.
Generated by the language model.

FAQ

TL;DR: If your BK7231N T34 1‑gang switch toggles in the UI but not the relay, start with input roles: “It’s 100% normal. Do not use TglChanOnTgl for touch buttons.” Then verify relay mapping and hardware. [Elektroda, p.kaczmarek2, post #21570110]

Why it matters: This FAQ helps OpenBeken users quickly restore reliable relay control on BK7231N T34 touch switches after flashing.

Quick Facts

How do I fix “UI toggles but relay stays off” after OpenBeken flash?

Two common causes: the relay GPIO is wrong, or there’s a cold solder joint after desoldering. Use the GPIO Doctor in the web app to locate the correct relay pin. Back up your template before testing. If the pin is correct but the relay is silent, recheck soldering and continuity from the MCU to the relay driver transistor. [Elektroda, p.kaczmarek2, post #21570028]

Which GPIO controls the relay on this T34 1‑gang board?

The OEM configuration shows rl1_pin set to 26. In OpenBeken, assign GPIO 26 as Rel;1 for channel 1. Verify with GPIO Doctor if your board revision differs. [Elektroda, uid1123444, post #21569766]

Why does my light turn off again right after I tap the touch button?

You likely used TglChanOnTgl on a touch input. That role toggles on press and on release, so you see an immediate undo. Use Btn (with a channel) for capacitive touch pads. “Do not use TglChanOnTgl for touch buttons.” [Elektroda, p.kaczmarek2, post #21570110]

Is there a known working OpenBeken template for this device?

A reported working mapping: 8=WifiLED_n;0, 10=Btn;1, 23=TglChanOnTgl;1, 26=Rel;1. The author noted no self‑toggling on their sample. Hardware can vary, so confirm roles on your unit, and prefer Btn for touch if you see double toggles. [Elektroda, divadiow, post #21570043]

How do I find the correct relay pin with GPIO Doctor?

  1. Back up your template from the OpenBeken web app.
  2. Open GPIO Doctor and assign candidate pins as Rel;1 one at a time.
  3. Toggle the channel in the UI and listen for the relay click; keep the pin that works. [Elektroda, p.kaczmarek2, post #21570028]

The relay chatters around 50 Hz when I touch the transistor lead—what’s happening?

Your finger is coupling noise into a floating or high‑impedance path. That can drive the relay rapidly, appearing as ~50 Hz due to mains hum. Fix by restoring proper solder joints and ensuring the control node is firmly driven from the MCU. Avoid touching signal nodes during tests. [Elektroda, uid1123444, post #21570012]

My switch reboots when the relay clicks—what should I check?

Inspect soldering on the T34/BK7231N module, especially fine‑pitch pins. One user found IC pin 15 wasn’t soldered, causing reboots during relay action. Reflowing that pin restored stability and normal operation. [Elektroda, uid1123444, post #21573749]

How can I verify the touch button is read correctly by OpenBeken?

Open the OBK main panel and watch the channel button. Press the physical touch pad. If the web button changes state, the input path works. If the relay remains silent, focus on relay pin mapping or hardware continuity. [Elektroda, uid1123444, post #21570022]

What role should I put on GPIO 23 for reliable tap‑to‑toggle?

Use Btn with a channel for capacitive touch. If you want direct toggling, Btn_Tgl_All;1 also works for some boards. Avoid TglChanOnTgl on touch pads because it toggles on both edges. [Elektroda, divadiow, post #21570117]

Should I enable the instant touch reaction flag?

Yes, if touch response feels laggy. The project maintainer suggested using the Btn role for touch and enabling instant reaction when needed. It improves perceived responsiveness without altering GPIO mapping. [Elektroda, p.kaczmarek2, post #21570005]

What do the OEM Tuya parameters tell me about this board?

They map hardware: bt1_pin=23 (active‑low), rl1_pin=26, netled1_pin=8. Timing shows reset_t=5 seconds and on_off_cnt=10, implying 10 toggles within a short window will trigger a reset routine. Use these as hints when configuring OpenBeken. [Elektroda, uid1123444, post #21569766]

Could debouncing cause random self‑toggles on touch?

It can. A community member linked a thread and an issue discussing touch debouncing quirks. If you see bounce, try the Btn role, adjust filtering, or update firmware once fixes land. [Elektroda, divadiow, post #21569932]

Should I back up my OpenBeken template before experimenting?

Yes. Always back up in the web app before using GPIO Doctor or changing roles. It lets you roll back quickly if a change disconnects your control path or LED logic. [Elektroda, p.kaczmarek2, post #21570028]

Is this device confirmed to use BK7231N silicon?

Yes. The shared OpenBeken template identifies the chip as BK7231N. Confirm on your device by reading the template or using a chip ID tool during flashing. [Elektroda, uid1123444, post #21570012]
Generated by the language model.
ADVERTISEMENT