Battery SOC Dynamic Measurement System Based on CAN Bus
2026-04-06 08:49:49··#1
Abstract: Taking the battery management system of fuel cell electric vehicles as an example, a dynamic measurement system for battery SOC based on CAN bus was constructed. The hardware circuit and main software program flowchart of the system are given, and the actual measurement results meet the design requirements. Keywords: CAN bus, nickel-metal hydride battery, dynamic measurement of SOC. The state of charge (SOC) of a battery reflects its remaining capacity. Accurate SOC measurement is a crucial issue in the development of fuel cell electric vehicles (FCEVs). During FCEV operation, large currents can easily cause overcharging (exceeding 80% SOC) or deep discharging (below 20% SOC). The reasonable range for FCEV battery operating SOC is 30%–70%. Therefore, the FCEV control system must monitor the battery's SOC, collecting real-time data on the terminal voltage, temperature, and charging/discharging current of each battery in the battery pack. It should also predict the remaining energy or state of charge of the vehicle's battery and issue an alarm when the battery is too low and needs charging, thereby improving battery life and overall vehicle performance. 1. The State of Charge (SOC) detection method for FCEVs: Under a certain operating state, the remaining capacity of the battery is a function of many parameters, including discharge current, voltage, temperature, and the battery's past charge and discharge history. Therefore, the SOC of a battery cannot be described by a single mathematical equation. FCEVs often use nickel-metal hydride (NiMH) batteries as auxiliary power sources because NiMH batteries have advantages such as high specific energy, high specific power, wide operating temperature range, and high-rate discharge capability. The SOC value of a NiMH battery is related to the magnitude of the discharge current, usually represented by the discharge rate C. The discharge termination voltage (open-circuit voltage) of a NiMH battery differs depending on the discharge rate. The discharge characteristic curve of a NiMH battery is shown in Figure 1. As can be seen from the figure, the higher the discharge rate, the lower the initial discharge voltage, and the greater the amount of electricity the battery can discharge. Figure 1 shows the discharge characteristic curve of a nickel-metal hydride (NiMH) battery. The higher the discharge rate, the higher the open-circuit voltage (the termination voltage) after discharge. The open-circuit voltage of a battery corresponds to its State of Charge (SOC). By utilizing the charging and discharging characteristics of NiMH batteries and sampling the instantaneous voltage and current during charging and discharging in real time, dynamic measurement of the remaining capacity at any state during the charging and discharging process can be achieved. 2. SOC Measurement and Control System Composition The structure of the battery SOC dynamic measurement system based on the CAN (Control Area Network) bus is shown in Figure 2. It mainly consists of current and voltage sensors, a battery pack measurement unit, and a battery management ECU (Electronics Control Unit). The CAN bus is a serial communication network that effectively supports distributed or real-time control. The signal transmission rate of the CAN bus can reach 1 Mbps. The CAN bus adopts a multi-master working mode, where any point on the network can actively send information to other nodes on the network at any time, without master-slave distinction. The communication method is flexible and does not require node information such as station addresses. CAN uses a short frame structure and has a powerful error detection and processing mechanism, resulting in an extremely low data error rate. The battery in an FCEV system provides power and acts as an output module, providing signals such as voltage, current, temperature, and SOC (State of Charge). All battery signals are digitized into standard values of 0-255 by the battery's electronic control unit (ECU), corresponding to analog values of 0V-5V in physical transmission. Communication with other control systems in the vehicle is achieved via a CAN bus. Figure 2 shows the structure of a CAN bus-based battery SOC detection system. The individual batteries used in the system are combined into 24 battery packs. A measurement unit is configured for every 6 battery packs, resulting in 4 measurement units (ECU1 to ECU4). Each measurement unit uses a Philips 8-bit high-performance microcontroller, the P87C591, which integrates a CAN controller (SJA1000) and an A/D converter. The main function of the measurement unit is to provide voltage and temperature information for the battery packs and transmit the collected signals to the battery management ECU via the CAN bus. The battery pack ECUs and the battery management ECU form a CAN bus network with a bus topology, using twisted-pair cable as the transmission medium and CAN 2.0B as the transmission protocol. The battery management ECU employs a dual CAN controller structure. One CAN controller forms the internal CAN network of the battery management system with the battery pack ECU, while the other CAN controller forms the vehicle's fiber optic CAN bus network with other control systems. The transmission medium is plastic optical fiber, and the transmission protocol is CAN 2.0B. This enables multi-machine communication and achieves the goals of host computer control and battery SOC state prediction. 3. CAN Communication Interface Circuit Design The CAN communication interface circuit, as shown in Figure 3, mainly consists of a microcontroller, an opto-isolation circuit, and a CAN transceiver. The microcontroller uses a P87C591 microcontroller. The CAN module of this chip communicates with external CAN units primarily through the CANRX (receive) and CANTX (transmit) pins of the microcontroller. To enhance the anti-interference capability of the CAN bus contacts, an opto-isolation chip 6N137 is used between the P87C591 and the CAN transceiver 82C250. The input and output power supply voltages of this chip are both 5V. The 82C250 CAN transceiver is the interface between the CAN controller driving the P87C591 and the physical bus. Its operating voltage is also 5V. It provides differential transmission capability to the bus and reception function to the CAN controller. Resistor R10 serves as the matching resistor for the CAN bus termination, with a typical value of [value missing]. In the diagram, C7, C8, and C9 are decoupling capacitors for the chip, each with a value of 0.1uF; R5, R6, R7, and R8 are current-limiting resistors, each with a value of [value missing]. The reset terminal RS of the 82C250 is connected to ground through resistor R9. Figure 3: CAN Communication Interface Circuit. 4. System Software Design The system software is programmed using C language from the 8051 series, following a modular design approach. It includes the main program, CAN initialization program, CAN data transmission program, CAN data reception program, A/D conversion program, and timer interrupt program. The CAN initialization program is used to set parameters for CAN operation, mainly including setting the operating mode, clock output register, receive mask register and receive code register, bus timer, output control register, interrupt enable register, and bus baud rate. The system main program flowchart is shown in Figure 4, mainly including initialization and main loop sections. Figure 4: System Main Program Flowchart. After the system powers on, it first initializes the CAN controller and timer, then waits for an interrupt. If an interrupt occurs, the interrupt type is determined; if it's an interrupt from the SJA1000 controller, the data from the SJA1000 controller is read, the buffer is released, and the system returns after the interrupt is complete; if it's a 50ms timer period interrupt, the voltage and current data are converted to digital (A/D), the SOC value is calculated, and the relevant data is sent via CAN, then the system returns after the interrupt is complete. 5. Conclusion Based on the special environment of batteries used in vehicle systems and the testing requirements for SOC parameters, this system adopts a dual CAN bus structure and fiber optic communication technology, which greatly enhances the system's real-time performance, reliability, and anti-interference capabilities. Furthermore, the system is easily expandable, highly flexible, and can accurately and in real-time predict the SOC value of FCEV batteries, thereby improving battery life and overall vehicle performance. References: 1. M.eraolo, R. Giflioli. “State-of-charge Estimation for Improving management of Electric Vehicle lead acid Batteries During Charge and Discharge” Proc, of the 13th International Electric Vehicle Symposium (1996) 2. T. Shinpo. Development of Battery Management System for Electric Vehicle. Proc. of the 14th International Electric Vehicle Symposium (1997) 3. Quan Shuhai, Wang Chao, Song Juan. Research on Control System and Coordination Control of Fuel Cell Engine for Vehicles. Journal of Central China Normal University (Natural Science Edition), 2005.9, Vol. 39, No.3, P325~P328 4. Song Juan, Luo Zhiping, Quan Shuhai. KingSCADA Monitoring System for Fuel Cell Laboratory Based on PID Algorithm. Microcomputer Information, 2006, Vol.1, P28-30