logo elektroda
logo elektroda
X
logo elektroda

[T34/BL0937] Teardown Generic Wifi Smart Plug with Energy Measurement

Raufaser 33750 143
Best answers

How can I flash a T34/BL0937 smart plug when the UART pads are hard to access?

Use a very fine-wire or needle method instead of trying to solder thick leads directly to the T34. The most practical setup in the thread is to leave the T34 on the PCB, solder 3.3V and GND to the AMS1117 pins, take TX from the exposed pad/resistor point, and touch RX with a sewing needle or thin enameled wire on pin 25; several users also needed an external 3.3V supply and a few power cycles before the flasher connected [#21044837] [#21373301] [#21334978] One reply notes that only one UART line is actually broken out on some boards, so flux and very precise soldering are needed, and if all else fails you can desolder the T34 and flash it off-board, though that is risky [#21005230] If your revision uses a BL0942/BL0492 energy meter instead of BL0937, flashing can be easier by connecting to the meter chip’s UART pins 9/10 plus VCC and GND, without modifying the T34 itself [#21364027] [#21420827]
ADVERTISEMENT
  • #31 21055729
    donotos
    Level 2  

    Only the T34 chip is directly soldered 3.3v on pin 8 and GND on pin 32 for this first attempt.
  • ADVERTISEMENT
  • #32 21231803
    Tilator
    Level 12  
    Any chance to flash with cloudcutter?
  • #34 21231985
    Tilator
    Level 12  
    divadiow wrote:
    do you have a T34 device? what version fw?


    I have T34 device, but haven't yet even plugged it in.

    I suppose FW version can only be found by coupling the device with Tuya system?
  • #35 21231992
    divadiow
    Level 38  
    Tilator wrote:
    I suppose FW version can only be found by coupling the device with Tuya system?


    The only other way I think is by boot log or firmware backup but if you can get those you're already one step away from UART flashing anyway.
  • #36 21238788
    Tilator
    Level 12  
    divadiow wrote:
    The only other way I think is by boot log or firmware backup but if you can get those you're already one step away from UART flashing anyway.


    I UART flashed it because it was the easiest way right now.

    However I took a backup from the original Tuya FW. I try to attach it here in case it's useful for you or anybody.
    Attachments:
    • T34_Tuya_bup_2024-24-9-00-22-37.bin (2 MB) You must be logged in to download this attachment.
  • #37 21238817
    divadiow
    Level 38  
    interesting. fw version 1.3.16 - which is not in the known patched list https://github.com/tuya-cloudcutter/tuya-cloudcutter/wiki/Known-Patched-Firmware nor mentioned in any profiles already existing https://github.com/tuya-cloudcutter/tuya-cloudcutter.github.io/tree/master/devices

    Here is the boot log for that fw.

    Code: Text
    Log in, to see the code


    looking at the date of the build though I think it'll be patched. log lists all the pin assignments

    Code: Text
    Log in, to see the code


    submitting to CC team to look into

    Added after 11 [minutes]:

    The image shows an icon of a T34 Smart Plug with the label OFF.
  • ADVERTISEMENT
  • #38 21238842
    Tilator
    Level 12  
    >>21238817

    Excellent.

    Is there some kind of simulator to boot it?
  • #39 21238851
    divadiow
    Level 38  
    >>21238842 alas, no. there is no emulator to run Beken binaries
    I just flash to my little dev board and grab/pair with that
    Developer board with an inserted module and a connected USB cable.

    Added after 10 [hours] 11 [minutes]:

    1.3.16 has been added to the known-patched list
  • #40 21293454
    silver_mc
    Level 13  
    Hello!
    I own a few sockets from openbeken but only the first one from T34. I found an interesting bug. It doesn't matter if I set start value 1 or -1 for channel 0 or in autoexec I add setChannel 0 1 always the socket starts with relay state 1 then immediately changes state to 0. I have the flags set at the factory, only 10 is checked. I'm weak with logs but noticed this one on reboot: Info:GEN:CHANNEL_Set channel 0 has changed to 0 (flags 0). I think this may be affecting this behaviour but please correct me. on other bl602 or ln882 chips this problem does not occur. anyone have any ideas?
  • #41 21293465
    silver_mc
    Level 13  
    Hello!
    I have several sockets with openbeken but only one with T34. I found an interesting bug. It does not matter whether I set the start value 1 or -1 for channel 0 or add setChannel 0 1 in autoexec, the socket will always start with relay state 1 and then immediately change state to 0. I have the oem flags set, only 10 is selected. I am not good with logs but I noticed this during restart: Info:GEN:CHANNEL_Set channel 0 has changed to 0 (flags 0). I think that this may have an impact on this behavior but please correct me. On other chips bl602 or ln882 there is no problem. Does anyone have an idea?

    Quote:
    Info:MAIN:Time 165, idle 186974/s, free 46976, MQTT 1(1), bWifi 1, secondsWithNoPing 95, socks 2/38
    Info:MAIN:Module reboot in 1...
    Info:MAIN:Main_Init_Before_Delay
    Info:CFG:####### Boot Count 258 #######
    Warn:CFG:CFG_InitAndLoad: Correct config has been loaded with 10 changes count.
    Error:CMD:no file early.bat err -2
    Info:EnergyMeter:Read ENERGYMETER status values. sizeof(ENERGY_METERING_DATA)=32
    Info:MAIN:Started BL0937.
    Info:GEN:PIN_SetupPins pins have been set up.
    Info:MAIN:Main_Init_Before_Delay done
    Info:MAIN:Main_Init_Delay
    Info:MAIN:Main_Init_Delay done
    Info:MAIN:Main_Init_After_Delay
    Info:MAIN:Using SSID [xxxxxxxxxxxxxx]
    Info:MAIN:Using Pass [xxxxxxxxxxxxxxxx]
    Info:MQTT:MQTT_RegisterCallback called for bT OpenBK_T34_gniazdko3/ subT OpenBK_T34_gniazdko3/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT T34_gniazdko3/ subT T34_gniazdko3/+/set
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/OpenBK_T34_gniazdko3/ subT cmnd/OpenBK_T34_gniazdko3/+
    Info:MQTT:MQTT_RegisterCallback called for bT cmnd/T34_gniazdko3/ subT cmnd/T34_gniazdko3/+
    Info:MQTT:MQTT_RegisterCallback called for bT OpenBK_T34_gniazdko3/ subT OpenBK_T34_gniazdko3/+/get
    Info:CMD:CMD_StartScript: started autoexec.bat at the beginning
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)

    Info:MQTT:Channel has changed! Publishing 1 to channel 0
    Info:CFG:####### Flash Save Channel 0 as 1 #######
    Info:NTP:NTP driver initialized with server=194.146.251.100, offset=0
    Info:MAIN:Started NTP.
    Info:NTP:NTP server set to 194.146.251.100
    Info:NTP:NTP offset set
    Info:MAIN:Main_Init_After_Delay done
    Info:MAIN:Time 1, idle 255802/s, free 79856, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 2, idle 191915/s, free 79856, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 3, idle 185325/s, free 79856, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 4, idle 193511/s, free 79856, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 5, idle 185316/s, free 79856, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Registered for wifi changes
    Info:MAIN:Connecting to SSID [xxxxxx]
    Info:MAIN:ssid:silverro key:xxxxxxxxxxxxxxxxxxxxxx
    Info:MAIN:Time 6, idle 182662/s, free 75120, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Boot complete time reached (5 seconds)
    Info:CFG:####### Set Boot Complete #######
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 7, idle 185834/s, free 74272, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 8, idle 84885/s, free 74248, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 9, idle 0/s, free 74248, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Time 10, idle 0/s, free 74248, MQTT 0(0), bWifi 0, secondsWithNoPing -1, socks 2/38
    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=b8:06:0d:28:61:99
    Info:GEN:sta: 0, softap: 0, b/g/n
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING - 1
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MAIN:Time 11, idle 74910/s, free 74512, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 3/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:NTP:Seconds since Jan 1 1900 = 3939990605
    Info:NTP:Unix time : 1731005405
    Info:NTP:Local Time : 2024-11-07 18:50:05
    Info:MAIN:Time 12, idle 187926/s, free 74760, MQTT 0(0), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MQTT:mqtt_userName xxxxxxxxxxxxxxxxxxxxxx
    mqtt_pass xxxxxxxxxxxxxxxxxxxxxxxx
    mqtt_clientID OpenBK_T34_gniazdko3
    mqtt_host xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Info:MAIN:Time 13, idle 196328/s, free 74672, MQTT 0(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:HA discovery is scheduled, but MQTT connection is not present yet
    Info:MQTT:mqtt_connection_cb: Successfully connected
    Info:MQTT:mqtt_subscribed to OpenBK_T34_gniazdko3/+/set
    Info:MQTT:mqtt_subscribed to T34_gniazdko3/+/set
    Info:MQTT:mqtt_subscribed to cmnd/OpenBK_T34_gniazdko3/+
    Info:MQTT:mqtt_subscribed to cmnd/T34_gniazdko3/+
    Info:MQTT:mqtt_subscribed to OpenBK_T34_gniazdko3/+/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OpenBK_T34_gniazdko3/0/set
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 0 for ch 0
    Info:GEN:CHANNEL_Set channel 0 has changed to 0 (flags 0)

    Info:MQTT:Channel has changed! Publishing 0 to channel 0
    Info:MQTT:Publishing val 0 to OpenBK_T34_gniazdko3/0/get retain=0
    Info:CFG:####### Flash Save Channel 0 as 0 #######
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OpenBK_T34_gniazdko3/0/get
    Info:MQTT:Publishing val OpenBK_T34_gniazdko3 to OpenBK_T34_gniazdko3/host retain=0
    Info:MAIN:Time 14, idle 170270/s, free 74672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Will scheduled HA discovery in 9 seconds
    Info:MQTT:Publishing val OpenBK7231N 1.17.766 Nov 6 2024 13:53:29 to OpenBK_T34_gniazdko3/build retain=0
    Info:MAIN:Time 15, idle 183098/s, free 74672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Will scheduled HA discovery in 8 seconds
    Info:MQTT:Publishing val b8:06:0d:28:61:99 to OpenBK_T34_gniazdko3/mac retain=0
    Info:MAIN:Time 16, idle 190375/s, free 71880, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Will scheduled HA discovery in 7 seconds
    Info:MQTT:Publishing val 60.05 to OpenBK_T34_gniazdko3/temp retain=0
    Info:MAIN:Time 17, idle 205965/s, free 74672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Will scheduled HA discovery in 6 seconds
    Info:MQTT:Publishing val silverro to OpenBK_T34_gniazdko3/ssid retain=0
    Info:MQTT:Publishing val 228.1 to OpenBK_T34_gniazdko3/voltage/get retain=0
    Info:MQTT:Publishing val 1.00 to OpenBK_T34_gniazdko3/power_factor/get retain=0
    Info:MQTT:Publishing val 0.153 to OpenBK_T34_gniazdko3/energycounter_yesterday/get retain=0
    Info:MQTT:Publishing val 3096.700 to OpenBK_T34_gniazdko3/energycounter_3_days_ago/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OpenBK_T34_gniazdko3/voltage/get
    Info:MAIN:Time 18, idle 187248/s, free 74296, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Will scheduled HA discovery in 5 seconds
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OpenBK_T34_gniazdko3/power_factor/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OpenBK_T34_gniazdko3/energycounter_yesterday/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OpenBK_T34_gniazdko3/energycounter_3_days_ago/get
    Info:MQTT:Publishing val 1731005411 to OpenBK_T34_gniazdko3/datetime retain=0
    Info:MAIN:Time 19, idle 171636/s, free 74672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Will scheduled HA discovery in 4 seconds
    Info:MQTT:Publishing val 2 to OpenBK_T34_gniazdko3/sockets retain=0
    Info:MAIN:Time 20, idle 191345/s, free 74672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:GEN:dhcp=0 ip=192.168.10.131 gate=192.168.10.1 mask=255.255.255.0 mac=b8:06:0d:28:61:99
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-70,ssid=silverro,bssid=a8:6e:84:83:59:0f,channel=9,cipher_type:CCMP
    Info:MAIN:Will scheduled HA discovery in 3 seconds
    Info:MQTT:Publishing val -69 to OpenBK_T34_gniazdko3/rssi retain=0
    Info:MAIN:Time 21, idle 191876/s, free 74672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Will scheduled HA discovery in 2 seconds
    Info:MQTT:Publishing val 21 to OpenBK_T34_gniazdko3/uptime retain=0
    Info:MAIN:Time 22, idle 195141/s, free 62976, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38
    Info:MAIN:Will scheduled HA discovery in 1 seconds
    Info:MQTT:Publishing val 74672 to OpenBK_T34_gniazdko3/freeheap retain=0
    Info:MAIN:Time 23, idle 192100/s, free 74672, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MAIN:Will do request HA discovery now.
    Info:HTTP:HASS counts: 1 rels, 0 pwms, 0 inps, 0 excluded
  • #42 21293488
    max4elektroda
    Level 24  
    silver_mc wrote:
    Info:CMD:CMD_StartScript: started autoexec.bat at the beginning
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)

    Info:MQTT:Channel has changed! Publishing 1 to channel 0
    Info:CFG:####### Flash Save Channel 0 as 1 #######


    What's the content of your autoexec.bat?

    Added after 6 [minutes]:

    silver_mc wrote:
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic OpenBK_T34_gniazdko3/0/set
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 0 for ch 0
    Info:GEN:CHANNEL_Set channel 0 has changed to 0 (flags 0)

    Info:MQTT:Channel has changed! Publishing 0 to channel 0
    Info:MQTT:Publishing val 0 to OpenBK_T34_gniazdko3/0/get retain=0
    Info:CFG:####### Flash Save Channel 0 as 0 #######


    Is the channel set via mqtt?
  • #43 21293505
    silver_mc
    Level 13  
    >>21293488

    setChannel 0 1 <= this command is only for test
    startDriver NTP
    ntp_setServer 194.146.251.100
    ntp_timeZoneOfs 1
    scheduleHADiscovery 10


    Quote:

    Is the channel set via mqtt?


    I hope not, but I could be wrong. do you think the command comes from HA?
  • #44 21293917
    max4elektroda
    Level 24  
    Autoexec looks ok for me.

    I only saw the log showing a mqtt set followed by a "CHANNEL_Set", so it's a question to someone with more HA/MQTT knowledge.

    But you could also try to disable MQTT for a test to see if the behavior changes...
  • #45 21293951
    silver_mc
    Level 13  
    >>21293917

    You right. After disconnect MQTT and reboot socket relay state is 1. Now I need to find out what happened with MQTT. Thanks for the right lead.
  • ADVERTISEMENT
  • #46 21294022
    Tilator
    Level 12  
    What happens if you use some other channel?
  • #48 21294093
    p.kaczmarek2
    Moderator Smart Home
    Maybe try enabling two "retain" flags from here:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/flags.md
    and then repeat Home Assistant Discovery.
    Helpful post? Buy me a coffee.
  • #49 21294145
    silver_mc
    Level 13  
    Problem solved.

    What I did. First I disconnected MQTT. Then I deleted the device in HA. Then I changed the name of the client topic and group topic, reconnected MQTT and repeated the discovery.

    Everything works as expected.
  • ADVERTISEMENT
  • #50 21299716
    Tilator
    Level 12  
    rufus4 wrote:
    That is truth. Leaving the device overnight without active GUI, power dropped much more.
    Finally I added a DHT22 and do start to really love it, even with the T34.


    What GPIO did you use to add the sensor?
  • #51 21300166
    hojnikb
    Level 11  
    aliexpress wrote:

    I just wanted to mention that I also received this very same T34 type Smart Plug.
    My strategy to get the device flashed:
    - keep the T34 on the PCB
    - use enameled copper wire to attach on the device side ("Kupferlackdraht" in German), I had one with 0.25 mm diameter. The advantage is that this wire is very thin and can fit better to pins of ICs. It also is light and quite flexible - when you move it, it does not provide high forces to the IC pins, so less chance of breaking them off, or stripping off the copper layer of the PCB. Disadvantage: To get the insulation layer off to be able to apply solder is sometimes a bit of a challenge. Then I used ordinary cables to extend these thin wires to attach to PSU and to Serial converter.
    - For P25, I soldered directly to IC pin.
    - For P26, I used the connection at the resistor
    - 3.3V and GND I attached directly to Pins 1 and 2 of AMS1117

    For flashing, I had to power cycle for like 5 times or so until the serial connection was established.
    The dump of original firmware did not contain Tuya keys, according to flasher tool. The socket was Tuya activated before.


    I have the same device, but I'm struggling to get a connecting. I also soldered a thin wire to the pad and empty pin on the motherboard. But no luck.

    Btw, what baudrate is needed for openbeken flash with this particular device?
  • #52 21300624
    Tilator
    Level 12  
    >>21300166

    I flashed the same device some weeks ago and I had also some trouble.

    If I remember it right, a CH340 based TTL adapter did not work. I had to use an old PL2303 based Nokia serial adapter. I think the Nokia adapter might be 5V version. Maybe normal 3,3V voltage is not enough while the chip stand on the board.

    An other device was problematic before and I managed to flash it using Cubietruck.
  • #53 21300713
    hojnikb
    Level 11  
    >>21300624

    I was able to successfully flash it via PL2303 also. But it required me to use an external 3.3V power supply and a quick power off/power on cycle to get it to flash.

    Quite annoying device to bring openbeken to, but it works.
  • #54 21322974
    fatalbullethit
    Level 3  
    I was able to flash the T34 as described, however, I'm wondering whether the power metering capabilities can be used at all - any ideas?
  • #55 21323033
    p.kaczmarek2
    Moderator Smart Home
    Do Tuya Config extraction, set BL0937 pins and it will work well.


    Helpful post? Buy me a coffee.
  • #56 21324532
    rmoriz
    Level 2  
    Greetings,

    I just received two Smart Plugs within the same packaging as OP, however the board looks different and the T34 seems to be smaller, around 6x6mm, see photos.

    Thanks
    Roland

    Close-up image of a circuit board with visible electronic components, including integrated circuits and capacitors. Close-up of a circuit board with an integrated circuit labeled T34. Close-up of a circuit board with electronic components, including a T34 chip. Close-up of a circuit board with a T34 2422GWMCP X31CPC microchip. White Smart Plug with a power button on the front.

    Printed circuit board with electronic components, including capacitors and connectors.
  • #57 21324546
    p.kaczmarek2
    Moderator Smart Home
    Another LSPA9 with T34.... well, it seems they are really using it more often now. I still remember ESP8266 LSPA9 times:
    https://www.youtube.com/watch?v=bnr3DADYcgU
    Then I saw WB2S LSPA9 (not documented by myself).
    and later I of course played with CB2S LSPA9 as well:
    https://www.elektroda.com/rtvforum/topic3887748.html
    And now they are T34-based, hm...

    Anyway, did you attempt to flash it already?
    Helpful post? Buy me a coffee.
  • #58 21324552
    rmoriz
    Level 2  
    >>21324546
    My eyes and my hands are too bad to solder anything on that 0,2mm that is left. This looks like a hot air job which is currently not feasible for me. (hot air station is in storage, no space left)
  • #59 21324829
    Tilator
    Level 12  
    rmoriz wrote:
    >>21324546
    My eyes and my hands are too bad to solder anything on that 0,2mm that is left. This looks like a hot air job which is currently not feasible for me. (hot air station is in storage, no space left)


    I had the same trouble twice before even though they were not exactly same devices.

    I used a normal sewing needle. Connected it to the TTL adapter wire. It just should be sharp enough to hold still on the leg of the chip.

    I only needed one needle because it was possible to solder a wire to the other serial line.

    Once I got it flashed and up, I updated FW using normal WebUI. Just in case not all flashing was well enoug made by the "needle trick".
  • #60 21325178
    rmoriz
    Level 2  
    >>21324829
    thanks for the tip!

    I'm still a bit confused they made it so hard. I can't imagine they flash before assembly. Almost everyone else has pinpoints to flash afterward (using "pogo pins" or other removable solution)

