Measuring and Reporting Battery Level
-
Measuring and Reporting Battery Level
Use a 1MΩ (R1) and 470KΩ (R2) resistor in series, connected to the positive terminal on the battery and ground and then connected the tap point to the A0 input on the CPU.
The tap point could be bypassed with a 0.1 uF capacitor to keep the noise level low, at this otherwise high impedance point.
The ADC is set to use the internal reference value of 1.1V - so Vmax at ADCmax = 1.1*(16+4703)/4703 = 3.44V
The battery power value must be converted to a percentage compatable with your Controller.
See the following example on how to measure battery level on A0 and report it to the Controller.
I get different values from one Pro-Mini to the others, the resistors are all the same values and tolerances, "The tap point could be bypassed with a 0.1 uF capacitor to keep the noise level low, at this otherwise high impedance point." How would you connect this capacitor?
-
@esawyja - No, not in series with the analog pin.
Bypass the point so connect it between R1 and R2 and then go ground.Have a look at my EasyPCB schematics:
https://www.openhardware.io/uploads/568ed84b60aa3f8965fbf095/image/Rev9 Schem.jpgThis is to smooth the value out/remove noice.
Another method to do this is to take mulitiple readings and make an average.
-
@sundberg84 aaah ok so across R2, thanks so much!
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
NODs stop responding, but ping works.
Troubleshooting • 27 days ago • Marcin 27 days ago -
Can not compile MySensors on esp8266
Troubleshooting • 24 Aug 2024, 15:35 • TheoL 29 Aug 2024, 20:47 -
Forum Search not working?
Troubleshooting • 4 Oct 2023, 23:33 • Gibber 2 Sept 2024, 20:28 -
Raspberry Pi 5: invalid GPIO 9
Troubleshooting • 27 Aug 2024, 13:20 • igo 27 Aug 2024, 13:20 -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22