Design and Implementation of a Digital Control System for Lead Acid Battery Charging

: Ensuring a long battery life and satisfactory performance requires accurate charging cycles. There are three phases to the charge cycle - Constant Current Charge, Constant Voltage Charge, and Float Charge. It is usual that lead acid battery users complain about fast degrading performance because most the low cost commercially available lead Acid Battery chargers provides only single-stage charging phase which is that of constant-voltage charging phase. To ensure long service life and good performance, it is of paramount importance that all charging modes are respected. This said it is clear that the battery charger should have a certain degree of controllability over voltage and current quantities through-out the charging process. In this paper, we designed and built a lead acid battery charger to use in conjunction with a synchronous buck converter topology. After implementing and testing the system, we obtained good results in both the quantitative and qualitative analysis of the implemented system tested, a 12 V-7000mAh battery. With the help of a MCU-based digital control system containing two different control transfer functions - constant current Feedback Control and Constant Voltage Feedback Control monitoring the charging process proved possible without any overshoot. The prototype showed us an efficiency rating of 86.60%, the maximum error level was recorded at 0.05V, and there were no problems related to overshoot or transient response when testing our prototype which worked flawlessly.


Introduction
In recent decades, international concerns regarding the exhaustion of fossil energy resources, together with the negative environmental and economic impact related to their excessive use [1] have prompted the research community to conduct in-depth studies on renewable energy resources as alternative solutions [2].Photovoltaic (PV) energy is such a sustainable and clean energy source.However, as PV power is only available intermittently, regulation via a storage battery is required to supply the load demand during periods of low solar irradiation or overnight [3,4].One way of regulating input voltage for these highly fluctuating outputs is to use DC-DC converters [5].The regulated output voltage charges batteries or powers DC loads.This idea can also be used further to power AC loads by using an inverter that turns alternating current into Direct Current a task handled well by AC-DC converters [6].In renewable energy systems, the battery is the most efficient long-term electrical energy storage equipment.
At present, there are numerous commercial batteries used in renewable energy systems, such as lead-acid, lithium ion (Li-Ion), nickel cadmium (Ni-Cd), and sodium sulfur (Na-S) batteries, among others [7][8][9][10][11].However, in charging and discharging processes, some of the parameters are not controlled by the battery's user.That uncontrolled operation leads to ageing of the batteries and a reduction of their life cycle [12].Battery charging is a very critical activity affecting electric storage capability and incorrect charging affects battery efficiency and health [13].Lead acid batteries are the most widely installed storage devices in the PV applications thanks to its confirmed stability, excellent performance in various sizes, and cheaper cost [5].The main goal of charging methods is to increase the State Of Charge of the battery.Critical parameters for battery performance are, charging time and battery protection from overcharging or overdischarging.Control methods commonly used in battery charging are: constant current (CC), constant voltage (CV), two-step charging (i.e., CC-CV).The Constant Current (CC), this method consists of charging the battery with a constant current, and it limits the current to prevent over-current of the initial charge [14].The voltage value will depend on the charging current, and one advantage is easy calculation of the charging time the SOC [15].As voltage is not usually controlled, this can cause battery overcharging and a temperature rise, resulting in battery life degradation [16,17].The Constant Voltage (CV) method is commonly used to charge the battery by applying a constant voltage on its terminals.During the initial stage of charging, the charge current is high.As the battery voltage reaches the charger's voltage set limit, the charge current decreases [17].On the other hand, most lead acid battery producers suggest that the three stages charging technique according to the standard is the best and most effective approach to restore the battery's full capacity and prolong the battery's lifespan [5].

Methodology
In this paper, a control approach for a DC-DC Buck converter is used as an efficient lead-acid battery charger for lead acid Battery system.

Proposed Methodology
The figure 1 shows the global architecture of the proposed methodology.The steps we are going to follow for our proposed methodology are the following: Size a Synchronous buck converter with the desired characteristics.These characteristics include Switching frequency (f s ), Input voltage (V in ), input power, output voltage (V out ), maximum output current (I Lmax ), Inductor current ripple (ΔiL), Capacitor voltage ripple (∆V c ) and Sampling period (T s ) for the discretized system.
Calculate the voltage and current open loop transfer function of the buck converter in continuous time domain.
Using appropriate discretizing method and sampling time, convert both controllers transfer functions from the continuous domain (s-domain) to the discrete domain (z-domain).
Simulate the two transfer functions obtained above and Construct a synchronous buck converter in Matlab/Simulink and Proteus and observe their output waveforms.

System Sizing
This section is dedicated to the calculation and justified selection of electronics components to allow the flow of various voltages and currents without causing damage.Table1 give us the electrical parameters of the system.The frequency was chosen as a compromise between switching losses and components size.All the Calculation made below are made on the assumption that we are in Continuous Conduction Mode (CCM).The parameters are calculated using the reference design described in the study conducted by Cuoghi, S., Ntogramatzidis, L. [18].
Calculating the value of the inductor,

