Constant current-fuzzy logic algorithm for lithium-ion battery charging

Muhammad Nizam, Hari Maghfiroh, Azis Ubaidilah, Inayati, Feri Adriyanto Department of Electrical Engineering, Faculty of Engineering, Universitas Sebelas Maret, Surakarta, Indonesia Centre of Excellence for Electrical Energy Storage Technology, Universitas Sebelas Maret, Surakarta, Indonesia Department of Chemical Engineering, Faculty of Engineering, Universitas Sebelas Maret, Surakarta, Indonesia


INTRODUCTION
The battery is a component that can store electrical energy for a long time, so it has an important role. The batteries commonly used as energy storage media are secondary batteries, which can be recharged by an electric charge (rechargeable). Rechargeable batteries are becoming more prevalent in contemporary technology such as portable electronic equipment, electric automobiles, plug-in hybrid electric vehicles, energy storage systems, and renewable energy systems [1]. However, the life of the rechargeable batteries is dependent not only on the charger time [2], [3] but also on the charger way and overcharging control [4].
Because of its long cycle, reliability, high energy density, low toxic, low self-discharge rate, high power density, and high efficiency, lithium-ion (Li-ion) batteries are in high demand [5], [6]. Li-ion batteries can store more energy than nickel-cadmium (Ni-Cd) batteries of the same size and weight [7]. However, Liion batteries are susceptible to deep discharge/overcharge, temperature, charge/discharge current. Therefore, in applying lithium-ion batteries, the battery charging system must be well designed to get high battery performance, and long battery life. Battery chargers must have the quality to maximize charging capacity, shorten charging time, and extend battery life [8]. There are some methods for lithium battery charging such ISSN: 2088-8694  Constant current-fuzzy logic algorithm for lithium-ion battery charging (Muhammad Nizam) 927 as constant-current (CC), CC-constant-voltage (CCCV), multi-stage CCCV [9], and five-stage Li-ion battery charger [10]. One of the most used battery charging methods is CCCV [11]. Because of its simplicity and ease of implementation, this approach is frequently used to charge Li-ion batteries [12], [13]. CC and CV are the two modes of operation available. In CC mode, a constant current is constantly delivered to the battery until the terminal voltage reaches a set maximum cut-off voltage. The cut-off voltage on the battery is maintained in CV mode, and the current decreases as the voltage difference between the terminal voltage and the electromotive force (EMF) decreases. The charge will be interrupted when the current reaches a specific value (typically 0.02 C), and the battery will be fully charged. The CC-CV approach, on the other hand, has the drawback of taking a lengthy time in CV mode. Although CC mode charging fills more than 80% of the battery capacity, CV mode charging takes around 50% of the overall charging time [1]. The other downside of this method is that it causes the battery temperature to rise high [14]. Furthermore, this method is not suitable for fast charging since it takes longer to fully charge the battery and reduce battery life [15].
The fuzzy logic control system will be the most extensively utilized control system in the coming years [16]. One of the benefits of a fuzzy logic controller is that it can be used to nonlinear elements without the need to discover a mathematical model; as a result, it may be used in battery charging systems, which are nonlinear elements with complex mathematical models. Therefore, the fuzzy logic controller is a suitable method for efficiency and reducing charging time without finding the detailed mathematical model [17]. Furthermore, Asadi et al. [18] said that using fuzzy logic control in li-ion battery charger can achieve efficiency up to 96.62%, faster, and high protection with lower temperature rise.
A lot of researchers have made use of Fuzzy control in charging algorithms. Passarella et al. [19] use constant current with fuzzy logic in Li-ion battery charging. The fuzzy system uses voltage and temperature as input while pulse width modulation (PWM) is output. The experiment shows that the fuzzy method can work well. However, their proposed algorithm is not compared to another one, so the improvement is unclear. Cheng et al. [20] use fuzzy logic as temperature control in a Li-ion battery charger. They use the temperature and temperature changes of the battery as fuzzy input. The experimental study concludes that the use of fuzzy logic can reduce temperature rise by 23.2% compared to the CC-CV method with a longer charging time. On the other hand, their method also uses a computer to calculate the fuzzy logic computation, which makes the charger unable to work without the computer. Ali and Nizam [21] compare the fuzzy logic method and the CC-CV method to charge a Li-ion battery. Using delta current, delta voltage, and delta temperature as fuzzy input, they conclude that fuzzy logic can accelerate the charging time up to 37.8% at a rate of 2 C. Finally, Ali et al. [22] propose a fast-charging method for li-ion battery using fuzzy logic. The input of the fuzzy system is the lowest voltage and the highest voltage of three serial Li-ion batteries. The experimental study concludes that the proposed method can achieve a 9.76% reduction in charging time compared to the conventional way.
This paper proposes a dual-mode charging system with a CC-fuzzy logic algorithm for Li-ion batteries. The dual-mode means that the charger can be used when the battery voltage capacity is lower than the supply voltage (buck mode) and when the battery voltage capacity is higher than the supply voltage (boost mode). The fuzzy logic replaces the CV mode in the conventional CC-CV method. The contribution of this research is the use of the CC-fuzzy method to accelerate the charging time and maintain the charging temperature under the limit. This proposed algorithm is beneficial for fast charging applications in an electric vehicle.

