# How to measure the battery voltage while charging

I am designing a battery charger with 48 volt 10 amp output. I am controlling the buck converter pwm using PIC controller. During charging the battery's current and voltage have to be constantly monitored in order to supervise charging. I am going to use external ADCs for monitoring the charging voltage and current. SO I want to know when and how to measure the battery voltage and charging current during charging. Is there any controller or sensing device available? How can I measure it while charging because at a time of charging ??

• Measure it during the PWM off-periods.
– Chu
Mar 20, 2019 at 18:32
• ...except for the current, which must be measured during the PWM on-periods. Mar 20, 2019 at 18:32
• Both of the above comments are wrong. Your buck have an inductance which make the system dynamic slower than one PWM cycle (actually, that's why buck converters works); so don't do that. It's common to stop charging momentarily to measure the battery voltage and correct the position of the charge process in the V/SOC graph. Mar 20, 2019 at 18:56
• Attach a voltage divider to the output. Use an ADC to measure the output voltage of the divider. No problem. Use a capacitor at the ADC input to make sure any ripple voltage from the charger is removed. Use an ACS711 (or similar) to measure the charge current. Or, if you want, you can use a shunt and a current shunt amplifier (such as INA199) to measure the charge current on the low-side. Mar 21, 2019 at 3:01
• Its funny how this is flagged as "Off Topic" Mar 21, 2019 at 4:22

When to monitor?

All the time! You need to be in control of what you are doing at all time. If there's an overvoltage or overcurrent, you need to detect that fast and cut the power out.

A battery charger is normally regulated in current, which means you set a charge current and don't really look at the output voltage of your buck (which is anyway biased by the battery). Therefore you will control the PWM based on the current reading, making a regulation loop. A PI regulator may be well enough for your application, or you may go more complex if you need fancy stuff such as power factor correction on your input (but I doubt you do).

Also, since your battery voltage will raise when pushing current inside the battery, you will need to occasionally stop the charge current to read the battery voltage at open load. This will help you correctly find the actual State Of Charge (SOC). For some type of battery, the voltage is enough, for some other type (such as LiFePo4), there's a flat section in the V/SOC graph. In that case, you also need to keep track of the current you inject in the battery to know your SOC.

How to monitor?

With a voltage sensor circuit and a current sensor circuit of course. A voltage sensor circuit is often a simple resistive voltage divider. For the current sensor, @mkeith comment is very relevant. You can go with an option where the current pass through an IC that measure it, or you can put a small serial resistor in series with the battery and measure the voltage drop with an differential amplifier designed for that.

simulate this circuit – Schematic created using CircuitLab

I only drew the main parts. To do a good charger, you would need some protection circuit to resist short circuits, ESD discharge, harsh electrical environment, unstable source, etc. You may even want to consider redundency in the sensors for safety. All depends on your application.

Good luck

• You don't necessarily need to halt charging to measure voltage. Many chargers don't bother doing that. Also, you DO need to monitor voltage curing CC charging, because there is always a voltage limit as well as a current limit. Once the voltage limit is hit, the charge mode may need to change to CV (depending on battery type). For example, with Lithium ion batteries, once the charge voltage hits 4.2V (per cell) the charger will transition to constant voltage charging until the termination current condition is met. Mar 21, 2019 at 4:27
• You are right. I didn't consider end of charge handling. Thanks. Mar 21, 2019 at 4:31

You should use low-Ohm bypass resistor sequentaly with your load (battery). Current consumption is calculated from Ohm's law: I = Vdrop/Rbypass

simulate this circuit – Schematic created using CircuitLab