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

Publisher:脑力驿站Latest update time:2014-09-04 Source: elecfansKeywords:STM32 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 to control the battery pack information collection and basic control module with C8051F500 as the core through the CAN communication network and obtain 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 an overall battery pack. This series-parallel reuse organizational form 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 operations 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. It has a wide operating voltage, a wide operating temperature range, strong anti-interference ability, and built-in CAN and LIN bus controllers, which are suitable for applications in automotive electronics and industrial control. The chip has 32 I/O ports, and the number of interfaces meets the needs of monitoring the operation of battery strings. It has 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 battery strings. 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.

  Embedded

  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.

  flow chart

  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.

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

Previous article:Design of monitoring terminal for electric vehicle fast charger
Next article:Digital Temperature Measurement System Based on ARM and DS18B20

Recommended ReadingLatest update time:2024-11-16 04:22

STM32 matrix keyboard input through serial port three output
Configuring Matrix Keyboard Input //PA0~PA3 are push-pull output //PA4~PA7 are pull-up inputs //PA9- RXD PA10- TXD   void  KEY44_Init(void) { //PA0~PA3 are push-pull output   GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 |GPIO_P
[Microcontroller]
STM32 timer generates PWM with different frequencies
 It is very convenient for STM32 to generate PWM. You just need to simply set the timer and it will be generated immediately! (1) Enable the timer clock: RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); (2) Define the corresponding GPIO:  /* PA2,3,4,5,6 output- Key_Up,Key_Down,Key_Left,Key_Right,Key_Ctrl */
[Microcontroller]
STM32 serial port routine query and receive
      With STM32, using the serial port is like playing a game. I will not talk about the joy of the STM32 serial port here, but directly show the code, and readers can experience the fun from the code. Sending and receiving are both in query mode, and the serial port debugging tool uses HyperTerminal or this one--Secu
[Microcontroller]
Getting started with STM32
Now I am a beginner in STM32, so I write some help about getting started, and I also thank those who have helped me. I hope that friends like me who want to learn STM32 will not be confused. (This introduction is only suitable for beginners, please don’t laugh at the experts). 1. Hardware platform.          Now yo
[Microcontroller]
STM32 MCU Learning (2) External Interrupt
Li Xiang stm32 video tutorial 49 episodes http://pan.baidu.com/s/1kTyt03P STM32 interrupts (upper, middle and lower) external interrupts (registers, library functions) STM32 Function Description (Chinese).pdf http://download.csdn.net/detail/leytton/7630851 Interrupt Management Function.pdf http://wenku.baidu.com/view
[Microcontroller]
How to implement PWM waveform with adjustable frequency and duty cycle in STM32
Use two TIM timers: one outputs PWM with adjustable frequency and duty cycle, and the other counts (times) the output PWM pulses. 1. The gated method can be implemented, but it requires complex configuration and calculation, and is not recommended. 2. Pulse counting is a more practical and simpler method; There are se
[Microcontroller]
How to implement PWM waveform with adjustable frequency and duty cycle in STM32
STM32 study notes - use of system timer SysTick
//Cortex system timer SysTick provides a 24-bit, descending, zero-constrained, write-clear counter with a flexible control mechanism       #include  "stm32f10x_lib.h"     GPIO_InitTypeDef  GPIO_InitStructure; //Define the structure variable used to initialize and configure GPIO static  vu32  TimingDelay;
[Microcontroller]
STM32 uses printf to lose the first letter
The execution steps of using the printf function of STM32 to print information to the serial port are: 1. Redirecting printf function Add the following function to the uart.c file: //Redirect C library function printf to USART1 int fputc(int ch, FILE *f) {  /* Clear the TC flag in the SR register */  USART_ClearFlag(U
[Microcontroller]
STM32 uses printf to lose the first letter
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号