∴ L 586 μH
Calculating the value of the capacitor,

System Modelling
The circuit below was used to perform the dynamic analysis of the system.For linearization of the Buck converter the moving average in state space model is used [4].
The method is widely used for modeling of switched power converters operating with PWM control.It consists of obtaining the weighted average state of circuit with respect to the operating duty cycle over a switching period.i).During the ON state (When M1 is ON and M2 is OFF).Applying Kirchhoff's Voltage and Current Law during the ON state yields: ii).During the OFF state (When M1 is OFF and M2 is ON).Applying Kirchhoff's Voltage and Current Law during the OFF state yields: Taking average values for inductor current and capacitor voltage we have the following equations: With D the duty cycle.
The current and voltage of the capacitor is given by: => ?=2 @ 6 − A6 (10) Arranging equations in state space matrix form, the next step is to convert our state space matrix in to transfer function.Given that we are to design two controllers (voltage and current controller), this implies we are to derive two transfer functions one for each controller.
Voltage control Current control After substituting the values of Vin, L, R Lesr , C, R, in the two transfer functions, we obtain the following equations for voltage and current transfer functions.The next step is to convert from continuous domain (s-domain) to discrete domain (z-domain).This can be accomplish using several methods such as Zero-order hold, First-order hold, Tustin and Matched pole-zero.Here we are going to use the Zero-order Hold (ZOH) method [19].The formula ( 13) is used to accomplish this conversion.

TF(s)
]^(_) Applying partial fraction to put the equation above in a form that can be transformed easily.

Global Architecture of the Proposed Solution
The global architecture of the proposed method design in Matlab/Simulink is shown in figure 3.
From figure 3 below we can see the current and voltage controllers with reference values 4 A and 12 V respectively.We can also see that only one controller is connected (Voltage controller) as only one of them can be active at the time.Also we can see the synchronous buck converter principally composed of two MOSFETs, inductor, capacitor and effective series resistances (ESR) of both inductor and capacitor.Furthermore, we have two voltage sensors to measure the input and output voltage and one current sensor to measure the current through the inductor.For simplicity, the step-down transformer, the rectification bridge and filtering are replaced by a battery.After running the simulation with a set reference of 12.0 V, the output voltage of 11.69 V was obtained.After simulating a reference value of 12.0V, we received an output equaling the set target with no over-shooting or delay (settling time of around 1 ms).A new PI controller designed to perform similarly to our current controller is shown in Figure 9.After running the simulation, the following result was obtained.To implement this transfer function in a digital controller, we first need to convert it from the continuous time domain (s-domain) to the discrete-time domain (z-domain).

Matlab/Simulink Simulation
The discretized transfer function of the voltage and current controls were applied to obtain new values for the discretized PI controller using the automatic PID Tuning tool in Simulink.The discrete transfer function was designed with sampling intervals at 5ms.Below is a block diagram that includes both continuous and discrete domains.
Figure 12 shows the results obtained from the simulation of the block in the previous figure.The Continuous Transfer Function output voltage (in yellow) and Discrete Transfer Function input voltage (in blue) on the chart above illustrate a few key points.Firstly, we can see that when analyzed over time, the Discrete Transfer function settles faster than the Continuous Transfer Function.Because the Discrete Control uses counters implemented in hardware, they have to account for acquiring all the measurements before processing them at various intervals.Secondly, it is essential that an appropriate sampling rate is selected for the system--if too low a sample rate is chosen, then this will result in slow responsiveness from the controller; too high sample rate, however, might mean that every measurement taken gets processed many times before an action takes place.

Proteus Simulation
For the simulation in Proteus, some modifications were made to make the circuit more practical.Some of these modifications are listed below: 1) The control block used in Matlab/Simulink is replaced by an AVR microcontroller (ATMEGA328P).The circuit diagram given on Figure 13 above was tested for both current and voltage controller.The image given by Figure 14 displays the PWM signals from the microcontroller with a slow time to avoid having both MOSFETS turn on simultaneously.
From the datasheet of IRF3205, there should be at least a 230-second dead time.Looking at Figure 14 above, we see that the pulse width modulation for the high-side MOSFET is shown in yellow; for the low-side MOSFET, it is in green.As seen on this graph, it takes about 260 nanoseconds for both these signals to turn off, which means there is an absolute difference of only one nanosecond (1n s).
The difference between the turn OFF of the high side MOSFET and the low side MOSFET is 0.26 us = 260 ns (19.97 us -19.71 us) as we can see in Figure 15.

