From f0974e6e79026b54ed5f78a92d2e086cab4abd4a Mon Sep 17 00:00:00 2001 From: klaute Date: Mon, 28 Jan 2019 10:54:16 +0000 Subject: [PATCH] Update 'firmware/sensors.ino' Comments comments comments --- firmware/sensors.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/firmware/sensors.ino b/firmware/sensors.ino index dc5479f..820650c 100755 --- a/firmware/sensors.ino +++ b/firmware/sensors.ino @@ -53,8 +53,12 @@ float fetchWindspeed() { // Copied from https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/ #ifdef BATTERY_POWERED float getBatteryVoltage() { + // ESP8266 ADC pin input voltage range ist 0V .. 1V + // The Wemos D1 mini does already contain a voltage divider circuit: A0(Wemos PCB) -- [220kOhm] -- ADC (ESP8266)-- [100kOhm] -- GND + // The (+) pole of the battery is connected to the A0 pin of the Wemos board through a additional 100kOhm resistance. + // The battery voltage of 4.2V max is measured as 1.0V on ESP8266 ADC pin. uint16_t raw = analogRead(A0); float volt = raw / 1023.0; return volt * 4.2; } -#endif +#endif