-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Measurement not that precise?! #3
Comments
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): The jumping voltage is also a bit strange. from 234 volts to 226 volts within 5sec, and after additional 10sec again back to 234 volts. My voltmeter measures 233,5volts. So 234 volts is the "correct" value. And I cannot see any jump with my voltmeter... |
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): I added additional logoutput to getCurrent() and getActivePower() if current or power is > 0 (still not connected anything):
Question is: As there is actually some pulse_width: where does this come from? Does the HLW8012 really give some signal which results in triggered interrupt, or does the micros() overflow (have to research this...)? If someone has any hints about this: please share. |
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): Err, does it make sense to register the interrupt on "every change"? Wouldn't it make more sense to trigger on every period, so either RISING or FALLING? I changed it from CHANGE to RISING, and now it seems that the values are "stable". Runs now for a few minutes without one single measurement failure. Before the modification, the failure was reproducible within a few seconds. But now I have to check if power-consumption is still correct measured. |
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): The TASMOTA Firmware (which is very common for Sonoff devices), uses "FALLING": |
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): I tested with an kettle ... modifications:
from HLW8012.cpp and removed from getVoltage(), getCurrent() and getActivePower() the division by 2 ... Result: Measurement is more stable. But I still get seom faulty values when no load is running. argh |
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): I found out, that the wrong numbers occur for about 2sec. This directly correlates to the PULSE_TIMEOUT. If I set this to 4sec, I get for about 4sec a wrong values. |
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): I added debug.output to the CF interrupt handler, as well as to the checkCFSignal() function. I'll try to search for a software-solution... |
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): I managed to visualize the measurement: This shows the CF signal with ~100ms sampling and without any load connected to the device. If one believes the datasheet, the signal should have 50% duty cycle. But the screenshot shows a different behavior. I'm trying to find a solution to check the signal for a more or less correct duty cycle. But this will not be easy. Any help is appreciated. |
Original comment by Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown): I think I found a solution that works for me: I created the following method:
The code is still quick'n'dirty and need some cleanup, but the idea is: To conclude: The measurement has to be "stable" for at least 1sec. Faulty measures will not go through this barrier. I tested this without any load: Works quite well. Maybe one could adapt this to the library as an "alternative way" of getting stabalized values. |
Original comment by ZupoLlask (Bitbucket: ZupoLlask, GitHub: ZupoLlask): Thanks for your feedback. Have you ever got 80V-like readings for voltage, in between valid 230V readings? In this specific situation, it seems that sometimes current signal wrongly feeds getVoltage(), thus generating totally wrong readings. With the fix above, did you kept your other changes, including the removal of division by 2 for getting more stability, and so on? |
Hi I am also having strange readings in voltage. I am using interrupts. My readings fluctuates from 212 to 228 when 218-220V are present. Does change in interrupt from CHANGE to RISING/FALLING solves the problem? |
I am having extreme fluctuations in activePower() sometimes its 10 Watts and sometimes it's 1000Watts while i only have a 200Watt bulb connected. |
i have also similar signals on CF1 pulse. Most signals will fit into the 50% duty ratio but some spurious signals will not. I assume that the spurious signals not meeting the 50% duty ratio check create the wrong measurements mentioned in the opening of the issue. |
I've tried above filrtering solution. it succesfully only considers the pulse width meeting 50% duty ration with 97% exactness. @xoseperez , let me know if I can submit a PR with the above proposal |
Originally reported by: Alexander Christian (Bitbucket: alexander_christian, GitHub: Unknown)
I'm facing some issues with measurement with my Sonoff POW (which uses this HLW8012 chip). Sometimes the measurement is totally wrong and not realistic. So I decided to test with no load to see if there are also strange values visible. And guess what:
Sometimes there is some current, where not current should be (measurement with 5sec interval):
My guess is, this also happen when there is a load connected, but then the failure is even worse.
Measuring is done via interrupts.
Is anyone else facing those issues?
The text was updated successfully, but these errors were encountered: