AC Measure Module Problem
-
I have the AC Measure Module hooked up to an ESP32 board (tried it with external 5V power or 5V from the ESP board no difference) when I turn on the power a red light appears inside the module and it works. However after a short time (15 to 20 seconds) the light goes off and it nolonger works (sensor.getReady() returns 0). I can then still read values from it but the values never change even if I change the voltage.
If I turn off the 5V power to it and turn it back on it will work again for a short time...Question is:
1: Do I have a faulty AC Measure module?
2: Is this a known problem?
3: Does it need a firmware update?
Anyone have any information on how to proceed with this?Thanks.
-
Hi @edpaay,
Perhaps you could widen the description of you setup, I'm sure someone will have some input and be able to help.
AC Measure Module --> Do you mean the AC Measure Unit this or something else (there are other modules related to AC).
ESP32 board, which M5Stack or another manufacturer? Different address to unit (0x42)?
Assuming the AC Measure Unit, connecting over I2C | 3V3 for signal and 5V for power?
For SW environment, Arduino, or something else? -
I tried it with several ESP32 Boards similar results, currently testing with a TTGO T-Display board using Arduino and Board Type ESP32 Dev Module. It uses default 42H address I2C same result if I power the device with external 5V or through the ESP32 Board.
For initial testing I connected it to a 20 volt AC transformer and am using a 1K 1Watt resistor as the load. So I expect it to return 20VAC and about 20 mA current.
I used the demo Arduino code supplied by M5 Stack in the AC Measure library. However, I replaced the display output with Serial.println statements since I do not have the display used in the code. The code outputs reads the values once per second.So this is the output, sensor.getready() is used to signal if there are new values to read. Notice that the voltage and current and power factor are correct; however, the power value is incorrect and shoud be W = I * V therefore 0.02 * 20 = 0.4 A but as you can see it starts at 6.5W and counts down until it gets close to the proper value and then it stops responding (although you can still read from the device but the values will never change and sensor.getready keeps returning 0) If you power cycle the device (not the ESP controller board) it starts the same sequence again. Also notice before the Red LED turns off the power factor which should be 1 for a resistor starts to change as well.
It is as though the microcontroller on the AC Measure device keeps responding but some other IC perhaps used for measurement is bad and fails after a short time, either that or there is a bug in the firmware?
sensor.getready = 1, Red LED is ON.
11:25:01.898 -> Voltage: 20.35V; Current: 0.00A; Power: 6.50W; Power Factor:0.00
11:25:02.887 -> Voltage: 20.35V; Current: 0.02A; Power: 3.61W; Power Factor:1.00
11:25:03.908 -> Voltage: 20.18V; Current: 0.02A; Power: 2.50W; Power Factor:1.00
11:25:04.938 -> Voltage: 20.18V; Current: 0.02A; Power: 1.91W; Power Factor:1.00
11:25:05.984 -> Voltage: 20.18V; Current: 0.02A; Power: 1.54W; Power Factor:1.00
11:25:06.983 -> Voltage: 20.17V; Current: 0.02A; Power: 1.32W; Power Factor:1.00
11:25:08.013 -> Voltage: 20.17V; Current: 0.02A; Power: 1.13W; Power Factor:1.00
11:25:09.033 -> Voltage: 20.20V; Current: 0.02A; Power: 0.99W; Power Factor:1.00
11:25:10.084 -> Voltage: 20.20V; Current: 0.03A; Power: 0.88W; Power Factor:1.00
11:25:11.118 -> Voltage: 20.20V; Current: 0.03A; Power: 0.80W; Power Factor:1.00
11:25:12.108 -> Voltage: 20.21V; Current: 0.03A; Power: 7.34W; Power Factor:1.00
11:25:13.169 -> Voltage: 20.21V; Current: 0.02A; Power: 3.85W; Power Factor:1.00
11:25:14.184 -> Voltage: 20.17V; Current: 0.02A; Power: 2.70W; Power Factor:1.00
11:25:15.195 -> Voltage: 20.17V; Current: 0.02A; Power: 2.02W; Power Factor:1.00
11:25:16.244 -> Voltage: 20.17V; Current: 0.02A; Power: 1.62W; Power Factor:1.00
11:25:17.259 -> Voltage: 20.21V; Current: 0.02A; Power: 1.35W; Power Factor:1.00
11:25:18.270 -> Voltage: 20.21V; Current: 0.02A; Power: 1.15W; Power Factor:1.00
11:25:19.307 -> Voltage: 20.21V; Current: 0.02A; Power: 1.01W; Power Factor:1.00
11:25:20.313 -> Voltage: 20.20V; Current: 0.02A; Power: 0.91W; Power Factor:1.00
11:25:21.334 -> Voltage: 20.20V; Current: 0.02A; Power: 0.81W; Power Factor:1.00
11:25:22.368 -> Voltage: 20.21V; Current: 0.02A; Power: 0.74W; Power Factor:1.00
11:25:23.384 -> Voltage: 20.21V; Current: 0.02A; Power: 0.68W; Power Factor:1.00
11:25:25.438 -> Voltage: 20.18V; Current: 0.02A; Power: 0.58W; Power Factor:0.97
11:25:26.495 -> Voltage: 20.18V; Current: 0.02A; Power: 0.54W; Power Factor:0.90
11:25:27.510 -> Voltage: 20.18V; Current: 0.02A; Power: 0.51W; Power Factor:0.85
11:25:28.727 -> AC Measure Unit Stops responding; sensor.getready = 0, Red LED is off -
Further testing has revealed that the AC Measure unit will shutdown at low current and will return completely inaccurate power values. This could be fixed in the firmware but there is no information on how to access and update the firmware and M5 Stack does not respond with any information to date. The AC Measure unit is useless for my purposes and I will see if I can access the firmware and write my own.
-
@edpaay Did you find a way to use the ac voltage detector? I am having the exact same issue. It powers down when it measures no current even if voltage is present. We intended to use it to detect a stray voltage, but cannot use it if we have to have a load connected...
-
Hello guys
internal firmware can be found here.
In file
code/UnitACMeasure/UnitACMeasure/Core/Src/stm32g0xxx_it.c
in functionMycallback_handler()
there is a check for the first byte received being0x55
which means data is ok. So either the HLW8032 doesn't send0x55
as the first byte after some time anymore or reading the 24 bytes from the HLW8032 somehow gets out of sync. In both cases this would turn off the LED. (Please note: this is just guesswork as I do not have the necessary hardware to test.)As an alternative you could hardware modify the AC Measure Unit to bypass the internal MCU converting UART data into I2C; read the UART signal after the opto coupler and try this library.
Attention: please be careful when modifying the hardware. Only use the signal after the opto coupler.
Thanks
Felix -
hello
I have similar problems with the AC measure unit.
I cannot even make the M5core2 to see it.
Anybody succeeded maybe with a firmware update or any other method?
Thank you -
can you give me some instructions how to apply the firmware update. there are no instructions. Have you try it? Is it working
Thank you -
As others have reported, the m5stack "AC-Measure-Unit" (HLW8032) stops updating after about 18seconds if no current is flowing through it.
Specifically the LED on the unit goes out, and the Voltage and Current registers stop updating (the UNIT_ACMEASURE_GET_READY_REG returns 0=not-ready).
However you can still use functions such as "Serial.printf("getFirmwareVersion()=%u\n",sensor.getFirmwareVersion());"
But when current starts again (even as little as 5mA) the "AC-Measure-Unit's" LED turns on again it starts reporing the voltage and current again. (AC Voltage changes do not cause it to start reporting again.)
There is a "sensor.jumpBootloader()" function, but this seems to lock up the i2c bus, so you can no longer talk to the module.
I am uncertain whether this "stops updating" issue is caused by the m5stack-firmware in the module, or caused by the HLW8032-chip itself stopping updating.
The only way I have found to resolve this is to disconnect the 5V power to the AC Measure Unit, and then reconnect it. The "JFET-reset" circuit I use is shown below.
Note that the AC-Measure-Unit draws about 30mA at all times, irrespective of if it is reporting data or not.
Note also that the AC-Measure-Unit very ocasionally says its working but always returns 0V and 0W. The unit needs resetting to fix this, which can be achieved by completely removing the 5V power (eg. using the below "JFET-reset" circuit).
Finally note that (strangelly) the Voltage measurement reported by the AC-Measure-Unit appears to be more accurate when current is flowing: It appears to overread the voltage by approx 5% when it is first turned-on/rebooted (which you need to do if you want a voltage reading when no current is flowing).