As electric vehicles and portable power applications grow rapidly, I found the need to develop a robust energy management system for power lithium-ion battery packs increasingly critical. In this work, I present a comprehensive design framework for a power Li-ion battery management system applied to an EV battery pack. I first investigate the accurate estimation of state-of-charge (SOC) for lithium-ion batteries, considering multiple compensation techniques for charge-discharge efficiency, cycle life, and temperature. I then describe a hardware implementation based on the PIC18F452 microcontroller, which includes voltage sampling, current sensing, temperature monitoring, display interfaces, protection circuits, and cell equalization modules. Based on experimental results from a seven-cell series-connected lithium-ion battery pack, I demonstrate the feasibility of the proposed SOC estimation strategy, the effectiveness of the equalization scheme, and the overall reliability of the protection circuits. My results confirm that the proposed energy management system can greatly enhance the safety, reliability, and useful lifetime of an EV battery pack when deployed in practical operating conditions.
1 Introduction and Background
The rapid development of new energy vehicles and mobile devices has placed increasing demands on battery technologies that offer high energy density, long cycle life, and environmental compatibility. Among the candidate battery chemistries, the power lithium-ion battery has become one of the most promising technologies since it was successfully commercialized. Compared with nickel-metal hydride, lead-acid, and nickel-cadmium batteries, the power lithium-ion battery offers significant advantages such as higher working voltage, higher specific energy, longer cycle life, no memory effect, lower self-discharge rate, and better environmental friendliness. These characteristics make lithium-ion systems the preferred choice for an EV battery pack in electric vehicles and other high-power applications.
The global power battery market has evolved considerably over the past two decades. Valve-regulated lead-acid batteries were the earliest candidates for electric vehicle traction due to their low cost and mature production technology. However, their low specific energy and large volume limit the driving range of electric vehicles. Nickel-metal hydride batteries then gained attention due to their higher specific power and improved low-temperature performance, yet their relatively high cost restricted wide-scale deployment. Fuel cells offer high conversion efficiency and zero local emissions, but hydrogen storage and distribution remain significant barriers for commercial adoption. Among these technologies, the lithium-ion battery has emerged as the leading candidate for future EV battery pack development, especially with the progress in cathode materials such as LiFePO₄ that enhance safety and cycle stability.
Despite these advantages, the practical application of a large-format EV battery pack still faces several critical challenges. First, lithium-ion cells are highly sensitive to overcharging and over-discharging, which may lead to electrolyte decomposition, internal pressure build-up, thermal runaway, fire, or even explosion. Second, because cells in a series-connected EV battery pack cannot be perfectly identical due to manufacturing tolerances and operating history, voltage imbalance tends to accumulate over repeated charge-discharge cycling, causing some cells to become overcharged while others remain undercharged. This imbalance eventually degrades the capacity of the weakest cell and shortens the service life of the whole pack. Third, accurate prediction of the remaining capacity of an EV battery pack is inherently difficult since the battery’s electrochemical behavior is non-linear, time-varying, and affected by many external factors. These challenges drove me to design a dedicated energy management system that can monitor the pack in real time, protect it from out-of-range conditions, balance cell voltages during charging, and provide reliable SOC indication.
Many commercially available battery management integrated circuits exist today for small-format consumer applications, such as those from Texas Instruments, Microchip, and Intersil. These chips typically integrate protection functions, gas gauging, and communication interfaces. However, they are generally intended for packs with only a few cells and limited flexibility. For an EV battery pack that requires higher voltage, higher current, and more intelligent control strategies, a microcontroller-based energy management system is often required. In my system I chose the PIC18F452 microcontroller because of its rich peripheral set, on-chip 10-bit ADC, low-power capabilities, and easy integration. This microcontroller provided adequate processing power to gather battery parameters, execute SOC algorithms, manage display functions, and interact with external protection circuitry.
2 SOC Estimation for Power Lithium-ion Batteries
2.1 Definition of Remaining Capacity and SOC
The state-of-charge (SOC) is one of the most important indicators for evaluating the remaining energy of an EV battery pack. It cannot be directly measured by a sensor; instead, it must be inferred from measurable quantities such as terminal voltage, current, temperature, and internal impedance. The SOC value informs both the user and the controller about how much energy remains in the battery before the next recharge is needed, thus enabling more intelligent energy management.
From an electrical-energy perspective, I define the SOC as the ratio of the remaining chargeable capacity to the total capacity available under a specified constant discharge current:
$$SOC = \frac{Q_c}{C_I}$$
Here, \(Q_c\) represents the remaining capacity in ampere-hours deliverable by the battery under a constant discharge current \(I\), and \(C_I\) represents the total capacity that the battery can deliver under the same constant discharge current. Alternatively, based on the already delivered charge \(Q\), the SOC can be written as:
$$SOC = 1 – \frac{Q}{C_I}$$
In this expression, SOC = 1 corresponds to the fully charged state, while SOC = 0 corresponds to full discharge up to the cut-off voltage. This conventional definition, however, has limitations under variable current conditions. If an EV battery pack is first discharged to the cut-off voltage with a large current, the SOC defined above would appear to be zero, yet the battery may still deliver additional charge when discharged with a smaller current. This is because the effective capacity changes with discharge rate and temperature. Therefore, the SOC definition must be supplemented with appropriate corrections to handle practical dynamic operating conditions.
2.2 Factors Influencing Remaining Capacity
Several key factors affect the remaining capacity of a lithium-ion battery in an EV battery pack. I identified the following major influences:
- Discharge current: A higher discharge current causes greater internal losses and lower conversion efficiency from stored chemical energy to electrical energy. Consequently, the usable capacity at high discharge rates is lower than at low discharge rates.
- Temperature: At higher temperatures, the electrochemical activity inside the battery improves, allowing more active material to participate in the reaction and thus increasing the total dischargeable capacity. Conversely, at low temperatures or under high-rate discharge, the available capacity decreases significantly.
- Self-discharge rate: Lithium-ion batteries self-discharge at about 3% to 9% per month at room temperature, which is much lower than nickel-cadmium batteries (25% to 30% per month) and nickel-metal hydride batteries (30% to 35% per month). Self-discharge depends markedly on the storage temperature.
- Cycle life: The battery capacity gradually fades with every charge-discharge cycle, which is commonly quantified by lifetime tests. Typically, a lithium-ion battery reaches the end of life when its capacity drops to 80% of the initial rated value, usually after 300 to 500 cycles, depending on operating conditions.
- Charge-discharge efficiency: During fast charging or discharging, irreversible losses occur due to internal resistance and polarization effects. The efficiency is not unity and must be considered for accurate coulomb counting.
Because these factors are dynamic and vary over the lifetime of an EV battery pack, the SOC estimation algorithm must be robust enough to adapt to changing conditions. Ignoring any of these factors tends to accumulate errors over time and reduces the SOC accuracy.
2.3 Comparison of Common SOC Estimation Methods
Various SOC estimation methods have been developed in the literature. I compared them in terms of principle, accuracy, on-line capability, and implementation complexity, and summarized the comparison in Table 1.
| Method | Principle | Advantages | Disadvantages | Typical Application |
|---|---|---|---|---|
| Discharge test method | Continuous small-current discharge to measure delivered charge | Most accurate and reliable | Time-consuming; battery must be off-line | Laboratory testing, battery maintenance |
| Ampere-hour counting | Integrates charge/discharge current over time | Simple implementation; universal | Accuracy depends on initial SOC and measurement precision | Real-time on-line monitoring |
| Open-circuit voltage method | Establishes SOC-OCV relationship and measures stable open-circuit voltage | Good for initial SOC or at the end of charging/discharging | Requires long rest time; not suitable for dynamic conditions | Initial SOC determination |
| Internal resistance method | Uses correspondence between internal impedance and SOC | Good accuracy in the later discharge stage | Difficult to measure accurately early in discharge | Usually combined with other methods |
| Kalman filter method | Integrates voltage-current data with state-space model using recursive estimation | Real-time recursion; good noise handling | High computational burden; complex model | Highly dynamic EV battery pack operation |
2.4 SOC Estimation Strategy Adopted in This Work
After analyzing the strengths and weaknesses of the various methods, I chose a hybrid approach for my EV battery pack energy management system. The proposed method combines ampere-hour counting with the open-circuit voltage method and incorporates corrections for charge-discharge efficiency, temperature, cycle life, and the incomplete self-recovery effect after the battery stops operating.
The overall SOC value in my system is divided into two parts. The first part is the initial SOC value \(SOC_0\), which is determined when the EV battery pack transitions from an open-circuit state to an operating state. If the battery has rested sufficiently so that its open-circuit voltage is stable, I obtain \(SOC_0\) from a pre-established OCV-SOC relationship curve. Otherwise, if the battery has not yet reached a stable voltage due to the self-recovery effect, the previous termination SOC from the last charge-discharge session is used as the starting value. The second part is the accumulated charge or discharge amount normalized by the battery rated capacity, which is obtained through real-time current integration during operation.
I formulate the SOC estimation model as:
$$Q(t) = \int_{0}^{t} \eta\, i(\tau) \, d\tau$$
and
$$SOC(t) = K_0 SOC_0 + (1 – K_0) SOC_0′ + K_t K_c \frac{Q(t)}{Q_N}$$
In these equations, \(Q_N\) is the rated capacity of the EV battery pack in ampere-hours; \(Q(t)\) is the accumulated charge or discharge capacity at time \(t\), which is positive during charging and negative during discharging; \(i(t)\) is the real-time current; \(\eta\) is the charge-discharge efficiency correction factor; \(SOC_0\) is the initial SOC determined from the open-circuit voltage; \(SOC_0’\) is the stored SOC value from the termination of the previous operation; \(K_t\) is the temperature correction coefficient (set to 1 at room temperature); \(K_c\) is the cycle-life correction coefficient; and \(K_0\) is a coefficient indicating whether the open-circuit voltage has stabilized: \(K_0 = 1\) when the battery is stable or \(K_0 = 0\) when the battery is still in the self-recovery state.
For variable current discharge, I discretize the current-time curve into small constant-current intervals with width \(\Delta t\) equal to the current sampling period. At the \(k\)-th sampling interval, the incremental capacity is determined as:
$$Q_k = Q_{k-1} + i_k \Delta t$$
where \(i_k\) is the sampled current at the \(k\)-th interval. After calculating the total discharged capacity from the integral of an arbitrary current profile, I convert this value to the equivalent capacity at the nominal constant current rate. Since the influence of current magnitude on capacity is reversible, the conversion can be made without considering the details of the current variation path.
By considering self-recovery effects, the proposed method overcomes the weakness of conventional ampere-hour counting methods that treat the terminal of discharge as the sole starting point for the future SOC. In an EV battery pack, where current can vary dramatically with acceleration, braking, and road conditions, this improvement significantly enhances SOC estimation accuracy.
3 Hardware Design of the Energy Management System
3.1 Overall Hardware Architecture
The hardware architecture of my energy management system centers on the PIC18F452 microcontroller. The main functions include acquisition of the battery pack total voltage, charge-discharge current, cell voltages, and temperatures; process control; protection of the pack against overcharge, over-discharge, over-current, and short-circuit conditions; execution of a charge equalization scheme; communication through an RS-232 or I²C interface; and a user interface composed of a keyboard and LED displays. The system is powered directly from the EV battery pack itself, eliminating the need for an external power source in the targeted application.
Figure 1 shows a typical power lithium-ion battery pack configuration that I used to design the energy management system and to perform my validation experiments.