Implementation Testing
A prototype for the charger was developed to test the performance of the control strategy.It is composed of three main circuits: a measuring board, a signal conditioning and LCD to display the values.
We made use of CP1270 12V 7000mAh battery with maximal initial charging current of 2100mA in our system to verify that our control system can be used to charge lead acid batteries using the three phase technique.Table 2 shows the results obtained after using the three different charging methods.
We assumed the DOD of the battery at 40 % which corresponds to around 12.10 V open circuit voltage as can be verified in the study [20] as the reference or start point of all the methods.The charging period selected for the tests made in table 2 above was chosen to be 5 hours.We can see that immediately after the charging period was over, all the charging methods showed a fully charged state (100% S. O. C).However, to have the real S. O. C of a battery, we need to wait about 3 hours after the charging is over.As it can be noticed on table 2, 3 hours after charging the battery the S. O. C of the battery for constant current and constant voltage drop to around 90% whereas the S. O. C for the 3-phases charging method was still at 100%.The drop in the other two methods can be explained by the absence of the float charge.This float charge helps to maintain the battery at 100%. the output waveforms on the Serial plotter at no load.The characteristics of the output waveform are listed in table 4. The figure 19 below shows the histogram of the full charge time using our proposed solution.From the figure above, we can see that it takes approximately 5 hours for our proposed system to charge completely the battery rather than 4 hours.

Conclusion
In this paper, our objective was to design and implement a digital control system in a synchronous buck converter to monitor the charge of lead-acid batteries.To do so, we proposed a synchronous buck-converter to be operated at the frequency of 32 kHz.We implemented the system and tested the various controllers for different reference values and they were found to be working properly and switching as expected to the required phase when all the conditions were fulfilled.From various experiments, we could also record the maximum efficiency of the converter to be 86.60%.Also from qualitative analysis, we could notice that there were no overshoots in the output signal and the measured ripple was less than our set limit.

Figure 1 .
Figure 1.Block diagram of proposed methodology.
I. NON×IP QR F G HIOSPIP FH .PIP ×IP T TF(s) M = SPPPP FHU.OVOO×IP W F G HIOSPIP FH .PIP ×IP T the table of transform to convert from s-domain to zX _ = 5 wx is the sampling time.After multiplying by (z-1/z) substituting the values of a, b and X _ in the equation above and simplifying, we obtain the following TF(Z) V = (Of.f)yHO.VIf×IP sQG y G (I.Uz ×IP sQG )y f.Vf×IP s{R (18) Applying the same method illustrated above, we obtain the following result for the discrete current open loop transfer function TF(Z) I = (N.NzO)ZHV.OSz×IP sQ{ Z G (I.Uz ×IP sQG )Z f.Vf×IP s{R

Figure 3 .
Figure 3. Global architecture of the proposed method.
Matlab/Simulink was used to simulate the transfer functions of both continuous and discrete time domains of voltage and current controller.In this section, the various open loop transfer functions (for current and voltage controller) are tested and their results analyzed.The figure below shows the open loop transfer function of the voltage controller.

Figure 4 .
Figure 4. Voltage open loop transfer function block.

Figure 5 .
Figure 5. Uncontrolled Open Loop Output Voltage.Below is an illustration of the open loop transfer function for the current controller.

Figure 6 .
Figure 6.Current Open Loop Transfer Function Block.After simulating with an input of 4A, the measured load current came out to be 3.896A.It can be seen in the Figure below.

Figure 7 .
Figure 7. Uncontrolled Open Loop Output Voltage.This section will test our closed-loop transfer functions and analyze their results.A PI controller is used to obtain the desired values for inductor current and output voltage.Using Matlab/Simulink's auto PID tuning tool, these parameters are obtained: Kp and Ki. Figure 8 displays the closed loop transfer function of the voltage controller.

Figure 9 .
Figure 9. Closed Loop Transfer Function of the Current Controller.

Figure 10 .
Figure 10.Load Current of Closed Loop Transfer Function.

Figure 11 .
Figure 11.Continuous and Discrete Voltage Closed Transfer Function.

Figure 12 .
Figure 12.Continuous and Discrete Step Response for Voltage Controller.
2) A gate drive (IRF2112) is added to drive the MOSFETs properly.By properly we mean passing inverted PWM signals at the gates of the two MOSFETs with a dead time between the turn OFF and turn ON of the MOSFETs.3) Two voltmeters (voltage divider type) are used to measure the voltage at the input and at the output.4) The current sensor is replaced by a 0.5 Ω/10 W resistor (a combination of two 1Ω/5W resistors in parallel) with one operational amplifier (LM358P).5) The display is replaced by a LCD 16*2.

Figure 13 .
Figure 13.Final circuit of the proposed solution.

Figure 18 .
Figure 18.Output Waveform at No Load from Serial Plotter.

Figure 19 .
Figure 19.Full charge time using 3-phase charge method.

Table 4 .
System characteristics at full load.