Electronic – LiFePO4 Constant Current charging circuit with micro controller

batterieschargingconstant-currenthall-effectoperational-amplifier

I made a small off-grid solar station a few years ago, that was relying on lead acid batteries. I am now planning to change it for a 12v 8Ah LiFePO4 battery, because of it's low weight, space needed, and good performance.

I would like to make my own controller to manage the station, including the charging of the battery and the load consumption.

After reading a few batteries datasheets, I know what algorithm I have to write for the charging.

The solar panel gives a max current of 1.12A at Pmax, so just below the recommended 0.2C constant current charge rate (1.6A). However I have some difficulties with the this constant current circuit.

I found some different designs, such as this one which seems the simplest and the same as this one.

I am planning to use an ACS712ELC-05B instead of the Rref resistor.

1) Would that be a good choice ?

Also, I know that I will probably need a Non-inverting Amplifier to convert the 185mV/A output of the ACS712 to an output of about 1V/A, but I'm not sure of which values I should use to calculate the resistor values.

2) What is your advice ?

And my last question is,

3) Will the TL081 op-amp be suitable as the negative feedback op-amp ?

Best Answer

If your solar panel limits the current to less than the maximum safe charging current then you don't need a current limiter, because the panel already is one!

What you do need is a voltage limiter. The maximum charge voltage for a 4 cell LiFePO4 battery is 14.6V (3.65V/cell). Above this voltage the battery will either become overcharged, or shut down if it has a built in protection circuit module (PCM).

One way to limit charging voltage is to simply turn the charging current off when the battery voltage reaches the maximum allowed voltage, then turn it on again after the battery voltage drops back down. Assuming you are using an MCU to measure the voltage via an analog input (with suitable voltage divider), you should switch the high side so that battery negative is always connected to common ground.

The high-side switch can be a P channel power MOSFET rated for at least 30V. The FET is turned on by negative voltage relative to the solar panel's positive terminal, so you need a level shifter (Q1 in the circuit below) to translate the lower voltage (eg. 3.3V or 5V) from your MCU output. This driver also inverts the signal so the FET will turn on when the MCU's output pin is high. Most MOSFETs can only take 20V maximum on the Gate, so for safety its Gate-Source voltage should be limited with a resistor divider and/or Zener diode.

schematic

simulate this circuit – Schematic created using CircuitLab

If you want to monitor charge and discharge current then you can install a current sensor into either battery lead. This should have low resistance to keep voltage loss down, and to do both charge and discharge it needs to measure current flow in both directions. The ACS712 is a good choice because it has very low insertion resistance, is isolated, measures both positive and negative currents, and its output is biased to half the supply voltage for use with a unipolar ADC.

At a sensitivity of 185mV/A you would only get about 37 levels per Amp with a 10 bit ADC, so some amplification is probably desirable. How much depends on the ADC's input range and what currents you want to measure. For example if you want 0~5V from +-2A the gain required is 2.5V/(0.185V/A*2A) = 6.76. Using a standard non-inverting opamp circuit the feed back resistors need to have a ratio of (6.76-1) = 5.76:1. The actual values should be high enough to avoid loading down the opamp's output, but not high enough to be affected by bias current or noise.

More importantly, you should choose an opamp with rail-to-rail outputs and a good input range (preferably also rail to rail), eg. MCP6021. The TL081 is not a good choice for applications like this because it doesn't have rail-to-rail outputs, and its inputs need to be least 3V above the -ve supply.

CMOS inputs have negligible bias current, so we can choose relatively high value feedback resistors, eg. 10k and 57.6k. Since the Zero Amps reference point is 2.5V we also need to set the amplifier's 'ground' input reference to 2.5V. We can use a resistor divider to derive this from the +5V supply, and by using 2 x 20k they also form the Thevenin equivalent of 10k (this saves one resistor and reduces current draw). Adding a capacitor across the 57.6k feedback resistor reduces the gain to 1 at high frequencies to avoid amplifying noise.

schematic

simulate this circuit

To get an accurate Zero Amps value you will probably have to calibrate it (since any zero offset from the ACS712 will amplified by 6.76). This could be done by putting a small value trimpot in the center of the voltage divider to adjust the reference voltage (and reducing the values of R2 and R3 to maintain the total resistance), or by reading the current at some time when the actual Amp draw is known (eg. at startup with charger and load switched off).