Design of electric vehicle battery management system based on STM32 and CAN bus

Publisher:灵感发电站Latest update time:2014-05-22 Source: OFweek电子工程网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

 With the widespread application of battery energy, the depletion of oil resources and environmental pollution, electric vehicles have attracted more and more attention for their advantages of energy saving and environmental protection. In the research and development of electric vehicles, the research and manufacture of on-board batteries and their management systems occupy an important position. The main problems of electric vehicle power batteries in application are: in the production process, the battery process, technology and grouping technology cannot guarantee the good consistency of its initial performance; in the use process, it is very sensitive to overcharging, over-discharging, over-temperature, over-current, etc., and the occurrence of such situations will significantly shorten the battery life and even cause the battery to be scrapped. The battery pack is dozens or even hundreds of single cells in series. There are inconsistencies between single cells. With continuous charge and discharge cycles, the inconsistency between batteries increases, and the available capacity of the battery pack is restricted by the single cell with the smallest capacity. For these situations, the initial performance of the battery must rely on the optimization of the enterprise's production process and the control of key parameters of the production process to improve, while the problems that arise during use need to be solved by the battery management system. This design is based on the main controller with STM32F107 as the core, which controls the battery pack information collection and basic control module with C8051F500 as the core through the CAN communication network and obtains data. It mainly realizes the overvoltage discharge balance of single cells, overcurrent protection, overtemperature protection, over-discharge protection, and reports and stores the working status of the entire battery pack through the upper controller.

  1 Hardware Design

  1.1 System overall architecture

  The battery pack structure monitored and managed by the system is as follows: first connect a certain number of lithium-ion batteries in series, connect several battery strings in parallel to form a battery pack, and finally connect several battery packs in series to form a whole battery pack. This series-parallel reuse organization is conducive to the start-stop operation of charging and discharging of a single battery string, reducing the inconsistency of battery capacity generated during use. The structure of the management system is shown in the figure. Each battery string is equipped with a secondary controller for monitoring and management, collecting and uploading data such as current, voltage, and temperature, and controlling the start-stop and balancing operation of the battery string. The primary controller is a dual CAN controller structure. The CAN1 controller and the secondary controller form the CAN network of the battery pack. The CAN2 controller and the main control board battery pack form an internal primary CAN bus network, which is responsible for reporting the working status of the battery pack to the main control board and conveying instructions to the subordinate secondary controller. The CAN2 controller of the main control board is connected to the vehicle CAN bus. Since each battery pack is in a series structure, the increasing relationship of the voltage affects the secondary controller, so DC/DC conversion is required when supplying power.

  1.2 Main controller and primary controller architecture

  The core control of the main controller and the first-level controller is completed by STMicroelectronics' STFM32F107. STM32F107 is a high-performance, low-cost, low-power 32-bit RISC microprocessor. It uses the ARMCortex-M3 core, contains 256 kB of Flash and 64 kB of SRAM, has sufficient programming space, and has a main frequency of 72 MHz, which is enough to undertake real-time management of the lower-level controller. The peripherals included are: basic power supply circuit, reset circuit, standard JTAG debug port, dual CAN physical layer circuit, EEPROM memory, which is the best solution for this system design.

  1.3 Two-level controller architecture

  Since the voltage of a lithium-ion battery cell is relatively small, generally about 4 V, while the voltage of the entire battery pack is as high as hundreds of volts, and the length of a single string of batteries is more than 15, and the commonly used battery measurement chips are relatively expensive and can only monitor the voltages of 6 or 12 batteries, after comprehensive consideration, it was decided to design a secondary controller with C8051F500 as the core. Compared with a dedicated battery measurement chip, this design has the disadvantage of lower accuracy, but the advantage is that the measured data can be calculated and processed first, and does not completely rely on the instructions of the upper controller.

  The C8051FS00 processor is designed according to the AEC-Q100 test standard, with wide operating voltage, wide operating temperature range, strong anti-interference ability and built-in CAN and LIN bus controllers, suitable for automotive electronics and industrial control applications. The chip has 32 I/O ports, the number of interfaces meets the needs of monitoring the battery string, with a 12-bit ADC, and the minimum setup time of each channel is <50μs, that is, the total time of a patrol cycle is <1 ms, which is enough to support real-time monitoring of the battery string. The controller architecture is shown in Figure 2.

  The CAN bus physical layer circuit with isolated driver is shown in Figure 3. In addition, there are external devices such as DC/DC power supply and C2 online debugging interface.

  2 Software Design

  2.1 Secondary controller software flow

  (1) Coefficient correction program. Because the total number of batteries is extremely large, in order to reduce the production cost and space occupied by the system, the voltage measurement uses a relatively simple resistor voltage division method, and the current measurement uses a resistor sampling method. In order to compensate for the error caused by the resistor, a correction coefficient program is preset. Before each circuit board is put into use, a 5 V standard voltage can be connected to all voltage measurement ports, and a 10 A standard current can be passed through both ends of the sampling resistor. The program can automatically modify the coefficient according to the measured value to improve the working accuracy.

  (2) Software flow. As shown in Figure 4, when the program starts running, it first initializes the system clock and some variables inside C8051FS00, then initializes each I/O port, timer, interrupt, ADC working mode and CAN bus working mode, and then determines whether the battery pack is currently charging or discharging based on the two I/O data of the measured current to select different control schemes, and then detects whether there is an instruction issued by the first-level controller. If so, the instruction is executed. Otherwise, the ADC will inspect the input voltage of each I/O, and the program will restore it to the terminal voltage of each battery, the current and temperature of the battery string through the pre-stored coefficients. Finally, the SOC of each battery is calculated. Considering the computing power of C8051F500, the ampere-hour integration method with relatively medium accuracy and computing complexity is adopted, and it is corrected according to temperature, voltage, voltage-time gradient and other quantities. At the same time, the total voltage, current, temperature and total SOC, a total of 4 parameters, are reported to the first-level controller in real time. If the voltage of a single battery is too high during charging, the corresponding MOS tube is turned on to balance the charging. When over-temperature, over-current or discharge end point occurs, the battery string is disconnected and all data at the time of disconnection are reported to the primary controller. Otherwise, the main program continues to determine whether there is an instruction and loops the above process.

  2.2 Primary controller software flow

  (1) Receive data uploaded by the secondary controller. There are two main types of data: one is the current, voltage, temperature, and remaining power of each battery string uploaded at all times; the other is the complete data and the reason for the stop when a battery string stops working for some reason.

  (2) SOC calculation. The SOC calculated here is the remaining power of the entire battery string based on the current, voltage and temperature uploaded in real time. Because the computing power of the STM32F107 chip is stronger than that of the C8051F500, the calculation model here adopts the fuzzy neural network method.

  (3) Issue instructions to the secondary controller. There are two types of instructions: one is to require it to upload complete data on the current working status, mainly to save historical data before parking or manually request to view; the other is to suspend the battery string for a period of time when its SOC is significantly higher/lower than other battery strings during charging and discharging, which is conducive to smoothing out the inconsistency between batteries as much as possible during use. When there is a large difference between the uploaded SOC and the calculated SOC, upload this situation to facilitate the inspection and correction of the model coefficients.

  (4) Upload data to the main controller. In addition to the data uploaded actively or at the request of the main controller, including a series of working conditions such as the overall voltage, current and SOC of the battery pack, the voltage, current, temperature and SOC of the corresponding battery string and even the corresponding battery, there are also reports on various unexpected situations.

  2.3 Main Controller Software Flow

  The task of the main controller is to report the working status of the battery pack to the vehicle controller and convey instructions to the first-level controller as required. It is similar to the first-level controller, but because each battery pack may cut off a battery string, causing a sudden change in SOC, there is no operation to calculate the SOC of each battery pack.

  3 Conclusion

  This paper proposes a battery pack monitoring and management system with STM32F107 as the core controller and interconnected with C8051F500 as the core sub-controller through CAN bus. It can efficiently manage the battery, provide the driver with remaining power information, and extend the battery life. The article describes the implementation process and various functions of the system in detail from both hardware and software aspects. When the system is detected with voltage source and current source, the measured voltage error does not exceed 0.01 V, and the current error does not exceed 0.05 A. For simulated overvoltage, overcurrent, overtemperature, discharge termination and other conditions, the control board can respond quickly, verifying the system's measurement accuracy, real-time control and good CAN communication network. When using lithium batteries for charge and discharge experiments, the estimated SOC is basically consistent with the actual situation. When charging, when a battery is close to full, the balancing operation can be started in time, and the effect of protecting overcharge is also ideal.

Reference address:Design of electric vehicle battery management system based on STM32 and CAN bus

Previous article:Introduction and comparison of implementation methods of smartphone keyboard controller
Next article:How to maintain a mobile power bank

Latest Power Management Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号