THEORETICAL BASIS 2.1. Lithium-ion battery
The Li-ion battery is one type of battery widely used in electric vehicles and electronic devices today. Among the existing battery technologies, lithium-ion is considered a suitable choice for the development of electric vehicle technology [23]- [25]. Li-ion batteries have advantages over other types which can be seen in Table 1. When compared to other types of batteries such as lead-acid batteries, Ni-Cd batteries, and nickelmetal hydride (Ni-MH) batteries, Li-ion batteries have a higher energy efficiency and density, allowing them to be built lighter and smaller in weight and size. In addition, lithium-ion batteries offer a wide operating temperature range, quick charging capability, no memory effect, a relatively long cycle life, and a low selfdischarge rate [26]. Table 2 resumes the specification of the lithium-ion battery used in this research.

Buck-boost converter charger
The buck-boost converter charger design starts with determining the parameters to be used, then calculates the value of the components. Table 3 shows the design specification of the proposed charger. The minimum value of the inductor (LMIN) used in the buck and boost converter are calculated using (1) and (2), respectively [27]. Where D, f, R, are duty cycle, frequency, and resistor value, respectively. In the buck-boost converter, the capacitor is used to filter the voltage ripple output. The target ripple value is 0.1 V, based on the  (3) and (4) are used to calculate the minimum capacitor (CMIN) value in buck and boost mode, respectively [27].

PROPOSED METHOD 3.1. Fuzzy logic control
Fuzzy logic control is a control method which follow linguistic approach, if-then rules [29]; therefore, it is simple and easy to understand [30]. In this research, the fuzzy controller has 2 inputs, and 1 output. The 2 inputs consist of battery temperature and battery temperature change, depicted in Figures 1(a) and (b). The determination of the battery temperature membership limit is based on the datasheet. In comparison, battery temperature changes are obtained from system testing. At the same time, the output is the PWM value of both buck and boost, depicted in Figures 2(a) and (b). The membership of PWM value is divided into two, namely the PWM boost value and the PWM buck value. The PWM is in 8 bits formats with values between 0-255. Each of them has 3 linguistic attributes, namely small, moderate, and big. Whereas the value is determined based on trial in the simulation stage. The rule base design is shown in Table 4. This rule base is used for both buck and boost mode since it only depends on the temperature.

Battery sensor
The current sensor, voltage sensor, and temperature sensor are the three sensors that are used. The current sensor utilized is the ACS712-05 A, which can read a maximum current of 5 A with sensitivity of 185 mV/A. This current sensor measures the battery charge current and provides feedback to the buck-boost converter. Figure 3 depicts the current sensor circuit. A voltage divider circuit is used to create the voltage sensor. This voltage sensor has two functions: one is to determine the battery voltage/charge state and the other is to determine the charging voltage. Charging is interrupted every 5 minutes to obtain battery voltage data. The charger system receives data from this sensor reading. Figure 4 shows the voltage sensor circuit. Figure 5 depicts the temperature sensor circuit. The DS18B20 temperature sensor was utilized. This sensor offers a high level of accuracy, with a temperature range of -10 °C to + 85 °C and an accuracy of 0.5 °C. This temperature sensor also monitors the temperature of the battery, which is used as a fuzzy input.  Figure 6 shows the block diagram of the proposed battery charger system. The system is designed for charging 2 series (buck mode) or 4 series (boost mode) batteries. The battery charging system designed in this study is equipped with an organic light-emitting diode (OLED) display. This OLED screen functions as a data display for battery voltage, charging voltage, charging current, and battery temperature. The data were taken through the Arduino IDE serial monitor when connected to a laptop. The battery charging system uses the constant current-fuzzy control method. The program starts working by reading all the sensors: voltage, temperature, and current sensors. The microcontroller uses the results of the voltage sensor readings to determine the amount of charging voltage. If the voltage is less than 14.4 V, the buck converter will active with the charging voltage between 7.6-8.5 V. On the other side, when the initial battery voltage is higher than 14.4 V, the boost converter will be activated, and the charging voltage is between 15.22-16.9 V. Charging will enter constant current mode first, which is by stabilizing the charging current with feedback in the form of current reading. Then the program will stop charging every 5 minutes to find out the battery voltage, when the battery state of charge (SoC) has been detected 80%, the charging changes to fuzzy control mode. The SoC 80% of two and four serries batteries are 8.2 V and 16.4 V, respectively. The program will also stop every 5 minutes at this stage to find out the voltage from the battery, when the battery is full the program will stop charging. If there is a temperature change of more than 3 ℃, the charging mode will switch to fuzzy mode. The flow diagram of the battery charging system is shown in Figure 7.

