logo elektroda
logo elektroda
X
logo elektroda

[BK7231N][CBU] ZMAi-90 Smart Energy Meter Teardown and Flashing

thebeardeddragon 11943 74
Best answers

How can I flash a BK7231N-based ZMAi-90 smart energy meter with OpenBeken and configure its meter/relay connections locally?

First check whether your ZMAi-90 is a TuyaMCU design; if it is, OpenBeken can talk to the MCU and you can identify dpIDs either with TuyaMCUAnalyzer or by using Tuya’s own developer/device logs [#20815719][#20821311] For this BK7231N CBU version, the 2 MB dump must be read from the Wi‑Fi module, not the RN8209C, and the recommended tools are BK7231GUIFlashTool / the newer flasher because bkWriter 1.60 is not reliable on BK7231N [#20821174][#20827069][#20838678] To actually write firmware, the RN8209C must be desoldered because it is wired to the Wi‑Fi UART and blocks programming; a read-only trick with VDD floating can work, but it failed for writing [#20838678][#20838936] After flashing, the discovered GPIOs were P14/P16 for the bridge relay pair, P7 for the pair button, P6 for the WiFi LED, and P26 for the tipped LED [#20838775] The RN8209 energy-meter support was being added in OpenBeken: voltage and power could work after calibration, but current still needed more driver work, and Home Assistant discovery needed the driver started before discovery [#20839061][#20865267]
Generated by the language model.
ADVERTISEMENT
  • #31 20856925
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    Hello,

    I have work with this GPIO, and the relay works ok:

    Code: JSON
    Log in, to see the code


    How did you start that Power monitor from the last post?

    Thanks
  • ADVERTISEMENT
  • #32 20856983
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Hello @lionboy , is your Zmai-90 the same as the one in this topic? Is it using RN8209C? I am asking because there are at least three separate versions of ZMAI-90 around...
    Helpful post? Buy me a coffee.
  • #33 20856991
    thebeardeddragon
    Level 4  
    Posts: 19
    >>20850811


    Very nice!!

    Does this mean the meter is accurate enough without calibration, or will it need some? What are the second pictures you attached? (The ones with a metal pointer)
  • #34 20857010
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    I have autotransformer that can change AC voltage from very low to 250V or so, so I can check measurements.

    Calibration is always required, just like with Tasmota.

    I have a problem with current measurement, something is wrong, I may be missing something.

    Can someone, maybe @thebeardeddragon or @lionboy , help me testing? I would like to know if current measurement problem happens also on your pieces, maybe my one is special or faulty, etc....

    I can tell you how to run current version step by step if you are interested
    Helpful post? Buy me a coffee.
  • #35 20857024
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    p.kaczmarek2 wrote:
    Hello @lionboy, is your Zmai-90 the same as the one in this topic? Is it using RN8209C? I am asking because there are at least three separate versions of ZMAI-90 around...


    Yes, it is the same with a black board and CBU. I started driver bridge and RN, but I don't know the pinout for the power monitor.

    I can help you if needed. I have been waiting with this Zmai for 3 years :D
  • #36 20857064
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    There is no pinout for power monitor. You just do:
    
    startDriver RN8209
    

    preferrably as a startup command, then wait 3 seconds (it's a test version of driver, updates are SLOW, I will improve it later) and use calibration to calibrate with a 60W bulb load connected, just like in Tasmota...

    on my side, once calibrated with 60W bulb, power and voltage measurement works but current is still incorrectly measured so I wonder what am I missing
    Helpful post? Buy me a coffee.
  • #37 20857100
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4
    Hmm at me is not working after i start that driver:

    Screenshot of the ZMAi90-openbeken interface showing driver and MQTT connection information.


    But i saw something when i start driver BL0937 but for this i need pinout

    I attach my dump 2 MB

    And log after i start RN driver:

    Info:MAIN:Started RN8209.
    Info:CMD:[WebApp Cmd 'startDriver RN8209' Result] OK
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 0
    Warn:EnergyMeter:UA 254
    Warn:EnergyMeter:CRC BAD, expected 221, got 254
    Warn:EnergyMeter:V 0, C 0 -369095864, P -369095864 -369095864
    Info:MQTT:Publishing val 1.55 to zmai90/power/get retain=0
    Info:MAIN:Time 635, idle 186626/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 564, socks 2/38
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic zmai90/power/get
    Warn:EnergyMeter:CRC BAD, expected 220, got 35
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 636, idle 170810/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 565, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 217, got 38
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 637, idle 191268/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 566, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 216, got 39
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 638, idle 180570/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 567, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 219, got 36
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 639, idle 190880/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 568, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 221, got 34
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 640, idle 186143/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 569, socks 2/38
    Info:GEN:dhcp=0 ip=192.168.2.41 gate=192.168.2.1 mask=255.255.255.0 mac=38:1f:8d:58:4b:00
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-63,ssid=Smart,bssid=da:21:f9:24:35:46,channel=5,cipher_type:CCMP
    Warn:EnergyMeter:CRC BAD, expected 220, got 35
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MQTT:Publishing val 0.00 to zmai90/power/get retain=0
    Info:MAIN:Time 641, idle 176340/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 570, socks 2/38
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic zmai90/power/get
    Warn:EnergyMeter:CRC BAD, expected 217, got 38
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 642, idle 188037/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 571, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 216, got 39
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 643, idle 193297/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 572, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 219, got 36
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 644, idle 195387/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 573, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 221, got 34
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 645, idle 181876/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 574, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 220, got 35
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 646, idle 187594/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 575, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 217, got 38
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 647, idle 181016/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 576, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 216, got 39
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 648, idle 187657/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 577, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 219, got 36
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 649, idle 188143/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 578, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 221, got 34
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 650, idle 188534/s, free 75248, MQTT 1(1), bWifi 1, secondsWithNoPing 579, socks 3/38
    Info:GEN:dhcp=0 ip=192.168.2.41 gate=192.168.2.1 mask=255.255.255.0 mac=38:1f:8d:58:4b:00
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-62,ssid=Smart,bssid=da:21:f9:24:35:46,channel=5,cipher_type:CCMP
    Warn:EnergyMeter:CRC BAD, expected 220, got 35
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 651, idle 377223/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 580, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 217, got 38
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 652, idle 198635/s, free 75464, MQTT 1(1), bWifi 1, secondsWithNoPing 581, socks 2/38
    Attachments:
    • readResult_BK7231N_QIO_zmai_2023-11-12-19-23-17.bin (2 MB) You must be logged in to download this attachment.
  • #38 20857157
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Your version is from Dec 5, my one is Dec 7, you have old version:
    Screenshot showing a list of project commits on GitHub from December 7, 2023.
    I will get build for you, RBL, wait

    Added after 2 [minutes]:

    try i will remove it later:
    https://github.com/openshwprojects/OpenBK7231T_App/releases/tag/1.17.340
    Helpful post? Buy me a coffee.
  • #39 20857189
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    Now it works but it doesn't show me anything on Watts or Current:

    Log:

    Info:GEN:sta:rssi=-67,ssid=Smart,bssid=da:21:f9:24:35:46,channel=5,cipher_type:CCMP
    Warn:EnergyMeter:CRC BAD, expected 221, got 34
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MQTT:Publishing val 0.0 to zmai90/voltage/get retain=0
    Info:MQTT:Publishing val 0.000 to zmai90/current/get retain=0
    Info:MQTT:Publishing val 0.00 to zmai90/power/get retain=0
    Info:MQTT:Publishing val nan to zmai90/energycounter/get retain=0
    Info:MQTT:Publishing val 0.000 to zmai90/energycounter_last_hour/get retain=0
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic zmai90/voltage/get
    Info:MAIN:Time 61, idle 196329/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic zmai90/current/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic zmai90/power/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic zmai90/energycounter/get
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic zmai90/energycounter_last_hour/get
    Warn:EnergyMeter:CRC BAD, expected 220, got 35
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 62, idle 172792/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 217, got 38
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 63, idle 191217/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 216, got 39
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 64, idle 192175/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 219, got 36
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 65, idle 193406/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 221, got 34
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 66, idle 192958/s, free 75112, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38
    Warn:EnergyMeter:CRC BAD, expected 220, got 35
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 67, idle 189179/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 217, got 38
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 68, idle 191116/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 216, got 39
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 69, idle 191418/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 2/38
    Warn:EnergyMeter:CRC BAD, expected 219, got 36
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 70, idle 186403/s, free 75112, MQTT 1(1), bWifi 1, secondsWithNoPing -1, socks 3/38
    Info:GEN:dhcp=0 ip=192.168.2.41 gate=192.168.2.1 mask=255.255.255.0 mac=38:1f:8d:58:4b:00
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-68,ssid=Smart,bssid=da:21:f9:24:35:46,channel=5,cipher_type:CCMP
    Warn:EnergyMeter:CRC BAD, expected 221, got 34
    Warn:EnergyMeter:V 0, C 0 0, P 0 0
    Info:MAIN:Time 71, idle 179530/s, free 75328, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38

    Zmai90-openbeken interface showing lack of energy measurements.
  • #40 20857206
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    How do you get bad CRC all the time? Are you really sure your Zmai is on the same chip?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #41 20857220
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    p.kaczmarek2 wrote:
    How do you get bad CRC all the time? Are you really sure your Zmai is on the same chip?


    I told you it's CBU with the same black board like yours, but I don't know how I get that CRC BAD.

    I will open it again to check exactly what it is, and I will take some pictures. The only problem was when I desoldered the CBU, I lost a capacitor from the board :D I don't know if that is the problem. I have another one, but that Zmai is now powered on one 3 phase from my house.

    Added after 9 [minutes]:

    Close-up of a black electronic circuit board held in hand with components, including a quartz crystal and pins. Printed circuit board on a desk with a missing capacitor marked with a yellow symbol.

    This is mine, and that mark with yellow I lost when I tried to desolder the CBU.
  • #42 20857663
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    p.kaczmarek2 wrote:
    How do you get bad CRC all the time? Are you really sure your Zmai is on the same chip?


    Do you think that's the problem because I lost that SMD capacitor?
  • #43 20857809
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    I don't know, it depends where that capacitor was connected. Was it just betwen VDD and GND or somewhere else? I have tested my code only on one Zmai so far - on my one - and it worked well for voltage and power. Futhermore, there was no bad CRCs, and in your case, every packet yields bad CRC
    Helpful post? Buy me a coffee.
  • #44 20857830
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    p.kaczmarek2 wrote:
    I don't know, it depends on where that capacitor was connected. Was it just between VDD and GND or somewhere else? I have tested my code only on one Zmai so far - on my own - and it worked well for voltage and power. Furthermore, there were no bad CRCs, and in your case, every packet yields a bad CRC


    I saw that communicate with RX or TX, I don't remember exactly, and this is the reason why I removed it, but I lost it when I tried to solder it back :D

    I will try it on the one from my phase house to see if it works.
  • #45 20857903
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    If the lost capacitor was on RX/TX line then the likelihood of it affecting communication with power metering cicuit has now significantly increased.
    Helpful post? Buy me a coffee.
  • #46 20858110
    thebeardeddragon
    Level 4  
    Posts: 19

    Sorry, I am not able to help yet. I am struggling to unsolder the RN chip with my current equipment. Seeking to get new equipment.
  • ADVERTISEMENT
  • #47 20858152
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    What kind of equipment do you have?
    Helpful post? Buy me a coffee.
  • #48 20858160
    thebeardeddragon
    Level 4  
    Posts: 19

    Soldering tool kit containing a soldering iron, multimeter, desoldering pump, and various accessories.

    Just this. I ordered in Amazon.

    I am a complete noob to anything electronics-related; so I also need to learn how to properly solder such a small chip (you saw my trials on the PCB I sent you).
  • #49 20858201
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    I have this soldering iron, I can indeed see that it may be difficult to remove SOIC8 or SOIC16 with that. It is still possible, and I may show you how, but I am not sure if you can do it well at the first try. Even I did it wrong at first time, I had to try on scrap boards first to learn.
    Maybe you can check out this video:



    Somewhen in this video we desolder a SOIC8 chip
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #50 20858221
    thebeardeddragon
    Level 4  
    Posts: 19
    That's a very cool technique! I had been trying without adding solder, just with the desoldering mesh, and it was impossible.

    I will practice with dead boards first.
  • #51 20864129
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    Another 3 of zmai, can you explain how you successfully flash without desoldering the chip?

    Three ZMAi-90 devices lying on a desk next to a screwdriver and a USB cable.

    Thanks

    Added after 11 [minutes]:

    lionboy wrote:
    Another 3 of zmai, can you explain how you successfully flash without desoldering the chip?

    Three ZMAi-90 devices lying on a desk next to a screwdriver and a USB cable.

    Thanks


    So much easier to flash is to desolder the RN chip from the back and solder it back after flashing. I will try this tonight with all of them and then I can help with calibration to see if it's okay or not at me
  • #52 20864210
    thebeardeddragon
    Level 4  
    Posts: 19

    We need to see inside the device. There are different models using different chips.

    If all those 3 use CBU, then you need to desolder RN chip before flashing.
  • #53 20864300
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    Yes all of them are with cbu, but last time I desolder the cbu chip instead of RN chip
  • #54 20864338
    thebeardeddragon
    Level 4  
    Posts: 19

    I guess that achieves the same result. Which chip would you say is easier to desolder/solder back?
  • #55 20864351
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Screen is very close to the CBU, you must be careful, maybe cover it with kapton tape?
    Helpful post? Buy me a coffee.
  • #56 20864376
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    Easy is to desolder RN then CBU, yeah last time was a problem with screen but if i desolder RN there are not problem

    Added after 1 [minutes]:

    p.kaczmarek2 wrote:
    Screen is very close to the CBU, you must be careful, maybe cover it with kapton tape?


    And for screen i don't know why is there because you see on tuya if not flash don't need screen for him, maybe we will find in beken how to make screen work
  • #57 20864382
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    I would like to support screen in OBK, but the screen controller on my device has no marking. Does your screen control IC has a marking?
    Maybe it's something from TM1650 family?
    Helpful post? Buy me a coffee.
  • #58 20864387
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    p.kaczmarek2 wrote:
    I would like to support screen in OBK, but the screen controller on my device has no marking. Does your screen control IC has a marking?
    Maybe it's something from TM1650 family?


    I am not home right now but in about 1 hour I will be and I will try to find, what are the chip for screen? Can you put an image with him?
  • #59 20864479
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14580
    Help: 654
    Rate: 12604
    Well, there is not much choice, when you look at the boad, there is CBU, there is that RN chip for power metering, and the only other big chip is for screen. It's just it's not marked in my piece, so it's hard for me to tell which chip it is.
    Helpful post? Buy me a coffee.
  • #60 20864564
    lionboy
    Level 10  
    Posts: 69
    Help: 1
    Rate: 4

    p.kaczmarek2 wrote:
    Well, there is not much choice, when you look at the board, there is CBU, there is that RN chip for power metering, and the only other big chip is for the screen. It's just that it's not marked in my piece, so it's hard for me to tell which chip it is.


    Do you remember if it's okay with this pin?

    Electronic module with labeled pins VCC, TX1, RX1, and GND.

    I am a bit lazy to take and measure again :d

    Added after 5 [minutes]:

    And for reset, you said it's GND and VCC, not CEN with GND?

    Added after 25 [minutes]:

    On all 3 zmai, nothing is written on that big chip under the screen, sorry.

    Added after 25 [minutes]:

    For me, without light on and with a bulb of 8 W on.

    OpenBK7231N device user interface showing energy data. Status screen of OpenBK7231N device displaying voltage, current, and power data.

    Added after 13 [minutes]:

    This RN driver doesn't publish to Home Assistant, right?

Topic summary

✨ The discussion revolves around the ZMAi-90 smart energy meter, which utilizes the BK7231N chip and has been modified from earlier versions that used the ESP8266. Users are seeking to flash the device with OpenBeken firmware to eliminate reliance on cloud services. Initial steps involve determining if the device is a TuyaMCU version and identifying the UART connections for flashing. Several users share their experiences with flashing, including challenges with communication and the need to desolder components like the RN8209C chip to facilitate the process. The conversation also touches on the power metering functionality and the integration of the device with Home Assistant, highlighting issues with current measurements and the need for calibration. Users discuss various methods for reading flash memory and the importance of ensuring proper connections to avoid damaging the device.
Generated by the language model.

FAQ

TL;DR: If you own the ZMAi-90 CBU version with BK7231N, back up the 2MB flash first, then remove the RN8209C or it will block UART writes. As one expert put it, “TX1/RX1 is for both flashing and TuyaMCU.” This FAQ is for users who want local OpenBeken control, relay switching, and RN8209 power metering without Tuya cloud. [#20827152]

Why it matters: This thread shows the exact failure points, safe flashing path, GPIO map, and early RN8209 support for the BK7231N-based ZMAi-90.

Method Read backup Write OpenBeken Main limitation
bkWriter 1.60 Unreliable on BK7231N Unreliable Better on BK7231T than BK7231N
BK7231GUIFlashTool / newer flasher Yes Yes Still blocked if RN8209C holds UART
VDD “trick” with RN8209C still present Yes, with hack No Read worked, write current was insufficient
Desolder RN8209C first Yes Yes Requires SMD rework

Key insight: The blocker is not the CBU module itself. The RN8209C shares UART lines with the BK7231N, so reliable flashing required desoldering the RN8209C before writing OpenBeken.

Quick Facts

  • The confirmed backup size for the CBU BK7231N module was 2MB, and the thread explicitly recommends taking that dump before flashing so the Tuya firmware can be restored if needed. [#20821174]
  • Confirmed GPIO map for one black-board ZMAi-90 CBU variant: P6 = WiFi LED, P7 = pair button, P14/P16 = bridge relay pair, P26 = tipped LED. [#20840241]
  • The RN8209 test driver was calibrated with a 60W bulb; voltage and power worked first, while current remained inconsistent on at least one device. [#20857064]
  • Bench tests showed the meter being checked at 220V, 247V, and 194V with an autotransformer, which helped validate voltage tracking after driver work began. [#20850811]
  • Home Assistant discovery later exposed voltage, current, power, and total energy, but one derived counter stayed Unknown for at least one user. [#20867145]

How do I flash a ZMAi-90 smart energy meter with a CBU BK7231N module to OpenBeken step by step?

You flash it by backing up the CBU first, then isolating the BK7231N from the RN8209C, then writing OpenBeken. 1. Connect to the CBU pads for GND, RX, TX, and 3.3V, and make a 2MB backup. 2. Desolder the RN8209C, because it blocks UART flashing on this board. 3. Use the newer BK7231 flasher to write OpenBeken, then restore the RN8209C and apply the GPIO template. That was the first reliable write path confirmed for this CBU black-board version. [#20838678]

Why does the RN8209C chip block flashing on the ZMAi-90, and why do people end up desoldering it first?

The RN8209C blocks flashing because it shares the BK7231N UART lines used for programming. On this board, the RN8209C sits on the same UART path as TX1/RX1, and its RST_N is tied to RX, so holding it in reset also breaks UART access. A read-only hack worked by starving the rest of the board, but writes still failed. That is why desoldering the RN8209C became the practical solution for reliable OpenBeken flashing. [#20838936]

What is TuyaMCU, and how do I tell whether my ZMAi-90 uses TuyaMCU or a custom protocol?

TuyaMCU is one possible control method, not a guarantee on every ZMAi-90. "TuyaMCU" is a serial control protocol that lets a main MCU exchange datapoints with the Wi-Fi module over UART, using structured packets instead of direct GPIO control. To identify it, check whether the CBU TX1/RX1 lines connect to the device MCU and whether packet datapoints can be decoded. The thread also warns that there are at least three separate ZMAI-90 versions, so board inspection matters before assuming TuyaMCU support. [#20856983]

What is a dpID in Tuya devices, and how can I find the datapoints for a ZMAi-90 energy meter?

A dpID is the numeric identifier for each Tuya datapoint. "dpID" is a Tuya datapoint identifier that labels a specific function or measurement, such as relay state, voltage, or energy total, inside UART or cloud-reported packets. The thread gives three ways to find them: capture hex traffic and feed it to TuyaMCUAnalyzer, inspect datapoints in the Tuya developer platform after pairing the device, or infer them from values like 2300 = 230.0 kWh. The safer path recommended there was the Tuya platform route. [#20821311]

Which UART pins on the CBU board are used for flashing and TuyaMCU communication, and what is TX2 used for?

Use TX1 and RX1 for both flashing and TuyaMCU communication. The thread states clearly that TX2 is only for debug log output, not for normal flashing. That distinction matters because several failed attempts happened before the pin roles were clarified. One expert answer in the thread said, “TX2 is only for debug log output. TX1/RX1 is for both flashing and TuyaMCU.” [#20827152]

What's the correct way to make a 2MB flash backup of a BK7231N CBU module before installing OpenBeken?

Start the flash read first, then reset power so the BK7231N can enter the boot path. 1. Connect GND, RX, TX, and 3.3V to the CBU. 2. In the flash tool, click Read before cycling power. 3. Disconnect and reconnect 3.3V, or briefly discharge the module side as described, so it can “get bus” and begin the 2MB read. The thread used this order repeatedly and confirmed that a backup was successfully extracted from the Wi-Fi module, not the RN8209C. [#20827069]

Why doesn’t bkWriter 1.60 work reliably with BK7231N, and how does BK7231GUIFlashTool compare for reading and flashing?

bkWriter 1.60 was reported as unreliable on BK7231N because it worked better on BK7231T. The thread explicitly says bkWriter 1.60 may not work good for N platform, then recommends hid_download_py or BK7231GUIFlashTool instead. In practice, the newer tooling matched the BK7231N better, but it still could not solve hardware UART contention from the RN8209C. So the software choice mattered, yet board-level interference still determined success or failure. [#20827069]

What safety precautions should I follow when probing UART or flashing a mains-powered ZMAi-90 energy meter?

Never connect a USB-UART adapter directly to the device while it is powered from mains. The thread warns that the power supply may not be isolated, so UART probing on a live 230V unit can be dangerous. Use an optoisolator if you must inspect serial traffic on a mains-powered board. A safer alternative is to remove the Wi-Fi board or power only the detached CBU from 3.3V during backup and flashing work. [#20821311]

How can I stop the RN8209C from interfering with UART flashing without damaging the board?

The least ambiguous method is to desolder the RN8209C or cut the UART trace. Reset tricks were discussed, but on this board the RN8209C RST_N shares the RX path, so reset does not cleanly free UART. A temporary read-only hack worked by forcing the Wi-Fi module to power while the MCU side stayed unpowered, but that did not support writing firmware. If you want reliable flashing without repeated failures, remove the RN8209C first and solder it back afterward. [#20838936]

Which GPIO template works for the ZMAi-90 CBU version, including relay, WiFi LED, tipped LED, and pair button pins?

The working template for one confirmed CBU BK7231N black-board version maps P6 = WifiLED_n, P7 = Btn, P14 = BridgeFWD, P16 = BridgeREV, and P26 = LED. Relay control used the P14-P16 bridge pair, not a single GPIO. Another user later simplified the relay mapping to Rel and Rel_n, but the original bridge template was the first published map tied to this teardown. Use that template only after confirming your board matches this variant. [#20840241]

How do I start and calibrate the RN8209 driver in OpenBeken for the ZMAi-90 using a known load like a 60W bulb?

Start the RN8209 driver with a startup command, wait a few seconds, then calibrate against a known load. The exact command given was startDriver RN8209. After starting it, wait about 3 seconds, because early driver updates were slow, then calibrate using a 60W bulb as the reference load, similar to Tasmota practice. The developer reported that voltage and power responded after this process, even before current behavior was fully solved. [#20857064]

Why do I get CRC BAD errors and zero readings from the RN8209 driver after flashing my ZMAi-90?

CRC BAD usually means the RN8209 communication path is wrong or physically disturbed. In the thread, one user saw repeated bad CRC and all-zero voltage, current, and power, then revealed a missing SMD capacitor near the communication path after rework. The reply noted that if that capacitor was on RX/TX, it could directly affect metering communication. Old firmware builds also caused issues, so the user was told to move from a Dec 5 build to a Dec 7 build first. [#20857903]

How do I publish ZMAi-90 RN8209 voltage, current, power, and total energy readings to Home Assistant through MQTT discovery?

Start the RN8209 driver before running Home Assistant discovery. The developer added the missing discovery check, then instructed users to startDriver RN8209 first, run HASS discovery second, and verify the entities afterward. After that fix, users reported voltage, current, power, and later Total Energy appearing through MQTT discovery, although one counter entity still stayed Unknown. If discovery runs before the driver starts, some entities may not appear. [#20865267]

What causes the current measurement on the ZMAi-90 RN8209C to be inaccurate even when voltage and power look correct?

The thread points to an incomplete RN8209 communication or calibration issue, not a finished hardware fault diagnosis. The developer repeatedly said voltage and power looked correct after calibration, while current stayed wrong and “something must be missing” in the implementation. Another tester reported smaller current mismatch: 0.010 A on a clamp meter versus 0.033 A in the web UI when off, but matching 0.051 A when on. That pattern suggests the driver was usable but not fully mature for low-current accuracy. [#20866430]

Which LCD controller chip is used on the ZMAi-90 display board, and how could OpenBeken support that screen?

The LCD controller was not confirmed in the thread. The display IC on the tested board had no visible marking, so the developer could not identify it directly. Another participant suggested it might match an HT1621B-family 48-pin controller, but that remained an informed guess, not a verified finding. OpenBeken support would require first identifying the controller and then writing a custom display driver, just as the RN8209 driver had to be written from scratch. [#20864564]
Generated by the language model.
ADVERTISEMENT