Re: monitoring Dc help


Howard Dutton
 
Edited

Looking at that again it won't work, those are just conversion functions so...

I've expanded the range of allowed Analog ports into the Config.h settings and added the following code to an Misc.ino example in the OCS (master branch)...

// 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.185
double toDCAmps(double d) {
 double V = (d/1024.0)*5.0;
 double A = (2.5 - V)/ACS712_V_PER_A;
 return A;
}

So now just add this code to Misc.ino and specify the analog port in Config.h
to enable it.

Note: this is for the ACS712ELCTR-05B-T, the +/- 5A device.

Join onstep-ocs@onstep.groups.io to automatically receive all group messages.