Skip to content

v1.0.3 - correct use of current coarse gain #3

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

Merged
merged 2 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun ACS37800 Power Monitor Arduino Library
version=1.0.2
version=1.0.3
author=SparkFun Electronics
maintainer=SparkFun Electronics
sentence=Library for the Allegro MicroSystems ACS37800 power monitor IC
Expand Down
3 changes: 0 additions & 3 deletions src/SparkFun_ACS37800_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ ACS37800ERR ACS37800::readRMS(float *vRMS, float *iRMS)

//Extract the irms. Convert to current in Amps.
//Datasheet says: "RMS current output. This field is a signed 16-bit fixed point number with 15 fractional bits"
//Extract the vcodes. Convert to voltage in Volts.
union
{
int16_t Signed;
Expand All @@ -581,7 +580,6 @@ ACS37800ERR ACS37800::readRMS(float *vRMS, float *iRMS)
}
amps /= 27500.0; //Convert from codes to the fraction of ADC Full Scale (15-bit)
amps *= _currentSensingRange; //Convert to Amps
amps /= _currentCoarseGain / 4.5; // Correct for the coarse gain
if (_printDebug == true)
{
_debugPort->print(F("readRMS: amps (A, after correction) is "));
Expand Down Expand Up @@ -652,7 +650,6 @@ ACS37800ERR ACS37800::readInstantaneous(float *vInst, float *iInst, float *pInst
}
amps /= 27500.0; //Convert from codes to the fraction of ADC Full Scale
amps *= _currentSensingRange; //Convert to Amps
amps /= _currentCoarseGain / 4.5; // Correct for the coarse gain
if (_printDebug == true)
{
_debugPort->print(F("readInstantaneous: amps (A, after correction) is "));
Expand Down