enter image description here

My application is basically a power monitoring system in which inverter voltage(RMS),current(RMS) and battery voltage,current are measured. 24V battery is being used in the application. I am using PIC16F877A microcontroller for measuring and do the rest of the functions based on the readings. ADC code is working fine. It is measuring the battery voltage correctly if it is isolated from charging or discharging. But whenever I connect the battery to charging and inverter circuit the ADC is measuring only a constant value, in my case 25.7V even if the battery is charging. but multimeter is reading incremental voltage as battery charges. I am using a simple voltage divider to step down the voltage to a microcontroller level voltage.I have added a 100nF cap to ADC input but didn't help. Is there anything I need to consider in circuit side or firmware side to do accurate measurement.


  • \$\begingroup\$ My doubt is, is it possible to measure the measure the battery voltage using a microcontroller ADC accurateley while it is charging \$\endgroup\$
    – Vishnu.P
    Dec 10, 2015 at 7:28
  • \$\begingroup\$ Please add a schematic of the relevent parts of the circuit. \$\endgroup\$
    – Transistor
    Dec 10, 2015 at 8:20
  • \$\begingroup\$ Added. I am using internal reference for ADC. \$\endgroup\$
    – Vishnu.P
    Dec 10, 2015 at 9:09
  • \$\begingroup\$ Right. Now we need a table of the voltages at top and bottom of R1 and the ADC readings for each condition (idle and charging). \$\endgroup\$
    – Transistor
    Dec 10, 2015 at 12:40
  • \$\begingroup\$ Ok. I'll try to get it done ASAP \$\endgroup\$
    – Vishnu.P
    Dec 10, 2015 at 20:11

1 Answer 1


I dont have enuf reputation to make a comment :( so i am posting this as an answer.

To get an accurate measurement of the battery capacity you also need to measure the current thru the battery. I would suggest you read about "coulomb counter".

and to your question regarding measuring battery voltage while charging using a voltage divider and ADC, I would say 'No' because you would in effect be measuring the charging voltage not the battery voltage.

  • \$\begingroup\$ I am measuring the current also using a hall effect sensor. if it is a 'No' then how multimeter is reading the value? \$\endgroup\$
    – Vishnu.P
    Dec 10, 2015 at 8:47
  • \$\begingroup\$ I just need to read the voltage across battery terminal. On the user end my application will display the battery current,battery voltage, Inverter voltage(rms) and inverter current(rms). \$\endgroup\$
    – Vishnu.P
    Dec 10, 2015 at 8:49
  • \$\begingroup\$ I had built a single cell (Li-ion) charger unit (using Bq2057) the output of the charger was held at 4.2V while charging and to measure the battery capacity I had used STC3100 battery guage IC. I dont know how different it would be if you are using an inverter. And is your multi-meter "True RMS" ?electronics.stackexchange.com/questions/18368/… \$\endgroup\$
    – R. Hirur
    Dec 10, 2015 at 9:10
  • \$\begingroup\$ My device measures true rms for AC signals and it is reading properly. But whenever the battery is connected to charging and inverter circuit microcontroller is not reading any other value other than a constant voltage, say 25.6V. It is supposed to increase while charging and if I use a multimeter the voltage is increasing as it is charged. why did you use STC3100 instead of microcontroller ADC? the battery voltage will vary from 23-28 in my application. \$\endgroup\$
    – Vishnu.P
    Dec 10, 2015 at 9:21
  • \$\begingroup\$ For my application I needed very accurate capacity measurement as it also takes care of the leakage current from the battery. Any way, I take that you are using a timer to generate gating pulses for the inverter. Make sure you dont use same time base for pulse generation and ADC measurement. \$\endgroup\$
    – R. Hirur
    Dec 10, 2015 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.