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?

    I got mine like this below, is this correct please?
    0_1493623393326_upload-a700c19a-040d-4ce8-9f06-45d7871cd5b0


  • Hardware Contributor

    @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.jpg

    This 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!


Log in to reply
 

Suggested Topics

  • 3
  • 24
  • 15
  • 2
  • 2
  • 4

1
Online

11.2k
Users

11.1k
Topics

112.5k
Posts