Topic summary

✨ The discussion centers on the teardown, flashing, and firmware modification of generic WiFi smart plugs featuring the T34 chip with integrated energy measurement capabilities, primarily using the BL0937 or BL0942 power metering ICs. Users report challenges soldering to the T34 chip due to fragile pads and limited access to UART pins, with some resorting to desoldering the chip or using fine wires and needles to establish serial connections. Flashing is typically done via UART with external 3.3V power supplies to ensure stable operation, as USB-TTL adapters alone often lack sufficient current. The T34 chip is identified as BK7231N-based, treated either as a chip or board module in firmware configurations. Firmware flashing is performed using OpenBeken and BK7231Flasher tools, with users sharing pin mappings and configuration templates for BL0937 and BL0942 drivers. PowerSave mode behavior is discussed, with reports of inconsistent functionality in newer firmware versions. MQTT integration issues affecting relay startup states are resolved by resetting MQTT configurations and rediscovering devices in Home Assistant. The community shares detailed hardware photos, pinouts, and flashing procedures, emphasizing the need for precise soldering, proper power supply, and correct firmware settings to enable WiFi connectivity and power metering features. Variants of the smart plug with different power metering chips and PCB layouts are noted, with some devices requiring specific handling of UART lines routed through the BL0942 chip. Overall, the thread provides comprehensive technical guidance for hardware hacking, firmware flashing, and configuration of T34-based smart plugs with energy measurement.

