logo elektroda
logo elektroda
X
logo elektroda

[BK7231N / T34 ] Teardown Tuya Generic Wifi Wall Light Switch 3 Gang

CameronDev  Cool? (+11)
Close-up of a small electronic board with thin wires soldered and labeled TX/RX, Ground, and 3.3V.
Here is how you can flash a T34-based wall switch with OpenBeken. This switch has no programming pads available, so desoldering T34 in QFN case is required.

Purchased from AliExpress: https://www.aliexpress.com/item/1005005732402318.html

Packaging of a touch light switch with an illustration of a finger touching the panel. Close-up of a green product packaging with technical parameters of a wall switch.

Nothing special in the box, comes with a capacitor and some screws, and a wiring diagram.

Back of a WiFi wall switch with labels L3, L2, L1, L, and N. Touch switch with three buttons on a white panel.

Teardown is very straightforward, a flat head screwdriver is all that is required: Just gently lever the front glass off (There is an opening at the bottom for this purpose). Removing the motherboard is as simple as unclipping 4 plastic clips and lifting it up. It is joined to the back via 6 pins.

The image shows a disassembled wall switch with three touch buttons and a circuit board. Two printed circuit boards with electronic components, one placed in a white frame.
Close-up of a printed circuit board with several electronic components. Close-up of a circuit board with three white rectangles on a blue background.

Flashing is a lot less straightforward. This switch came patched for the cloudcutter exploit. (Firmware 1.3.10).
The 4 pads on the board don't appear to be connected to the T34 which is the brains of the operation. The far right pad is 3.3V, the one next to it is GND, unsure of the other two.

All the pins of the T34 are hidden, so flashing is non-trivial. I had to hot air desolder it, solder some jumper wires, and then dump/flash it via bk7231flasher. Miraculously, I managed to resolder it successfully. This is not for the faint of heart.
The dump also failed to extract the tuya config, but I was able to reverse it via inspection.

Close-up of T34 chip with soldered wires.

OpenBeken config is:


{
  "vendor": "Tuya",
  "bDetailed": "0",
  "name": "Tuya Generic Touch Light Switch 3 Gang",
  "model": ???",
  "chip": "BK7231N",
  "board": "",
  "flags": "1024",
  "keywords": [
    "T34",
  ],
  "pins": {
    "8": "WifiLED;55",
    "14": "Rel;1",
    "22": "Btn;3",
    "23": "Btn;2",
    "24": "Btn;1",
    "26": "Rel;2",
    "28": "Rel;3"
  },
  "command": "",
  "image": "https://obrazki.elektroda.pl/2902642800_1708303164.jpg",
  "wiki": "https://www.elektroda.com/rtvforum/viewtopic.php?p=20968165"
}


ESPHome Config:

esphome:
  name: lightswitch-3gang

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "REPLACEME"
    
ota:
  password: "REPLACEME"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true
  reboot_timeout: 0s

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    password: !secret wifi_password
captive_portal:

button:
  - platform: restart
    name: "Restart"

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s

bk72xx:
  board: generic-bk7231n-qfn32-tuya

binary_sensor:
  - platform: gpio
    id: binary_switch_1
    pin:
      number: P22
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_1
  - platform: gpio
    id: binary_switch_2
    pin:
      number: P23
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_2
  - platform: gpio
    id: binary_switch_3
    pin:
      number: P24
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_3

switch:
  - platform: gpio
    id: switch_1
    name: Relay 1
    pin: P28
  - platform: gpio
    id: switch_2
    name: Relay 2
    pin: P26
  - platform: gpio
    id: switch_3
    name: Relay 3
    pin: P14

status_led:
  pin: 
    number: P8
    inverted: true  # Inverting enables the key backlights.


Hope this is helpful to someone, but I would strongly advise not purchasing this one. With the T34 package, and no exposed pads or silk screen, these are non-trivial to flash.

About Author
CameronDev wrote 12 posts with rating 13 , helped 1 times. Been with us since 2024 year.

Comments

p.kaczmarek2 19 Feb 2024 07:53