RESULTS AND DISCUSSION 4.1. Simulation testing
The simulation test is carried out by varying the input duty cycle with an increase of every 10% so that the output voltage can vary. The aim is to test whether the buck-boost converter can work properly. Figure 8 is a simulation circuit. The simulation result is resumed in Table 5. It is clearly shown that both boost and buck mode can work well.

Hardware testing
Several tests were carried out in hardware testing: sensor accuracy and sensor precision, buck-boost testing, and charging test of 2 and 4 series batteries. The circuit board after assembly and testing is shown in Figure 9; part A is the battery charger, part B is the power supply 12 V, part C is the battery, and part D is the temperature sensor. The hardware testing is done to validate the performance of the proposed algorithm in real applications.  Figure 9. Battery charging circuit and testing

Sensor accuracy and precision
Accuracy testing is done to assess the value of the error and the voltage sensor's accuracy. The root mean square error (RMSE) represents the amount of precision. The lower the RMSE score, the higher the accuracy level. The mean relative standard deviation (MRSD) of repeatability is used to represent test precision. The higher the precision, the lower the coefficient of variation after repeatability. Figure 10 shows the accuracy of voltage sensor which compared to voltmeter. The percentage of the voltage sensor reading error value against the voltmeter is not constant but does not exceed 0.8% and has an RMSE value of 0.068% so it can be concluded that the sensor has an accuracy value of 99.932%. Table 6 shows the result of the precision test. From fifteen measurements, the standard deviation (SD) is only 0.060 with an MRSD of 0.336% it can be concluded that the precision of the sensor is 99.664%.

Buck-boost testing
This test is divided into two stages which are buck mode and boost mode and is carried out by varying the input duty cycle so that the output voltage is varied. This test is carried out by providing a 330 Ω resistance; hence, the output voltage can be measured. The testing result of boost mode is shown in Table 7. The smallest output voltage is 11.67 V when the duty cycle is 0% and the largest output voltage is 42.9 V when the duty cycle is 70%. After the duty cycle exceeds 70% the output voltage will drop, and the MOSFET will heat; this indicates the maximum voltage at 70% duty cycle. The output voltage will increase along with the increase in the duty cycle. The lowest efficiency is 68.45% at 60% duty cycle, and the greatest efficiency is 94.75% at 70% duty cycle. Table 8 shows the result of buck mode. In this mode, the system can work well and reach a duty cycle of 90% with a voltage output of 3.02 V and an efficiency of 25%.

Charging two series batteries
The test for charging 2 series batteries is carried out to know the performance of the proposed charger system if the voltage of the battery charged is below the power supply voltage. In this case, the charger act as a buck converter. Both methods, CCCV, and CC-fuzzy control, are tested and compared.
The charging process of the CCCV method can be seen in Figure 11, with an initial battery voltage of 7.43 V and an initial temperature of 30.5 ℃. Charging starts with CC mode until the battery voltage reaches 8.2 V (SoC 80%), then continues with CV mode until the battery voltage reaches 8.4 V (SoC 100%). In the CC mode, the duty cycle generated by the system decreases during charging, this causes the charging voltage to increase while the charging current remains constant. In the CV mode, the resulting duty cycle of the system increases during charging this is due to stabilizing the voltage when the charging current decreases. Charging times in CC mode and CV modes are 25 minutes and 15 minutes, respectively. Therefore, the total charging time is 40 minutes. The highest battery temperature reaches are 34 ℃ when in CC mode and decrease when it enters CV mode because the charging current decreases as the battery voltage increases.
The graph of the charging process using the CC-fuzzy method can be seen in Figure 12 with an initial battery voltage of 7.43 V and an initial temperature of 30.5 ℃. Charging starts with CC mode until the battery voltage reaches 8.2 V (SoC 80%) or the battery temperature changes more than 3 ℃ then it will be continued with fuzzy control mode until the battery voltage reaches 8.4 V (SoC 100%). In the fuzzy control mode, the duty cycle generated by the system during charging drops, this is caused by the battery temperature still being

