From 3a1b8d6745bdaa7cba0d608ae8c5a77bb1f3d129 Mon Sep 17 00:00:00 2001 From: Ollo Date: Sat, 7 Nov 2020 00:34:27 +0100 Subject: [PATCH] Raw ADC value of lipo added --- esp32/include/ControllerConfiguration.h | 4 +++- esp32/src/main.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/esp32/include/ControllerConfiguration.h b/esp32/include/ControllerConfiguration.h index 2edae32..7bdc650 100644 --- a/esp32/include/ControllerConfiguration.h +++ b/esp32/include/ControllerConfiguration.h @@ -37,6 +37,8 @@ * } * \enddot * + * Before entering Deep sleep the controller is configured with an wakeup time. + * * @} */ #ifndef CONTROLLER_CONFIG_H @@ -52,7 +54,7 @@ #define MOIST_SENSOR_MIN_ADC (25 * 4095 / 100) #define SOLAR_VOLT(adc) ADC_TO_VOLT_WITH_MULTI(adc, 4.0306) /**< 100k and 33k voltage dividor */ -#define ADC_5V_TO_3V3(adc) ADC_TO_VOLT_WITH_MULTI(adc, 1.7) /**< 33k and 47k8 voltage dividor */ +#define ADC_5V_TO_3V3(adc) ADC_TO_VOLT_WITH_MULTI(adc, 1.69) /**< 33k and 47k8 voltage dividor */ #define MS_TO_S 1000 #define SENSOR_LIPO 34 /**< GPIO 34 (ADC1) */ diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index 541e6c5..666887e 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -115,8 +115,11 @@ long getLastMoisture(int plantId) void readSystemSensors() { - lipoRawSensor.add(analogRead(SENSOR_LIPO)); - solarRawSensor.add(analogRead(SENSOR_SOLAR)); + for (int i=0; i < 5; i++) { + lipoRawSensor.add(analogRead(SENSOR_LIPO)); + solarRawSensor.add(analogRead(SENSOR_SOLAR)); + } + Serial << "Lipo " << lipoRawSensor.getAverage() << " -> " << getBatteryVoltage() << endl; } int determineNextPump();