3.2 Microcontroller and Peripheral Circuits
PIC18F452 is a high-performance RISC architecture microcontroller from Microchip Technology. It contains 32 kbytes of flash program memory and 256 bytes of EEPROM data memory, so no external memory expansion is needed. Since the instruction bus is 16 bits wide while the data bus is 8 bits, most instructions execute in a single cycle, and with an external 8 MHz crystal oscillator, the instruction cycle period is about 0.5 μs. This is sufficiently fast for on-line monitoring of an EV battery pack under realistic dynamic operating conditions.
The controller hosts 17 interrupt sources, a watchdog timer, low-voltage detection, and a synchronous serial port that supports SPI and I²C communication. Its 10-bit analog-to-digital converter offers a resolution of about 20 mV when the reference voltage is +5 V, which is adequate for the battery voltage measurement range in my application. The peripheral circuits include power supply decoupling near the VDD and VSS pins, an external reset circuit connected to the MCLR pin, capacitors at the oscillator pins for stable oscillation, and pin assignments for each functional module. Port RA0, RA1, and RA2 receive the total voltage, current, and cell voltage signals respectively; Port RB4 through RB7 connect to the active-low input switches; Port RC3 through RC5 connect to the MAX7219 display driver; and Port RC6 connects to the DS18B20 temperature sensor.
3.3 Power Supply Design
The power supply section converts the EV battery pack voltage to stable levels necessary for the microcontroller and the analog processing circuits. Since the pack may have a nominal voltage around 25.9 V in my configuration, I deployed three-terminal linear regulators. The LM7805 provides a stable +5 V supply for the microcontroller and the digital logic circuits. The LM7812 provides +12 V for the operational amplifiers in the current-conditioning circuit. To obtain the negative supply rail required by the LM324, I used the ICL7662 DC-DC converter to invert the +12 V rail to -12 V. This power architecture was straightforward, economical, and adequate for the prototype system. In future designs, a more efficient DC-DC converter could be used to reduce heat generation and prevent the slight imbalance caused by drawing power from the battery pack.
3.4 Voltage Measurement Circuits
For the total voltage of the EV battery pack, I used a precision resistor divider to scale the pack voltage down into the 0 to 5 V range suitable for the microcontroller ADC. The resistors have 0.1% tolerance so the scaling factor could be predicted with good accuracy. The total voltage range for a seven-cell lithium-ion pack is about 21 V to 29.4 V; the divider scales it into the permissible ADC input range.
Individual cell voltage measurement is essential for cell protection and equalization in a series-connected EV battery pack. I designed a sampling circuit using one LM358 operational amplifier and one P-channel MOSFET per cell. The circuit operates as a level-shifting amplifier. When power is initially applied, the inverting input is higher than the non-inverting input, causing the op-amp output to be low. This turns on the P-channel MOSFET because the source-to-gate voltage exceeds the threshold. As the MOSFET conducts, the voltage at the inverting input drops until the op-amp reaches a balanced state. At balance, the non-inverting input equals the inverting input, and the voltage across R1 equals the cell voltage. If R1 and R3 have identical resistance, the voltage across R3 equals the cell voltage. The negative terminal of the monitored cell must be higher than half the positive cell voltage so that the MOSFET can remain in its linear region. This condition can be satisfied when at least two series-connected cells are used. For each cell in my EV battery pack, a dedicated voltage sampling channel was implemented, and the output signal was routed to the sample-and-hold ADC input.
3.5 Current Measurement Circuit
Current measurement for an EV battery pack must detect currents in both charging and discharging directions. I chose the classical low-side series sensing approach since the expected current in my prototype was moderate. A precision 1 Ω/5 W shunt resistor converts the current to a voltage drop. However, since the voltage drop is very small and since the microcontroller can only digitize positive voltages, I needed additional conditioning circuitry.
I designed the current-sensing circuit around an LM324 operational amplifier configured as a precision absolute-value amplifier. In the discharge case, the voltage drop across the shunt is positive and is buffered by the first amplifier stage; in the charging case, the shunt voltage is negative and the second stage produces the absolute value. The circuit amplifies the signal by a factor of five, as shown by the relation:
$$V_o = 5\,|V_i|$$
This circuitry maps both the positive and negative current signals into the unipolar 0 to +5 V range of the microcontroller ADC while also amplifying small signals so that their quantization error remains small. The overall current measurement accuracy in the implemented design was sufficient to keep the SOC estimation error within acceptable bounds.
3.6 Temperature Measurement Circuit
Temperature is one of the critical inputs required to estimate SOC accurately and to manage the safety of an EV battery pack. I used the DALLAS DS18B20 digital temperature sensor. The DS18B20 is a single-bus digital sensor with a measurement range of -55 °C to +125 °C and a user-selectable resolution from 9 to 12 bits. At 12-bit resolution, the temperature resolution is 0.0625 °C, which is more than sufficient for battery thermal management. It requires no external analog conditioning components, and multiple DS18B20 sensors can be connected on the same data line.
In my circuit, I powered the DS18B20 using the external power supply mode rather than parasitic power to improve measurement stability. The DQ data line was connected to Port RC6 with a 4.7 kΩ pull-up resistor. The sensor housing was placed in close contact with the battery cell to sense the temperature accurately.
3.7 Display Circuitry
For the user interface, I implemented two types of display: a digital readout using an LED seven-segment display, and a simple bar-graph LED indicator for remaining capacity.
The digital display is driven by the MAX7219 LED display driver chip. The MAX7219 is a serial-input/common-cathode display driver that can drive up to eight seven-segment digits and includes an on-chip BCD decoder, multiplexing scan circuitry, segment drivers, and digit drivers, along with 8×8 static RAM to store display data. It communicates with the microcontroller over a three-wire serial interface using the data input (DIN), clock (CLK), and load enable (LOAD) signals. In my design, the MAX7219 was used to drive four seven-segment displays, which is sufficient to show voltage, current, temperature, or SOC values. A 10 μF capacitor was placed across the V+ and GND pins to filter power-supply noise and avoid display flicker caused by current spikes.
I also implemented a low-cost LED bar display that directly represents the remaining capacity in four steps of 25%. The LEDs light up based on the pack’s open-circuit or operating voltage thresholds of 12.26 V, 14.44 V, 15.15 V, and 15.92 V for 25%, 50%, 75%, and 100% states of charge. This display circuit uses an LM339 comparator, a TL431 programmable reference, and a P-MOSFET switching arrangement. A push-button switch activates the LED display; upon releasing it, a delay capacitor and discharge resistor keep the circuit active for approximately 2 s so the user can comfortably observe the state of charge before the LEDs switch off.
3.8 Keyboard Circuit
I used independent push-button keys as the input interface because only a few commands are needed. The keyboard comprises four buttons K1 through K4 connected between the microcontroller pins RB4-RB7 and ground. Pull-up resistors ensure a high level when the key is open. When the user presses a button, the corresponding pin goes low. Software debounces the mechanical contact using a 10 ms delay and a second read to ensure that the detected press is intentional rather than a transient bounce. Pressing K1 displays the total pack voltage; pressing K2 displays the charge-discharge current; pressing K3 displays the temperature; and pressing K4 returns to displaying the SOC. The default display mode after power-on or reset is the SOC percentage.
4 Protection Circuit Design for the EV Battery Pack
4.1 Protection Requirements
For any lithium-ion based EV battery pack, over-voltage, under-voltage, over-current, and short-circuit protections are mandatory. Lithium-ion cells can be permanently damaged if charged above approximately 4.2 V because excessive voltage causes electrolyte decomposition and gas generation. Similarly, discharging below about 2.3 V can dissolve the copper current collector and create internal short circuits. Over-discharge also reduces the number of charge cycles the cell can sustain.
The protection requirements that I implemented for the prototype EV battery pack are listed in Table 2.
| Protection Function | Threshold | Delay |
|---|---|---|
| Overcharge detection | 4.28 ± 0.025 V per cell | < 1.3 s |
| Over-discharge detection | 2.3 ± 0.05 V per cell | < 150 ms |
| Over-current detection | 5 A ± 10% | < 10 ms |
| Short-circuit detection | > 1.2 V across sense resistor | < 3 ms |
| Normal charging voltage | < 17 V for four-cell stack | — |
| Quiescent current during normal mode | < 7 μA | — |
| Quiescent current during over-discharge latch | < 20 μA | — |
4.2 Protection IC S-8261 and Circuit Description
In my protection design, I used the S-8261, a single-cell lithium-ion/polymer battery protection IC from Seiko Instruments. The chip integrates a precision high-voltage detection circuit, delay circuits, logic control, and an over-current detection circuit. Since one S-8261 protects a single lithium-ion cell, I stacked four S-8261 ICs for a four-cell series configuration. The design can be extended to ten or more cells by replicating the same cell-level circuit.
The S-8261 provides two output pins: the CO (charge control) output and DO (discharge control) output. When the battery voltage is in the normal operating range, the CO output is at a high level and the DO output is at a high level. During overcharge, the CO output switches low; during over-discharge or over-current conditions, the DO output switches low. These signals are isolated through optocouplers and used to drive external P-channel power MOSFETs that interrupt the charge or discharge current path.
4.3 Protection Operation
The protection circuit is separated into a charge MOSFET and a discharge MOSFET so that overcurrent events during charging and during discharging can each be handled independently. During normal charging, all CO outputs from the S-8261 ICs are high, so the charge-control MOSFET Q5 remains on. Once the voltage of any cell reaches 4.28 V, the corresponding CO output goes low, causing the second column of optocouplers in the circuit to conduct. This pulls the gate of the charge MOSFET to ground, turning it off and interrupting the charging current. Since the body diode of the P-channel MOSFET is oriented to permit discharging, the battery can still discharge through the body diode after an overcharge protection event.
During normal discharging, all DO outputs are high. The first column of optocouplers conducts, and the output signal is processed through a NAND gate network to keep the discharge MOSFET in the on state. If any cell voltage drops below 2.3 V, the corresponding DO pin goes low, which turns off the first column of optocouplers. A NAND-gate latch circuit then pulls the gate of the discharge MOSFET low, so the discharge path is interrupted. The body diode of the discharge MOSFET is oriented so that the battery can still be charged even when the over-discharge protection is active.
For over-current and short-circuit protection, the fourth S-8261 IC monitors the voltage across a low-value sense resistor in the main current path. When the voltage drop exceeds 1.2 V, the IC interprets the situation as a short-circuit load and immediately toggles its DO output, thereby switching off the discharge MOSFET. The delay is very short to protect the battery from high fault currents.
I specifically added a latch circuit using the CD4011 NAND gate to prevent the oscillation between zero-voltage and recovery-voltage conditions that may occur when a battery experiences a transient voltage drop followed by voltage rebound. This latch holds the discharge MOSFET off after an over-discharge event until the load is physically disconnected. As a result, the MOSFET does not continually switch on and off near the end-of-discharge voltage, which would otherwise produce unnecessary switching losses and heating.
5 Design of the Charge Equalization Circuit
Series-connected cells in an EV battery pack inevitably have slight differences in capacity, initial state-of-charge, internal resistance, and self-discharge rate. If left uncorrected, even tiny discrepancies can grow with cycling and gradually limit the usable capacity of the entire battery pack. Therefore, charge equalization is essential in a practical energy management system. Equalization methods for series-connected battery packs can be classified into energy-consuming types and energy-non-consuming types. I compared the two main families in Table 3.
| Category | Approach | Advantages | Disadvantages |
|---|---|---|---|
| Energy-consuming equalization | Resistance bypass or linear shunt | Simple circuitry, low cost, easy to expand | Wastes energy as heat; limited equalizing current |
| Capacitor-based equalization | Switched capacitors transfer charge between adjacent cells | No dissipative losses; moderate complexity | Slower equalization between distant cells; many switches |
| Inductor/transformer-based equalization | DC-DC converter individually connected per cell | Fast equalization and low losses | Complex topology; high cost due to magnetic components |
For my small-to-medium sized prototype EV battery pack, I adopted the simplest energy-consuming method, which is to use the protection IC over-charge signal to drive a discharge resistor directly across each cell during the last phase of charging. In this circuit, the S-8261 IC provides the control signal from its CO output. A P-channel MOSFET (e.g., SI4435) is connected in series with a power resistor of 68 Ω. When the cells undergo normal charging, the CO output has no current-sinking capability, keeping the P-MOSFET off. When the cell voltage reaches the overcharge threshold of 4.275 V, the CO output goes low and turns on the P-MOSFET, so the cell is bypassed by a resistance. The bypass current is approximately:
$$I_{\rm balance} = \frac{4.275}{68} = 64~\mathrm{mA}$$
The power dissipated in the bypass resistor is about:
$$P_{\rm bal} = (0.064)^2 \times 68 \approx 0.28~\mathrm{W}$$
This dissipation is quite small and can be managed easily. When the cell voltage drops below the over-charge release voltage \(V_{\rm DU}\), the CO output returns high, the MOSFET turns off, and the normal charging path resumes. The equalization circuit is connected in parallel to each cell of the series stack, so that each cell can be charged to the desired end voltage without overcharging.
This topology offers a valuable practical benefit. In a conventional series-charged EV battery pack where the charger terminates based on the total voltage or the highest cell voltage, the weaker cells may be undercharged. In my equalization circuit, each cell is individually limited to its own full voltage, so every cell can reach a full state-of-charge and the capacity imbalance does not escalate with repeated cycling. Since the charge equalization circuit in this case is integrated with the S-8261 protection IC, the incremental component count is low, making the solution attractive from a manufacturing standpoint.
6 Software Design of the Energy Management System
6.1 Modular Software Architecture
The firmware for the energy management system was written in PIC assembly language and organized into modular subroutines to facilitate code maintenance and debugging. The main program first performs all required initializations, then repeatedly checks the status of the control buttons, and branches to the appropriate service routines. The battery data acquisition is triggered by two timer interrupts: Timer 0 is used for periodic A/D sampling, while Timer 1 carries out data processing and display updates.
The software modules can be divided into:
- system initialization module;
- analog data acquisition module for voltages and currents;
- DS18B20 temperature sensing module;
- SOC calculation and battery capacity management module;
- keyboard reading and debouncing;
- MAX7219 and LED display drivers.
6.2 Initialization and Main Routine
At power-on, the software initializes all I/O port directions, sets the ADC configuration, configures Timer0 and Timer1, initializes the MAX7219 display driver, and enters an idle or monitoring loop. The main routine begins with a 10 ms delay to allow the power supplies to stabilize, then reads the keyboard states and dispatches to the appropriate display function.
6.3 ADC Sampling Subroutine
The ADC sampling routine reads the voltage and current signals from the three analog input channels. Since the PIC18F452 is powered at 5 V and the ADC reference is set to VDD, the digital output is proportional to the input signal. In order to improve accuracy and reduce noise sensitivity, I averaged eight consecutive ADC samples from each channel before converting the raw representation to engineering values. The processed voltage and current values are saved into two-byte registers, where they can subsequently be used by the SOC algorithm and the display routine.
6.4 Temperature Reading and Processing
DS18B20 communication follows the one-wire protocol. The software performs initialization, then sends a skip ROM command, followed by a start temperature conversion command. After waiting for conversion time, the sensor is initialized again, and the read-scratchpad command is used to transfer the two-byte temperature result back to the microcontroller. The firmware converts this raw value to degrees Celsius and makes it available for the display module and the SOC temperature compensation algorithm.
The delays in the one-wire protocol are critical for correct operation. I tuned the delays for a 8 MHz oscillator by measuring the output signal on an oscilloscope. The reset pulse requires pulling the line low for 490 μs, releasing it for about 60 μs, and then checking the presence pulse within a 240 μs window. Write-zero and write-one time slots are each configured with approximately 65 μs total duration, while the read time slot uses a shorter low period followed by a sampling point after about 12 μs.
6.5 SOC Estimation Algorithm Flow
Figure 2 illustrates the SOC estimation algorithm implemented in my system. The controller first determines the initial SOC. If the battery pack has been at rest and the measured open-circuit voltage is stable, the software maps the voltage to the initial SOC using the OCV-SOC look-up table. If the battery remains in the recovery state, the last saved SOC value is taken as the initial value. During charge and discharge operation, the controller measures current and updates the accumulated ampere-hour count whenever the selected timer interrupt fires. At regular intervals, the software adds the normalized accumulated capacity to the corrected initial SOC to obtain the final SOC. The final SOC is then displayed and stored in EEPROM for the next wake-up session.
The temperature compensation factor \(K_t\) is applied only when the measured temperature differs from the reference temperature of 25 °C. The cycle-life coefficient \(K_c\) is estimated from the overall number of cycles and the measured capacity fade trend of the pack. For implementing the algorithm, I established a battery-capacity model based on experimental measurements and used a look-up table rather than a continuous function for the open-circuit voltage, which simplified the code.
6.6 Display and Keyboard Management
I selected the program-controlled scanning method to read the switches. Since the switch rows are normally at logic low or high depending on the pull-up/pull-down configuration, the software continuously reads the port pins. Upon detecting the press of a key, a 10 ms delay is generated for debouncing; the port is read again to confirm that the key is actually pressed. The display routine writes four bytes to the MAX7219, selecting each of the four seven-segment digits from the internal static RAM location. A separate subroutine drives the bar-graph LED display based on the present SOC value by controlling the LM339 comparator thresholds and the switch timing.
7 Experimental Results and Analysis
7.1 Experimental Setup
To validate the proposed energy management system, I built a prototype EV battery pack consisting of seven series-connected lithium-ion pouch cells. The main parameters of the cells and the pack are listed in Table 4.
| Parameter | Value |
|---|---|
| Cell model | TSE-086760 |
| Rated capacity | 2 Ah |
| Nominal pack voltage | 25.9 V |
| Maximum charge voltage | 29.4 V |
| Discharge cut-off voltage | 21 V |
| Maximum continuous charge current | 2 A |
| Maximum continuous discharge current | 2 A |
| Charging method | CC/CV |
| Ambient test temperature | 21 to 26 °C |
All experiments were carried out at room temperature in the laboratory. I used a dedicated electronic load with various resistor settings for discharge tests and a programmable DC power supply with current-limiting capability for the charging tests. The measured data was recorded via the on-board display and through a serial link when the complete monitor was connected to a personal computer for further analysis.
7.2 Open-Circuit Voltage and SOC Relationship
I measured the relationship between the open-circuit voltage of a single cell and its SOC by repeatedly discharging the cell in small steps at a very low rate of 0.05C (about 100 mA). After each partial discharge, the battery was allowed to rest until its open-circuit voltage reached equilibrium. From the recorded capacity at the moment before the discharge interruption and the final open-circuit voltage, I generated the OCV-SOC calibration curve shown in Figure 2 in the system. The data points were fitted to produce a lookup table from 0% to 100% SOC. This table serves as the reference for the initial SOC determination in the proposed hybrid SOC algorithm. The curve exhibits a plateau between roughly 10% and 90% SOC, which is typical of lithium-ion chemistries and confirms the well-known limitation of estimating SOC solely from voltage in the middle range.
7.3 Constant-Current Charge Test
I adopted the standard constant-current / constant-voltage (CC/CV) charging protocol. The battery pack was first charged with a constant current of 600 mA (0.3C) until the total voltage reached 29.4 V, after which the charger switched to constant-voltage mode. In the CV stage, the current was allowed to taper down; charging was terminated when the current fell below 50 mA. The resulting voltage and current curves are plotted in Figure 3 and Figure 4 of the original monitor data.
The charging process lasted about four hours. In the constant-current stage, the pack voltage and the calculated SOC increased nearly linearly with time. After reaching the 29.4 V limit, the current began to decline while the voltage remained constant. In this CV stage, the SOC curve gradually approached 100%. The behavior of the charge curve confirms the importance of including an accurate overcharge protection mechanism, since the voltage approaches the safety limit at the end of the constant-current phase.
7.4 Constant-Current Discharge Test
To investigate the effect of discharge current on pack capacity, I discharged the fully charged EV battery pack at three rates: 0.2C (400 mA), 0.4C (800 mA), and 0.5C (1000 mA). The discharge cut-off voltage was set to 21 V. The recorded discharge curves for the pack are shown in Figure 5 and Figure 6. I observed that current dramatically affects the depth and rate of voltage decline. At 0.2C, the pack delivered about 1420 mAh; at 0.4C, the delivered capacity was about 1380 mAh; and at 0.5C, the delivered capacity fell further to about 1229 mAh. Thus, the higher discharge current corresponds to a smaller capacity utilization.
The selected experimental values of delivered capacity are summarized in Table 5.
| Discharge Rate | Discharge Current (mA) | Delivered Capacity (mAh) | Time to Cut-off (h) |
|---|---|---|---|
| 0.2C | 400 | 1420 | 3.6 |
| 0.4C | 800 | 1380 | 2.2 |
| 0.5C | 1000 | 1229 | 1.3 |
These results indicate that a conventional rated-capacity based SOC calculation is not enough for precise energy management. The current-dependent correction factor \(\eta\) in my proposed SOC model is therefore necessary when the EV battery pack is discharged under varying load demands.
7.5 Variable-Load Discharge Test
To evaluate operation under more practical dynamic conditions, I connected a 40 Ω resistive load to the fully charged EV battery pack. The pack was discharged continuously through the resistor until the cut-off voltage of 21 V was reached. The voltage curve in Figure 7 shows that the discharge begins with a mild voltage drop, followed by a fairly long quasi-linear zone, and decreases more steeply near the end. The current measured through the 40 Ω resistor remained approximately constant at 0.2 A because the small voltage variation did not significantly change the load current. The SOC curve decreased nearly linearly with time, as expected for an approximately constant current discharge.
This experiment validates the integrated system because it demonstrates stable voltage sensing, robust current sensing, and reliable SOC computation across the full discharge range. During the experiment, the cell protection circuit did not trigger incorrectly, and the equalization circuit successfully prevented any single cell from exceeding the maximum allowable voltage during a subsequent recharge.
7.6 Equalization Circuit Verification
I also tested the equalization circuit in a separate charge experiment using cells with slightly different initial SOCs. The results showed that as the pack approached its fully charged state, the bypass resistors became active for the higher voltage cells, diverting a part of the charging current and allowing the lower voltage cells to continue charging. This reduced the spread in cell voltages significantly. By the end of charge, all cells reached 4.2 to 4.28 V, confirming that the energy-consuming equalization circuit performs its intended function. The small equalization current of about 64 mA is sufficient for this type of moderate-capacity pack in which charging may proceed for several hours.
Conclusion
In this work, I designed, implemented, and experimentally validated an energy management system for a power lithium-ion EV battery pack. The main conclusions derived from the project are summarized as follows.
First, I studied several available SOC estimation approaches and proposed a hybrid strategy that combines the open-circuit voltage method with ampere-hour counting while correcting for temperature, cycle life, and charge-discharge efficiency. The open-circuit voltage method supplies the initial SOC when the EV battery pack is at rest; the ampere-hour counting method updates SOC during operation. The additional correction terms permit more accurate tracking over a wide range of working conditions, including dynamic loads that are common in automotive applications.
Second, the hardware design, built around the PIC18F452 microcontroller, meets the requirements for accurate data acquisition, safe protection, and user interface functionality in a compact and economical way. The data acquisition circuitry was capable of measuring total battery voltage, individual cell voltages, charge-discharge current, and temperature with sufficient precision. The LM358 and LM324-based conditioning circuits successfully scale the signals to the ADC input range. The DS18B20 one-wire sensor provides a stable and accurate temperature measurement for the SOC compensation algorithm.
Third, the protection circuit built with S-8261 protection ICs provides reliable overcharge, over-discharge, over-current, and short-circuit protection. The latch circuit using a NAND gate enhances reliability by enabling the system to hold the discharge MOSFET off until the load is removed. The design is modular and can be easily expanded to systems with a larger number of cells in the EV battery pack.
Fourth, the energy-consuming charge equalization circuit proved effective for maintaining cell voltage balance during charging. The 68 Ω bypass resistor provides an equalization current of approximately 64 mA per cell. While this is not suitable for very large battery packs requiring high equalizing currents, it works well for small-to-medium capacity EV battery pack configurations and provides a low-cost straightforward solution.
Finally, the experiments demonstrated that the system as a whole meets the design targets. Voltage curves, current curves, and SOC curves were presented for constant-current charging, constant-current discharge, and variable-load discharge cases. The delivered capacity varies with the discharge rate, so the proposed SOC model accounts for a rate-correction factor. The successful operation of the protection and equalization circuits was also verified through end-of-charge testing.
The system does have limitations. The power supply drawn directly from the EV battery pack through linear regulators creates a small but continuous drain on the pack, which may affect long-term balance if the pack remains idle. The SOC estimator would also benefit from more sophisticated adaptive filtering methods, such as an extended Kalman filter, to further reduce uncertainty under heavily dynamic load profiles. Moreover, the equalization current in the proposed resistive equalization circuit is small. To address the equalization of high-capacity EV battery packs more effectively, a bidirectional flyback or buck-boost converter based equalizer should be designed in future work.
In summary, the proposed prototype energy management system establishes a solid foundation for the development of more advanced EV battery pack management systems. It successfully addresses the important issues of real-time monitoring, state-of-charge estimation, protection, and charge equalization. The architecture is compact, economical, and readily extensible, providing a practical reference design that can be adapted to future electric-vehicle applications and other large-format lithium-ion battery systems.
