logo elektroda
logo elektroda
X
logo elektroda

How To Flash T34-Based Smart Switch from Aliexpress With Tasmota/Esphome style firmware OBK

Mati Crawn 25302 78
Best answers

How can I access the hidden UART pins and flash this T34/BK7231N AliExpress smart switch with OpenBeken firmware?

You flash it by reaching the BK7231N/T34 UART on pins 25 (RX) and 26 (TX), powering the board from a solid 3.3V source, and then using BK7231Flasher or hid_download_py to write OpenBeken [#21264891][#21327748][#21528802] The easiest access on this board is often pin 25 directly on the chip and TX via the BR4 resistor pad; if your revision hides the pads, very short probes or microsoldering may be required, and one user even had to remove the 10k resistor and capacitor on pin 25 to make it work [#21264891][#21523814] If BK7231Flasher can read but fails while writing, shorten the wires, improve the 3.3V supply, and try a different baud rate; one user fixed the issue by switching tools and flashing successfully with hid_download_py [#21357215][#21528802] After flashing, the working OBK pin map shared for this board was P14 = external S1-S2, P24 = internal button, P15 = relay, and P16 = LED negative [#21195371] If you accidentally erased the bootloader and the device no longer boots, restore the original 2MB dump or use OBK with the overwrite-bootloader option [#21323010][#21323031]
Generated by the language model.
ADVERTISEMENT
  • #1 21062328
    Mati Crawn
    Level 9  
    Posts: 5
    Help: 1
    Rate: 4
    The latest purchase from Aliexpress bring me 2 new type of the Smart Switch.

    Smart Switch with manufacturer's label and connectors.

    and
    Mini Smart Switch label with technical information.

    I've ordered 4 pc, and received in the same box two type :

    DIY Smart Switch box with Amazon Alexa, Google Assistant, and Tmall Genie logos.

    First release have the pushbutton on the back, the second on the front

    Close-up of a circuit board with electronic components in a plastic case.

    booth are equipped with the same base board, consist the power adapter, relay and T34 chip.

    Electronic module smart switch with visible components.

    The first try was with the Tuya Cloudcutter, finally i give up when I've found that the software installed there is as below - 1.3.10, on the other post i found information that this is not flashable by the cloud cutter ...

    Software update screen showing no newer version for the main module and other type.

    So when i opened the boxt i see that T34 is glued to the main board.

    Close-up of a smart switch baseboard with visible electronic components.

    View of the back side of a smart switch baseboard.

    the power taken from UART module i have connected as in the picture:
    GND- Violet
    3V3 - Violet+RED power

    Close-up of an electronic board with a relay and electronic components.

    the tricky part is to get access to the programming pins.

    the reference say:
    Diagram of the T34 circuit with pin and component labels.

    I need access to pins:
    T34 25 (RX) <- UART TX
    and
    T34 26 (TX) <- UART RX


    I've mount board in the bracket and preapre two "Needle arms" made with 1,5mm cooper wire and the sewing needle at the end.

    Close-up of an assembled electronic circuit with a smart relay and wires connected to programming pins.

    the next 30 min it took me to position the needle on the first board in the right way using magnifing glass to get the proper contact and force in the right direction.
    accidently scratching the pins by the sharp end of the needle i took an small piece of the solder between the pins what confused me for an while, so i recommend after placing pins (needles) on - to check with multimeter if they are not shortened just again good magnify glass help.

    Baseboard with connected wires and components.

    After first succesfull flash of the first one, the other 3 units took only 10 min to be also burn with new becken software via "bk7231flasher_1.1.6"


    the pin configuration is as follow:



    Code: JSON
    Log in, to see the code



    The P14 is the external S1-S2 input of the unit,
    while P24 in the internal switch build on the motherboard.
    The P16 LED output is negative type, while P15 relay is positive, but it depends to the needs.

    The rest is fine

    just added startup command "PowerSave 1" to save power ..

    Hope it shorten the way for someone ..
  • ADVERTISEMENT
  • #2 21062879
    divadiow
    Level 38  
    Posts: 5027
    Help: 438
    Rate: 891
    Good work. These T34s sure look fiddly. I wonder if any come with test/programming pads on the PCB, seems odd there aren't some. Not sure I've seen a T34 device yet with any.
  • #3 21121701
    baudneo
    Level 6  
    Posts: 17
    Help: 1
    Rate: 5
    Thank you for your write up! I ordered 3 of the Zigbee version and received these T34 WiFi version (the one with the switch on the back). Going to try your method of the needle pin to flash them.
  • ADVERTISEMENT
  • #4 21121760
    divadiow
    Level 38  
    Posts: 5027
    Help: 438
    Rate: 891
    you know I'd forgotten this method was already posted and that I'd already seen it before I did my T34 with needles. Good luck, it's fiddly but totally doable.

    Please post boot log and factory fw backup (if you want to).

    Added after 16 [minutes]:

    also, the pins for the OPs device are not seen on any other in the device list and it's different being T34 so:

    https://github.com/OpenBekenIOT/webapp/pull/126
  • #5 21195371
    zyklop
    Level 2  
    Posts: 4
    Rate: 1
    Great work!
    I changed the script on PIN 24 to toggle the relay each time to press, no need to hold it down.
    (your script has a " , " too much at the end.)
    I backed up one of them. File is at the end of this post !

    {
    "vendor": "Tuya",
    "bDetailed": "0",
    "name": "Wifi Smart Switch",
    "model": "DIY",
    "chip": "BK7231N",
    "board": "T34",
    "flags": "0",
    "keywords": [
    "TODO",
    "TODO",
    "TODO"
    ],
    "pins": {
    "6": "LED_n;0",
    "14": "TglChanOnTgl;0",
    "15": "Rel;0",
    "24": "Btn_Tgl_All;0"
    },
    "command": "",
    "image": "https://obrazki.elektroda.pl/5168873200_1714224899.png",    
     "wiki": "https://www.elektroda.com/rtvforum/topic4051203.html"
    }


    I had luck to flash easily 6 boards with this "sdcard rescue spider".
    Circuit board with electronic components on a workspace.


    tuya config in source file is from 1D4000   to   1D41C1 and shown as follows:

    {rl1_lv:1,on_off_cnt:10,onoff_rst_m:1,onoff_clear_t:10,rand_dpid:42,net_trig:4,onoff_n:5,netled1_lv:0,jv:110.0.0,onoff_rst_type:2,ffc_select:0,total_bt_pin:24,nety_led:2,total_stat:0,reset_t:5,netled1_pin:6,remote_add_dp:49,remote_list_dp:50,net_type:0,inch_dp:44,module:T34,ch_cddpid1:9,inch_en1:0,onoff1:14,clean_t:5,init_conf:38,zero_select:0,onoff_type:0,series_ctrl:0,total_bt_lv:0,cyc_dpid:43,ch_num:1,rl1_pin:15,netn_led:2,ch_dpid1:1,crc:83,}

    or sorted:

    {rl1_lv:1,
    on_off_cnt:10,
    onoff_rst_m:1,
    onoff_clear_t:10,
    rand_dpid:42,
    net_trig:4,
    onoff_n:5,
    netled1_lv:0,
    jv:110.0.0,
    onoff_rst_type:2,
    ffc_select:0,
    total_bt_pin:24,
    nety_led:2,
    total_stat:0,
    reset_t:5,
    netled1_pin:6,
    remote_add_dp:49,
    remote_list_dp:50,
    net_type:0,
    inch_dp:44,
    module:T34,
    ch_cddpid1:9,
    inch_en1:0,
    onoff1:14,
    clean_t:5,
    init_conf:38,
    zero_select:0,
    onoff_type:0,
    series_ctrl:0,
    total_bt_lv:0,
    cyc_dpid:43,
    ch_num:1,
    rl1_pin:15,
    netn_led:2,
    ch_dpid1:1,
    crc:83,}
    Attachments:
    • readResult_BK7231N_QIO_T34_2024-18-8-14-21-10.bin (2 MB) You must be logged in to download this attachment.
  • #6 21207982
    tmordalski
    Level 5  
    Posts: 5
    Rate: 1
    Computer screen displaying firmware update software. Laptop on desk displaying a circuit board. Dobra robota.
    Wielkie dzięki za ten temat. Jestem po wgrywaniu OB na kilku miniswitchach z Ali (T34)
    i wszystko działa super.
    Jestem zielony w te klocki z JSON, ale myślę, że to mały problem.
    Dla takich początkujących jak ja kilka spostrzeżeń
    1. Podczas wgrywania OB zatrzymywało mi "read" po zbyt szybkim podłączeniu 3.3V w celu resetu. Ale doszedłem do wprawy.
    2. Po zakończeniu flash wyskakiwał problem niezgodności conf obk czy coś takiego, ale po drugim flashu wszystko było ok.
    3. Ustawienia mosquitto pod żadnym pozorem nie należy używać polskich znaków, wtedy integracja z HA banalnie prosta.
    4. OB o wiele szybciej się paruje z wifi w porównaniu z Tasmotą (nie przeszkadza 5 GHz, przy Tasmocie muszę wyłączać radio 5G na routerze, ale to znany problem z
    routerami Asus )
    Bardzo dobra robota panowie.
    Worktable with a digital microscope over open electronics.
  • #7 21223931
    mustafathamer85
    Level 3  
    Posts: 5
    >>21062328 Hi, @Mati Crawn sorry for this trivial question but I really couldn't manage to put the device in the flashing mode,,, is there any trick to do that?
  • #8 21224028
    tmordalski
    Level 5  
    Posts: 5
    Rate: 1
    >>21223931 Nigdy nie wiadomo, jak to działa, ja przerywałem zasilanie na sekundę, czasami na dłużej, musisz obserwować logi i pasek postępu na BK flasher. Gdy nie działa, sprawdź połączenia i czy poprawnie podłączyłeś Rx Tx do programatora.
  • #9 21224052
    baudneo
    Level 6  
    Posts: 17
    Help: 1
    Rate: 5
    >>21223931

    I am also having issues getting it into flash mode. Have a sd spider board, so I'm pretty sure the connection is good. I've tried 2 different mini smart switches and can't get UART on either.

    Might need a microscope to make sure the connections are solid.
  • #11 21224436
    baudneo
    Level 6  
    Posts: 17
    Help: 1
    Rate: 5
    tmordalski wrote:
    >>21224052 Ja używam taniego mikroskopu usb (jak widać na zdjęciach) https://obrazki.elektroda.pl/5425301900_1724921161.jpg
    Pin 25 dotykam przy chipie, ale pin 26 dotykam na BR4. Close-up of a circuit board with microchips and electronic components.


    Thank you for the BR4 pad tip, that should make things easier. I am going to order one of those microscopes off AliExpress today!
  • #12 21224469
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    @tmordalski on com domain, please use English. If you want to write in Polish, use PL domain. Otherwise it confuses our translator.

    If flashing is not working:
    - try to shorten your wires
    - use lower baud rate
    - make sure there is nothing on RX/TX pins, for example, like it happened on your video:
    https://www.youtube.com/watch?v=PKkiqDNFIx8
    - make sure that you have good LDO to power the WiFi module (from 3.3V)

    Recarding scopes, here is my test of a little one:
    https://www.elektroda.pl/rtvforum/topic3745278.html
    And here is my iPhone as zoom test:
    https://www.elektroda.pl/rtvforum/topic3959944.html

    Of course, you may need to use Google Translate to check those out!
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #13 21224821
    mustafathamer85
    Level 3  
    Posts: 5
    Thank you guys for the quick replies ... unfortunately I did manage to do it.... not short cct btw RX/TX everything seems ok but I couldn't get flashing mode ... every time I try to turn off/on the switch to enter the flashing mode, I get an error on the BK7231 Flash Tool (image below)
    I used the BK7231 Flash Tool v 1.1.6 and also v 1.3.3 (both throw same error)

    Screenshot of BK7231 Easy UART Flasher tool with an error. Close-up of a microcontroller on a PCB with connected probe wires.
  • #14 21224826
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    You are doing the turn on/off incorrectly. The UART dongle should not reset when you turn on/off the device. By "turn on/off power" we mean that you should:
    - keep UART dongle in USB all the time
    - but disconnect/reconnect power to the device itself
    Long story short, your approach seems invalid.

    Alternatively, you may be doing a simple GND to VDD short which overloads and turns off your USB port. This is also possible.

    Can you show us your whole circuit (how is everything connected) so we can help you a bit more?
    Helpful post? Buy me a coffee.
  • #15 21224827
    divadiow
    Level 38  
    Posts: 5027
    Help: 438
    Rate: 891
    >>21224821

    got any broader pics of your whole wiring setup showing every length and start/finish of cable ends?

    also, I've had it before that when using external PSU and you turn on the whole PSU to get into flashing mode that the initial surge seems to not put the device into flashing mode. I now keep the PSU on but bring power to the device by inserting dupont into breadboard - so no PSU powering on surge.
  • ADVERTISEMENT
  • #16 21224882
    mustafathamer85
    Level 3  
    Posts: 5
    @p.kaczmarek2 @divadiow thank you guys for the help ... I never pulled out the USB-TTL device ... it's always connected ... I only disconnect the 3V wire and reconnect it to emulate the turnoff/on process ..... but every time I disconnect/reconnect the 3V wire I hear the plug/unplug Ms windows sound .. it could be a driver problem ! anyway here is my connection: sorry @divadiow I couldn't take photo of the whole connections, I will do it when I will be back home Close-up view of connections on an electronic board with wires labeled GND, 3V, TX (TTL RX), and RX (TTL TX).
  • #17 21224931
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    You are using too weak power supply and the inrush current (large amount of current that flows at the startup) caused by capacitors on the board are overloading your USB port. You need to either use a better power supply or to remove the large capacitor that is on the PCB. You can also try powering device from separate power supply so USB port is not overloaded.


    It is also still possible that you have a short and you just short GND to 3.3V, then it would also act the way you describe.
    Helpful post? Buy me a coffee.
  • #18 21225016
    mustafathamer85
    Level 3  
    Posts: 5
    @p.kaczmarek2 thank you .. I will try to use an external power supply
  • #19 21225102
    baudneo
    Level 6  
    Posts: 17
    Help: 1
    Rate: 5
    I also have this issue, but sporadically. I have a 110v AC to 3.3v DC 700mA power supply for the mini switch, ftdi dongle is powered by usb bus, only Rx/tx are connected from ftdi to mini switch chip.

    The error only happens maybe 1/10 times when off/on the mini switch. I power off by removing du pont wire, not by turning PSU off.
  • #20 21225206
    mustafathamer85
    Level 3  
    Posts: 5
    >>21225102 @baudneo well I think I am going to give up, but just for curiosity, why should you remove the dupoint and not power off the PSU, is there a trick point here?
  • #21 21257039
    agetntx74
    Level 1  
    Posts: 1
    Hi there!

    Here's my solution, which might be helpful for someone.
    I used a cheap glue gun from Fixprise to fix a UTP pair. Then I adjusted it to fit on pins 25 and 26 of T34.
    The rest of the process is the same as everyone else's: 3.3V, GND, and CEN.
    It's not difficult, and I hope it helps!

    Close-up of a circuit board with attached multicolored wires and electronic components, secured with glue. Close-up of a circuit board with electronic components and wires. Close-up of a repaired circuit board using glue and wires.
  • #22 21264891
    woessner
    Level 3  
    Posts: 5
    Rate: 1
    Hello everyone,
    please have a close look at your board, You will find a resistor marked BR4, this is a pull down resistor for the TX pin (26)
    Thus you can easily access the TX pin on the side of the "4" of the resistor. The other side is GND.
    This leaves you with having to access pin 25 on the IC which is way easier than 26 because it is the outermost pin on the corner.
    I did not find RX anywhere else on the PCB.
    PS.: Does anyone have an idea why one would add a pull down resistor to TX? But anyhow, it makes life easier for us.
    Close-up of a PCB with visible electronic components, including capacitors and a resistor labeled BR4.
  • #23 21264928
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Is this TX pin on your board used for any other purpose? I don't see any reasons why there would be TX pin connected ONLY to a pull down. Especially that there are internal, configurable pull downs in Beken... maybe it used to be a button pin and it has a pull down that's a left over from previous design? From before migrating to BK?
    Helpful post? Buy me a coffee.
  • #24 21265132
    woessner
    Level 3  
    Posts: 5
    Rate: 1
    I tried to follow the trace but did not find anything thus it does not look as if the TX pin is used for anything else and flashing worked flawlessly as well.
  • #25 21296769
    morgan_flint
    Level 14  
    Posts: 251
    Help: 4
    Rate: 59
    I also managed to flash one of these, thanks to all for the information!

    This was my approach to solder the TX/RX pins:
    Printed circuit board with visible electronic components including an integrated circuit, capacitors, and a screw terminal.

    I took a pair of wire wrapping wires, stripped and tinned a short length, and tied them together with a small thermal shrink tubing. I cut the isolated portion to just one mm and adjusted the distance between them to fit the distance between the IC pins. Then, with the help of a drop of flux, I aligned the points with the pins and touched them briefly with the soldering iron fitted with a smaller tip than usual. 3.3V, and GND wires were soldered to C2 capacitor pins.

    I read a backup with OBK flasher and everything went well, although it didn't recognize the configuration:
    Screenshot of the BK7231 flashing software with messages indicating successful reading. Screenshot of the Tuya Config Quick Viewer program displaying device GPIO configuration.

    Then, after flashing OBK config with the flashing tool, I used the JSON posted at the beginning and everything is going OK.

    Thanks again to everybody!

    EDIT: for flashing a second unit, I used the BR4 approach to connect TX pin, as suggested by @tmordalski and @woessner, thanks for the suggestion!
  • #26 21310912
    max4elektroda
    Level 24  
    Posts: 754
    Help: 48
    Rate: 187
    Thanks for your input, especially for the solder-less solutions.
    Let me provide some pictures of my approach, kind of a "self contained" variant of the idea in the opening post by @Mati Crawn:
    I left most of the isolation on the wires, so I could connect them to the switches connectors (needs some force to fix them so that they don't move during positioning).
    The needles connected to BR4 for TX and pin 25 for RX.
    Took some time to bend and connect the needles, but I succeeded in the end ;-)

    I set speed to lowest (115200) after the first errors in reading (reading didn't finish).

    In the end, it did work when just writing the image, but only after setting the default speed 921600 (with 115200 erasing was successful, but writing failed).
    Might have also been due to the fact that I did everything on an Ubuntu PC...

    Sadly I lost my logs by closing the program to early :-(.

    So, here are some pictures of my approach (not shown: I soldered breadboard wires to the needle arms)

    Close-up of two copper wires with green and yellow insulation, with curved ends. Two wires with needles connected to a green screw terminal block. Close-up of a prototype electronic circuit with wires and pins connected to a PCB.
  • #27 21310967
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    So it makes sense to try faster baud speed if slower one fails.. interesting
    Helpful post? Buy me a coffee.
  • #28 21310995
    max4elektroda
    Level 24  
    Posts: 754
    Help: 48
    Rate: 187
    p.kaczmarek2 wrote:
    So it makes sense to try faster baud speed if slower one fails.. interesting

    That was my thought, too. But I had nothing to lose: The device was already erased, so I also tried the unusual step ;-)
  • #29 21321496
    marekvnl
    Level 9  
    Posts: 3
    Good evening, gentlemen,

    I'm having a little problem with the flash of this device. I managed to plug in its UART and do a full firmware dump, so I seem to have a good connection.

    SetProtectState(True) success!
    Going to read encryption key...
    Encryption key read done!
    Encryption key: 510fb093 a3cbeadc 5993a17e c7adeb03
    Going to start reading at offset 0x00...
    (...)
    Basic read operation finished, but now it's time to verify...
    Starting CRC check for 512 sectors, starting at offset 0x00
    CRC matches 0x10CF5951!
    All read!
    Loaded total 0x200000 bytes 
    Wrote 2097152 to readResult_BK7231N_QIO_2024-26-11-23-49-23.bin
    .

    I have tried dozens of times - different baud rates, different firmware versions and different flasher versions. The error is always the same:

    Preparing to write data file to chip - resetting bus and baud...
    Getting bus... (now, please do reboot by CEN or by power off/on)
    Getting bus success!
    Going to set baud rate setting (115200)!
    Will try to read device flash MID (for unprotect N):
    Flash MID loaded: 15701C
    Will now search for Flash def in our database...
    Flash def found! For: 15701C
    Flash information: mid: 15701C, icName: EN25QH16B, manufacturer: ESMT, szMem: 1000000, szSR: 1, cwUnp: 0, cwEnp: 7, cwMsk: 3C, sb: 2, lb: 4, cwdRd: 05-FF-FF-FF, cwdWr: 01-FF-FF-FF
    Entering SetProtectState(True)...
    sr: 0
    final sr: 0
    msk: 3c
    cw: 0, sb: 2, lb: 4
    bfd: 0
    SetProtectState(True) success!
    Going to do erase, start 69632, sec count 281!
    failed with serial.BytesToRead 1 (expected 16)
    The beginning of buffer in UART contains 00 data.
    Erasing sector 69632... Erasing sector 69632 failed!
    Writing file data to chip failed.
    .

    Is there still a ground pin there to clear it or overwrite the flash? Documentation only talks about Pin18 being pulled up when loading flash from SPI.

    Could someone please suggest what this could be about? Thank you very much in advance.

    Greetings.
  • #30 21321499
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    What kind of connection? Any pictures?

    This problem is quite well known and has already appeared on the forum, the symptoms are quite deceptive, reading works and writing breaks down, but it all usually comes down to improving the power supply, shortening the cables, possibly changing the USB to UART converter, possibly a different baud rate. It's also sometimes worth trying a higher baud as a lower one gives errors (and vice versa).

    Are you running Flasher on Windows?



    And if all else fails.... you can use hid_download_py:
    https://github.com/OpenBekenIOT/hid_download_py


    .
    Helpful post? Buy me a coffee.

Topic summary

✨ The discussion focuses on flashing T34-based smart switches purchased from AliExpress, which use the BK7231N chip, with custom firmware such as OpenBeken (OBK), Tasmota, or ESPHome-style firmware. Two hardware variants were identified: one with the pushbutton on the back and another on the front, both sharing the same baseboard design. Users encountered challenges flashing these devices using the Tuya Cloudcutter due to firmware version 1.3.10 being non-flashable via cloud methods. Successful flashing requires direct UART access, often achieved by soldering or using needle pins on test pads or chip pins 25 (RX) and 26 (TX). A pull-down resistor labeled BR4 on the PCB aids in accessing the TX pin. Power supply stability is critical; USB-TTL adapters often lack sufficient current, so external 3.3V power supplies or powering through the AMS1117-3.3V regulator input are recommended. Short, direct wiring and proper connection of RX/TX lines (crossed correctly) are essential to avoid communication errors. Flashing tools like BK7231Flasher sometimes fail due to power or connection issues; alternatives like hid_download_py have proven more reliable. Some users reported needing to overwrite the bootloader to restore UART functionality. For newer or different board revisions, microsoldering and hardware modifications (removing resistors/capacitors) may be necessary. The community shared various soldering techniques, including solder-less needle pin methods and glue gun fixtures for stable connections. MQTT integration with Home Assistant works well after flashing, though some configuration flags may need adjustment to enable full telemetry. Additionally, a variant with an unmarked RF chip (possibly SYN531R) was discussed, with suggestions to analyze its protocol for remote control support. Overall, the thread provides detailed practical advice on hardware identification, wiring, power considerations, flashing procedures, and firmware configuration for T34/BK7231N smart switches from AliExpress.
Generated by the language model.

FAQ

TL;DR: 4 switches were flashed, and after the first success the next 3 took about 10 minutes; as one expert put it, "it's fiddly but totally doable." This FAQ helps anyone replacing unsupported Tuya 1.3.10 firmware on T34 mini switches with OpenBeken over UART, using needle contacts or the BR4 test-point workaround. [#21062328]

Why it matters: These AliExpress mini switches often ship in mixed hardware revisions, so a repeatable UART method saves hours of failed Cloudcutter attempts.

Method Works on Tuya 1.3.10 in thread Physical difficulty Main risk Best use case
Tuya Cloudcutter No Low Unsupported firmware Quick check before opening
UART with needles Yes High Slipping and shorting pins 25/26 Glued T34 modules
UART via BR4 for TX Yes Medium Still need RX on pin 25 Easier access to pin 26
hid_download_py Yes Medium Extra setup When BK7231Flasher reads but fails to write

Key insight: The hard part is not firmware selection. It is stable electrical access: short wires, solid 3.3 V power, and the right RX/TX contact points decide whether flashing works.

Quick Facts

  • The board mapping reported for the original T34 switch is relay on P15, external S1/S2 on P14, onboard button on P24, and an active-low LED on P6. [#21062328]
  • Multiple users reported that 115200 baud helped unstable reads, but one successful write completed only after switching back to 921600 baud after erase. [#21310912]
  • Power stability matters more than tool version: one failed setup triggered a Windows USB unplug sound every time 3.3 V was reconnected, pointing to inrush or overload. [#21224931]
  • The device backup size shown in the thread is 0x200000 bytes, and a full dump was saved as 2 MB before recovery work. [#21321496]
  • A later hidden-pin board revision may require removing a 10 kΩ pull-up network near pin 25 and microsoldering because pin 26 had no usable pad. [#21523814]

How do I flash a T34-based Tuya mini smart switch from AliExpress with OpenBeken using UART when Tuya Cloudcutter does not support firmware 1.3.10?

Use UART flashing instead of Cloudcutter. 1. Open the case and power the board from 3.3 V and GND. 2. Contact T34 pin 25 with UART TX and pin 26 with UART RX, often using needle probes. 3. Flash OpenBeken with BK7231Flasher; after the first successful unit, three more were flashed in about 10 minutes. The original poster confirmed Tuya firmware 1.3.10 was not supported by Cloudcutter on this switch. [#21062328]

What is the T34 module in these Tuya smart switches, and how does it relate to the BK7231N chip?

T34 is the Tuya Wi-Fi module built around the BK7231N chip. "T34" is a Tuya radio module that provides Wi‑Fi control, and its key characteristic in this thread is a BK7231N-based design hidden or glued onto the switch PCB. Users repeatedly identified these mini switches as T34 boards and selected BK7231N firmware when flashing them. One reply even corrected a failed setup by noting that T34 is BK7231N, not BK7231T. [#21323333]

What is OpenBeken (OBK), and how is it used on T34 smart switches instead of Tasmota or ESPHome-style firmware?

OpenBeken is the replacement firmware used here to run the T34 switch locally after UART flashing. "OpenBeken" is device firmware that replaces Tuya software, exposes a web app and MQTT features, and is used on BK7231N hardware where ESP-style local control is wanted without the original cloud stack. In this thread, users flashed OBK, imported a JSON pin map, paired it with Wi‑Fi, and integrated it with Home Assistant through MQTT. [#21324762]

Which pins on this T34 smart switch board should be mapped for relay, LED, external S1/S2 input, and the onboard button?

Map relay to P15, LED to P6, external S1/S2 input to P14, and the onboard button to P24. The original JSON used LED_n on pin 6, Rel on pin 15, and toggle functions on pins 14 and 24. A later refinement changed P24 from a hold-style toggle to Btn_Tgl_All;0, so each press toggled the relay without needing a long hold. [#21195371]

Where can I access RX and TX on glued-down T34 modules, including the BR4 resistor trick for pin 26?

Access RX directly on T34 pin 25 and access TX either on pin 26 or at resistor BR4. The useful shortcut is that BR4 exposes the TX line on the side marked “4,” while the other side is GND. That leaves only pin 25 to touch on the module itself, which is easier because it sits on the outer corner. Several later users confirmed the BR4 method made contact much easier. [#21264891]

Why does BK7231Flasher read the chip successfully but fail during erase or write on these T34 switches?

It usually fails because the wiring or power is marginal under write load. One user read the full 2 MB dump successfully, including the encryption key, but erase failed at sector 69632 with a serial buffer error. After changing the UART converter, shortening wires, and stabilizing power, the same board erased and wrote normally. Read operations can succeed even when write current spikes expose a weak setup. [#21321513]

What is the best way to power a T34 board during flashing: USB-TTL 3.3V, an external 3.3V supply, or feeding 5V into the AMS1117 input?

Use a solid external 3.3 V supply first; use USB-TTL 3.3 V only as a last resort. Several failures were traced to weak adapter power, while stable external power or a better regulator fixed them. If you avoid a separate LDO, one thread expert suggested feeding 5 V into the board’s AMS1117 input so the onboard regulator still produces 3.3 V, though success depends on the board’s capacitors. [#21357215]

Why does reconnecting the 3.3V wire make Windows play the USB disconnect sound during flashing attempts?

That sound usually means your power setup is overloading the USB port. The thread diagnosis was inrush current from the board’s capacitors or an accidental 3.3 V-to-GND short. In the reported case, reconnecting only the 3.3 V wire still made Windows play the plug/unplug sound, which pointed to a power problem rather than a flasher bug. A stronger supply or separate device power was the recommended fix. [#21224931]

How should I put a BK7231N/T34 device into flashing mode: power cycling VDD, using CEN, or holding the onboard push button?

Power cycling only the device VDD is the most reliable method in this thread. One expert explicitly said he no longer uses CEN because disconnecting and reconnecting VDD works better, while keeping the USB-UART adapter powered the whole time. Another user reported that holding the small onboard push button also made entry easier than cycling power on some units. Use CEN only if VDD cycling is impractical. [#21335520]

When flashing fails on a T34 switch, what troubleshooting steps help most with wire length, baud rate, UART adapters, and contact quality?

Shorter wires, lower initial baud, better probes, and a stronger adapter help most. 1. Keep RX/TX leads under about 10 cm if possible and inspect for bridges under magnification. 2. Try 115200 baud first, then test higher speeds if write fails. 3. Swap the USB-UART converter and verify RX/TX contact with a meter. One expert summarized the process: “it’s fiddly but totally doable.” [#21121760]

How do I restore a T34/BK7231N switch that no longer boots, shows no AP, and appears to have lost its bootloader after flashing?

Restore the original 2 MB dump if you have it, then flash OpenBeken again. If you do not have a dump, flash a full 2 MB BK7231N image with bootloader included. In the thread, a board showed no AP and no useful UART output until the user used the overwrite-bootloader path; after that, TX2 output returned and the device booted normally. Missing TX2 activity was treated as the key sign of a lost bootloader. [#21323031]

What does the 'overwrite bootloader' option do in BK7231Flasher, and when is it appropriate on BK7231N devices?

It rewrites the bootloader area, and you should use it only to recover a board that already lost its bootloader. The maintainer said you should not use overwrite bootloader in normal BK7231N flashing. He recommended it only after symptoms showed the bootloader had already been erased, such as no TX2 startup output and no AP after flashing. In that recovery case, the option brought the device back to life. [#21323046]

BK7231Flasher vs hid_download_py for T34 switches: which tool works better when reading succeeds but writing keeps failing?

hid_download_py is the better fallback when BK7231Flasher can read but repeatedly fails to write. A later user on Ubuntu 24 reported that BK7231Flasher read keys and efuse, then failed on memory operations, while hid_download_py successfully read and wrote the same T34 board. He flashed OpenBK7231N_QIO_1.18.92.bin, the module booted, and Home Assistant integration worked, with the pin configuration loading automatically. [#21528802]

How do I import the JSON device configuration into the OpenBeken web app after flashing a T34 smart switch?

Import the JSON in the OpenBeken web application after the firmware is already running. One user asked exactly how to load the posted T34 JSON, and the response pointed him to the web-app workflow video. He then confirmed the web application was simple and worked well. In practice on this thread, users flashed OBK first, then applied the JSON mapping so relay, LED, and switch pins matched the hardware. [#21324762]

What is the flashing method for the newer T34/BK7231N board revision with hidden pins, altered pull-up components on pin 25, and no obvious TX pad for pin 26?

Use microsoldering, and expect the newer revision to be much harder than the original board. One report said pin 25 was tied through a 10 kΩ pull-up resistor and a capacitor, both had to be removed, and pin 26 had no usable connection at all. The successful method was to remove the chip, create a fake pad, resolder the chip, and only then flash it. This is the edge case where needle probes stop being practical. [#21523814]
Generated by the language model.
ADVERTISEMENT