Charging four series batteries
The charging test for 4 series batteries is to know the performance of the proposed charger system in the boost mode or when the voltage of the charged battery is higher than the supply voltage. The charging process using the CCCV method can be seen in Figure 13, with an initial battery voltage of 14.81 V and an initial battery temperature of 29.5 ℃. In Figure 13 when the CC mode, the duty cycle generated by the system is constant at 50%, this is due to the algorithm that does not allow a duty cycle of more than 50%. The charging current is only constant at a maximum of 2 A when the charging voltage increases during CC mode. In the CV mode, the resulting duty cycle of the system drops due to stabilizing the voltage when the charging current decreases. Charging time in CC mode is 30 minutes, CV mode is 10 minutes, and the total charging time is 40 minutes. The battery temperature continues to rise during CC mode and reaches a top temperature of 32 ℃ during CV mode. Figure 14 shows the graph of the charging process using the CC fuzzy method with the initial battery voltage of 14.78 V and the initial temperature of the battery 29.5 ℃. Charging starts with CC mode until the battery voltage reaches 16.4 V (SoC 80%) or the battery temperature changes more than 3 ℃ then it will be continued with fuzzy control mode until the battery voltage reaches 16.8 V (SoC 100%). In the CC mode, the duty cycle produced by the system is ± 50%, the duty cycle decreases when the charging current reaches 2.24 A. In a fuzzy control mode, the resulting duty cycle of the system drops to 47.3% so that the charging current decreased to 1.6 A. Charging time in CC mode for 30 minutes and fuzzy control mode for 5 minutes. So that the total charging time is 35 minutes. The battery temperature continues to increase during CC mode

Constant current constant voltage and constant current-fuzzy comparison
The experimental testing using both methods, CCCV and CC-fuzzy, has been done in both two and four-series batteries. In this section, the charger parameters of each method are compared in one graph to clearly see the differences, Figure 15. Figures 15(a) and 15(b) show the battery charging voltage. It is seen that, after reaching 80% SoC, the CC mode is ended. Entering the CV mode, the voltage decreases and become constant. On the other side, in fuzzy mode, the voltage still increases based on the battery temperature. Figures 15(c) and 15(d) depict the battery charging current. It shows that in CC mode, the charger can maintain constant current. Entering the second mode, in CV mode, the current is decreased. Whereas, in fuzzy mode, the current increases in two series batteries and decreases in four series batteries. This pattern is different due to the fuzzy input condition different which is based on the battery temperature. Figures 15(e) and 15(f) for battery voltage graph. It is seen that for both battery configurations, CC-fuzzy is faster to charge the battery fully. In the CCCV method, the time needed to charge 2 and 4 series batteries is the same as 40 minutes. Compared with the CCCV method, the CC-fuzzy control method charges 10 minutes faster for 2 series batteries and 5 minutes faster for 4 series batteries. The last parameters are temperature shown in Figures 15(g) and 15(h). It informs that the battery temperature is nearly the same for both methods; the difference is only small, which is 0.5℃ in the first battery configuration. The comparison analysis showed that the proposed algorithm has contributed to reducing the charging time of the traditional CCCV method. Whereas, in the charger configuration, the use of buckboost converter configuration makes the charger can be used to charge the battery configuration below and upper the charging supply voltage.

CONCLUSION
The proposed charger system with the CC-fuzzy control method was successfully developed and tested. The test was carried out both in simulation and hardware implementation. The temperature sensor was used to measure the battery temperature used as a fuzzy control input so that the battery temperature was kept within safe limits. The proposed charger system was dual-mode which can be operated in buck mode and boost mode. The buck mode was used to charge the battery with voltage lower than the power supply and vice versa. The experimental result showed that the proposed method was superior to the CCCV method in charging time. The CC-fuzzy method charging time was faster than the CCCV method by 25% and 12.5% in buck and boost modes, respectively.