This is the most pro way of flashing I've ever seen here: https://obrazki.elektroda.pl/5096754300_1708325564_thumb.jpg Just a quick question - was using CEN really necessary? [Read more]

CameronDev 19 Feb 2024 08:56

A pro wouldn't have taken 3 hours to do it :D Don't know, I didn't try without grounding CEN. I just read somewhere that I needed to ground it. Either way, TX/RX are also inaccessible, so it required... [Read more]

ferbulous 19 Feb 2024 09:30

Hi @camerondev How did you apply the solder paste to the back chip? Do you cover the entire back or just meticulously apply to each of the small pads? [Read more]

CameronDev 19 Feb 2024 09:40

I didn't use solder paste. I tried to add solder to the board using the soldering iron, but it mostly went onto the ground and ignored the pins. Those pads are TINY. The wires in that picture are 0.25mm... [Read more]

ferbulous 19 Feb 2024 10:13

I see, so it’s mostly solder reflow and you heat it up with hot air. I tried it once with esp32 ic chip that got displaced when i was desoldering. Didn’t quite work for me though [Read more]

divadiow 19 Feb 2024 10:36

this is impressive. kudos [Read more]

jkwim 24 Feb 2024 07:12

Just curious to know the temperature ranges and the air flow settings use in Hotair guns that you use for these kind of desoldering/soldering. Some recommend preheating the board and then having a quick... [Read more]

p.kaczmarek2 24 Feb 2024 07:56

It varies from station to station, I have a 50$ station that can't desolder a component at 450C and I have a 400$ station that desolders the same component at 350C. [Read more]

CameronDev 29 Feb 2024 02:09

I didn't pre-heat the board, and used one of these: https://www.aliexpress.com/item/1005005855040180.html https://obrazki.elektroda.pl/7633115700_1709188118_thumb.jpg I just set it as hot... [Read more]

p.kaczmarek2 29 Feb 2024 07:29

Which flux did you use (if any)? [Read more]

jkwim 29 Feb 2024 09:21

:-) I have the exact same device. I am a novice when it comes to use of heat gun. So far I have used it once to remove a CB3S module. Some nearby small SMD components flew off the board. That is why... [Read more]

CameronDev 29 Feb 2024 09:41

Flux I used: https://www.ebay.com.au/itm/203741564643 Ill try work out the settings, but i suspect they are on the defaults. The controls for that hot air thing are awful. I am also a novice (as... [Read more]

p.kaczmarek2 29 Feb 2024 09:44

Did you use the Pb solder and flux trick? I've did a small research on that and it turned out that the same temperature setting (like 350C) gives different results on various stations: https://openshwprojects.github.io/hotair/350c.html So,... [Read more]

divadiow 29 Feb 2024 09:50

sorry to chime in on everything it probably seems! I did the pb/flux trick like your video once but it seems if you have a module with 3 sides of soldered pins you can't liquify the pb fast enough between... [Read more]

p.kaczmarek2 29 Feb 2024 10:18

My video used JCD 8908 at 450C I think. Review: https://www.elektroda.pl/rtvforum/topic3970314.html (Use Google Translate) but as I said, 450 on one station is not like 450 on the other: https://openshwprojects.github.io/hotair/350c.html https://openshwprojects.github.io/hotair/450c.html Two... [Read more]

CameronDev 01 Mar 2024 01:02

I used 480c (Whatever that actually ends up being), and the fastest fan speed. Desoldering smaller things is easier, the T34 came off fairly easily. [Read more]

t2004dd 16 Mar 2024 23:35

Hi ! About bridge from PIN 9 - CEN to the GND : do you have it permanently or short up it when flash was started ? and what baud rate did you use ? [Read more]

t2004dd 17 Mar 2024 14:44

I flashed T34 chip successfully. Bridge CEN is not needed. You can start flashing if you just interrupt 3.3V , attached to the PIN8. I flashed it with baud rate 921600. https://obrazki.elektroda.pl/2585614500_1710683016_thumb.jpg... [Read more]

p.kaczmarek2 17 Mar 2024 15:53

Good job! I actually never use CEN for flashing these days, but I haven't really encountered any T34s so far, only BK7231N [Read more]

%}