Open faezehFrj opened 3 years ago
@faezehFrj hello I'm also facing the same issue.. did you find any solution for this ?
Hi I had your problem too... You must make changes to this library : 1- At this address : Arduino\libraries\HLW8032-master\HLW8032.ccp you must change the variable type "CF" to float 2- At this address : Arduino\libraries\HLW8032-master\HLW8032.h you must change the value of variable "CurrentRF" to the value of the shunt current resistance used. I came to the conclusion by applying these changes. good luck. 👍
hi @ArashGolsaz Thanks for you reply .
I already made the changes that you mentioned as I was thinking this is problem with datatype casting and I started getting the current values but those values are not accurate because when I calculate power using those (with know load attached ) then it's way of the required values plus negative sign kept appearing repeatedly.
So any fix for that ? Do I need to take RMS ?
Also in GetKwh() function in HLW8032.cpp file, I changed these lines :
*uint32_t PFcnt = (1 / PowerPar) (1 / InspectingPower) 1000000000 3600;**
to :
float PFcnt = (1 / PowerPar) (1 / (CF VF) ) 1000000000 3600;
and
*float KWh = (PFData PF) / PFcnt;**
to: *float KWh = ((PFData 65536) + PF) / PFcnt;**
as per mentioned in Datasheet page#17 . then I was able to get the correct kwh
@faezehFrj hello I'm also facing the same issue.. did you find any solution for this ?
file HLW8032.cpp, replace GetCurrent() and GetCurrentAnalog() ///
*float HLW8032::GetCurrent()
{
float Current = GetCurrentAnalog() CF;;
return Current;
}
float HLW8032::GetCurrentAnalog()
{
float FCurrentPar = CurrentPar;
float Current = FCurrentPar / (float)CurrentData;
return Current;**
/// this code i get from https://github.com/ocrobot/HLW8032
hello. tanks for your library. actually I use Arduino mega in this project. The voltage is received quite correctly but current not. I design this project like below picture:
I hope you can help me ;(