FAQ

TL;DR: 4-6 mA idle draw after PowerSave 1 [Elektroda, rufus4, post #21033260]; “use an external 3 V3 supply and flash succeeds first time” [Elektroda, kubanekjiri, post #21334922] Generic LSPA9 smart plugs with T34/BK7231N + BL0937 or BL0942 can be OTA-ready once correct pins are set.

Why it matters: Knowing the right pins, power and firmware avoids ripped pads, CRC errors and dead modules.

Quick Facts

• MCU: Tuya T34 (BK7231N), 32-bit 120 MHz Wi-Fi SoC [Elektroda, p.kaczmarek2, post #21052473] • Power‐meter IC options: BL0937 (8-pin) or BL0942 (10-pin UART) [Elektroda, kubanekjiri, post #21334834] • Tested idle current: 4-6 mA; relay-on 9-13 mA with PowerSave 1 [Elektroda, rufus4, post #21033260] • Typical internal temp: 55-60 °C at 230 V, no heatsink [Elektroda, rufus4, post #21366840] • Recommended flash baud-rate: 921 600 bps, external 3.3 V ≥ 300 mA [Elektroda, kubanekjiri, post #21334922]

2. How do I tell whether I have BL0937 or BL0942 inside?

Open the plug and count the legs on the metering chip near the shunt: 8 legs → BL0937; 10 legs → BL0942. The marking ‘0937’ or ‘0942’ is usually printed on top [Elektroda, p.kaczmarek2, post #21422095]

3. What GPIO template should I load for the BL0937 version?

Use the QNCX template: P6 BL0937CF, P7 BL0937CF1, P8 BL0937SEL, P24 Relay, P26 Button, P28 WifiLED. Importing this JSON and rebooting starts the BL0937 driver automatically [Elektroda, Raufaser, post #21052214]

4. What pins work for the BL0942 board?

Set P14 Rel;1, P24 WifiLED;0, P26 Btn;1 and add “startDriver BL0942” to autoexec.bat. BL0942 UART uses internal mapping, no extra pins required [Elektroda, kubanekjiri, post #21334834]

5. Can I flash without desoldering the T34 module?

Yes. Solder 3.3 V, GND and TX to the AMS1117 tab or vias, then touch a needle to the tiny RX pad 25 during flashing, or use BL0942 pin 9/10 on UART boards. Success rate rises to 96 % with external 3.3 V [Elektroda, vitya123, post #21373301]

6. I keep getting “Getting bus failed” in the flasher—why?

The USB-TTL cannot source enough current. Add an external 3.3 V ≥ 300 mA or power the AC input with 12-15 V DC. Users cleared the error after doing so and cycling power 2-5 times [Elektroda, Yetanfou, post #21334978]

8. What if the push-button stops working after flashing?

Wrong flags or pin number disable it. Clear flags 41 (child-lock) and ensure P26 (or P16 on early boards) is set to Btn;1. Re-importing the correct template fixed non-responsive buttons for several users [Elektroda, EchoSin, post #21440258]

10. Can I schedule on/off times without Wi-Fi?

Yes. Use the internal schedule command: schedule add 0 22:00 0; schedule add 0 06:00 1. Rules are stored in flash and run even offline [OpenBeken docs].

11. Is OTA flashing to ESPHome possible later?

OpenBeken exposes an /otaupload endpoint; upload a BK7231N-compatible ESPHome .rbl. Ensure size < 2 MB and keep the RF partition intact—or Wi-Fi calibration (MAC ≠ 00:00:00) may be lost [Elektroda, p.kaczmarek2, post #21040180]

12. What accuracy can I expect from the energy meter?

After single-point calibration at 230 V/60 W, users reported < 2 % deviation against a calibrated multimeter [Elektroda, kubanekjiri, post #21334834] Multi-point calibration further improves accuracy to ±1 %. "Meter quality is limited mostly by the 1 mΩ shunt," notes p.kaczmarek2 [Elektroda, 21039197]

13. My chip reads 60 °C—safe?

Internal sensor shows junction temperature, typically 55-65 °C at room ambient. No failures have been reported at these readings [Elektroda, rufus4, post #21366840] If it exceeds 85 °C, check for blocked ventilation or wrong PowerSave settings.

14. What’s a common failure while flashing?

Lifting pad 25 (RX) on the QFN. A user lost UART after the pad tore off during cable movement [Elektroda, Raufaser, post #21005344] Minimise strain or use pogo pins to avoid this edge case.

15. Three-step How-To: fastest no-solder flash

  1. Clip 3.3 V, GND, TX to AMS1117 tab, shunt copper and BL0942 pin 10. 2. Hold a needle on BL0942 pin 9 (RX) and power-cycle. 3. Flash OpenBK with 921 600 bps and reboot. Tested in < 5 minutes [Elektroda, Yetanfou, post #21334444]
ADVERTISEMENT