Browse Source

Update 'firmware/sensors.ino'

Comments comments comments
klaute 1 year ago
parent
commit
f0974e6e79
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      firmware/sensors.ino

+ 5
- 1
firmware/sensors.ino View File

@@ -53,8 +53,12 @@ float fetchWindspeed() {
53 53
 // Copied from https://arduinodiy.wordpress.com/2016/12/25/monitoring-lipo-battery-voltage-with-wemos-d1-minibattery-shield-and-thingspeak/
54 54
 #ifdef BATTERY_POWERED
55 55
 float getBatteryVoltage() {
56
+  // ESP8266 ADC pin input voltage range ist 0V .. 1V
57
+  // The Wemos D1 mini does already contain a voltage divider circuit: A0(Wemos PCB) -- [220kOhm] -- ADC (ESP8266)-- [100kOhm] -- GND
58
+  // The (+) pole of the battery is connected to the A0 pin of the Wemos board through a additional 100kOhm resistance.
59
+  // The battery voltage of 4.2V max is measured as 1.0V on ESP8266 ADC pin.
56 60
   uint16_t raw = analogRead(A0);
57 61
   float volt = raw / 1023.0;
58 62
   return volt * 4.2;
59 63
 }
60
-#endif
64
+#endif

Loading…
Cancel
Save