logo elektroda
logo elektroda
X
logo elektroda

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

thebeardeddragon 7200 74
ADVERTISEMENT
  • #31 20856925
    lionboy
    Level 10  

    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
    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  
    >>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)
  • ADVERTISEMENT
  • #34 20857010
    p.kaczmarek2
    Moderator Smart Home
    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  

    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
    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.
  • ADVERTISEMENT
  • #37 20857100
    lionboy
    Level 10  
    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
  • #38 20857157
    p.kaczmarek2
    Moderator Smart Home
    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  

    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
    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.
  • #41 20857220
    lionboy
    Level 10  

    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  

    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?
  • ADVERTISEMENT
  • #43 20857809
    p.kaczmarek2
    Moderator Smart Home
    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  

    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
    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  

    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.
  • #48 20858160
    thebeardeddragon
    Level 4  

    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
    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.
  • #50 20858221
    thebeardeddragon
    Level 4  
    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  

    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  

    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  

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

    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
    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  

    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
    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  

    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
    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  

    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.
Summary generated by the language model.
ADVERTISEMENT