current sensor on AC current


koal01
 

Hi Howard,
Hope everything is all right for you !
After the success of the ACS712 module on DC current i'v added an AC source on relay 5 and would like to add a second ACS712 display module to measure amps on AC current
In confi.h i updated this line
#define STAT_MAINS_CURRENT_ANALOG     A8 
but in misc.ino i added this piece of code in PART A but there's an error

//PART A - THIS PART CONCERNS THE AC CURRENT
#define ACS712_V_PER_A 0.100
 
double toACAmps(double d) {
 double V = (d/1024.0)*5.0;
 double A = (2.48 - V)/ACS712_V_PER_A;
return abs(A);
}
//PART_B - This part is working on DC current
// converts a raw analog reading into current for STAT_DC_CURRENT_ANALOG
// return (invalid) if not implemented or if there's an error
#define ACS712_V_PER_A 0.100
 
double toDCAmps(double d) {
 double V = (d/1024.0)*5.0;
 double A = (2.48 - V)/ACS712_V_PER_A;
return abs(A);
}
//

Thank you and nice skies
Koal01


Howard Dutton
 

On Wed, May 27, 2020 at 07:27 AM, koal01 wrote:
double toACAmps(double d) {
 double V = (d/1024.0)*5.0;
 double A = (2.48 - V)/ACS712_V_PER_A;
return abs(A);
}
What jumps out at me is that there is NO toACAmps() function.  The AC function is called toAmps().


koal01
 

Thank you Howard, 
I've added this piece of code and the wiring will be done when the rain stops.
It's great !
Koal01