Skip to content

Commit 8c2c1c6

Browse files
committed
fixed current sensing formula + correct adc address
1 parent 26db5c3 commit 8c2c1c6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pio_workspace/lib/power_custom/adc_sensors.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@ float ADCSensors::convertVoltage(float adcVoltage) {
8787
}
8888

8989
float ADCSensors::convertCurrent(float adcCurrent) {
90-
return ((adcCurrent / 1024.0) * 3.3) / (0.005 * 50);
90+
return (((adcCurrent * 2 ) / 50 ) / 0.005);
9191
}

pio_workspace/lib/power_custom/adc_sensors.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#include "Wire.h"
66
#include "Adafruit_ADS1X15.h"
77

8-
#define ADC_VOLTAGE_ADDR 0x48
9-
#define ADC_CURRENT1_ADDR 0x49
10-
#define ADC_CURRENT2_ADDR 0x4B
8+
#define ADC_VOLTAGE_ADDR 0x4B
9+
#define ADC_CURRENT1_ADDR 0x48
10+
#define ADC_CURRENT2_ADDR 0x49
1111

1212
class ADCSensors {
1313
public:

0 commit comments

Comments
 (0)