332. Design of battery replacement management system based on STM32 microcontroller (program + schematic + component list + supporting information, etc.)

Graduation design help, question writing guidance, and technical solutions (paid) are listed below.

Table of contents

1. Design function

2. Physical pictures

3. Schematic diagram

4. Program source code  

Information includes:

If you need complete information, you can click on the business card below to add me, and ask me for the Baidu network disk download address and extraction code of the resource compression package.


MCU main chip selection plan

Option 1: AT89C51 is a low-voltage, high-performance CMOS 8-bit microcontroller produced by ATMEL Corporation of the United States. The device is produced using ATMEL Corporation’s high-density, non-volatile storage technology and is compatible with the standard MCS-51 instruction system. The chip has a built-in general-purpose 8-bit central processing unit (CPU) and Flash storage unit, which is powerful. The on-chip 4K program memory is made of FLASH technology. This kind of microcontroller has very low requirements for development equipment and the development time is also greatly shortened. The program written into the microcontroller can also be encrypted, which in turn protects the fruits of our labor well. Furthermore, the current price of AT89C51 is lower than that of 8031, and the market supply is also sufficient. AT89C51 can form a true microcontroller minimum application system, reduce the system size, increase the system reliability and reduce the system cost. As long as the program length is less than 4K, all four I/O ports are available to the user. It can be programmed with 5V voltage, and the erasing and writing time only takes 10ms. The AT89C51 chip provides three-level program memory encryption, providing a convenient, flexible and reliable hard encryption method, which can completely guarantee that the program or system will not be copied. The PO port is a three-state bidirectional port, commonly known as a data bus port, because only this port can be directly used for read/write operations on external memory.
Option 2: STM32 series microcontroller control. This type of microcontroller is packaged in LQFP44, and the internal resources are sufficient for this design. The maximum operating frequency of the STM32F103 series chips can reach 72MHZ, and can reach 1.25Mip/MHZ (Dhrystone2.1) when simulating the 01 wait cycle of the memory. The internal 128k bytes of flash program memory means that the amount of code can be written to 128k bytes. This design is enough, with up to 20K bytes of internal SRAM.

Comparing these two options, since I learned digital circuits, microcontroller principles, and C language programming in school, and comprehensively considered the resources of various parts of the microcontroller and the resources available to students, after comparing the design requirements for this time, I chose to use the STM32 series. Chip completed. Moreover, the school also provides corresponding hardware operating platforms, which are more convenient for actual operation, so STM32 is a more reasonable choice.

1. Design function

This design studies the battery management system. The battery management system can manage the status of 4-cell lithium battery packs in series, and can realize real-time voltage monitoring and display of each battery. When the battery is found to be working abnormally a>
is now automatically replaced. The main contents and requirements of this design are as follows:

1. This design is developed using STM32 microcontroller.

2. Study the voltage measurement and control method of each cell in the series-connected lithium battery pack;

3. Research the replacement method of series lithium batteries;

4. Study the working status and voltage display method of each battery in the lithium battery pack.

2. Physical pictures

STM32STM32 Overview
        The STM32 series is an ARM Cortex-M3 core specially designed for embedded applications that require high performance, low cost, and low power consumption. It is divided into two different series according to performance: "enhanced" STM32F103 series and "basic" STM32F101 series. The clock frequency of the enhanced series can reach 72MHz, which is the highest frequency among similar products; the clock frequency of the basic series is 36MHz, which provides greater performance than 16-bit products at the same price, and is the best among 16-bit products. choose. Both series have built-in flash memory from 32K to 128K, but the difference is the maximum capacity of SRAM and the combination of peripheral interfaces. When the clock frequency is 72MHz, from the perspective of flash memory execution code, STM32 consumes 36mA, which is the lowest power consumption product on the 32-bit market, equivalent to 0.5mA/MHz [6].
The STM32103C8T6 microcontroller is used as the processor, which is a 32-bit processor. The core is Cortex-M3, with its parallel bus structure, nested interrupt vector control unit, debugging system and its standard memory map. The Nested Vector Interrupt Controller (NVIC) is a key component in the Cortex-M3 processor. It provides a standard interrupt architecture and excellent interrupt response capabilities for Cortex-M3-based microcontrollers. , providing dedicated interrupt entrances for more than 240 interrupt sources, and each interrupt source can be assigned an individual priority. The use of NVIC can achieve very fast interrupt response speed. It only takes 12 cycles from receiving the interrupt request to executing the first instruction of the interrupt service. This extremely fast response speed is partly due to the automatic stack processing mechanism of the Cortex-M3 core, which is implemented through microcode solidified inside the CPU. On the other hand, when interrupt requests occur continuously, NVIC uses a technology called "tail chain" so that consecutive interrupts can be serviced within 6 clock cycles. During the interrupt pushing phase, higher priority interrupts can embed lower priority interrupts without consuming any additional CPU cycles. I will continue to summarize the specific details later. Users can set the CPU to automatically enter a low-power state and use interrupts to wake it up. The CPU will remain in sleep state until the interrupt time comes [7].
  The Cortex-M3 CPU supports two operating modes: thread mode (Thread Mode) and processing mode (Handler Mode). It should be noted that these two modes have independent stacks. This design allows developers to carry out more sophisticated programming, and the support for real-time operating systems is better. The Cortex-M3 processor also includes a 24-bit auto-reloadable timer that can provide a periodic interrupt to the core (RTOS).
In terms of instruction sets, both ARM7 and ARM9 have two instruction sets (32-bit instruction set and 16-bit instruction set), and the Cortex-M3 series processors support Thumb-2 instruction set. Since the Thumb-2 instruction set combines the Thumb instruction set and the ARM instruction set, a balance is achieved between the performance of the 32-bit instruction set and the code density of the 16-bit instruction set [5]. Professional embedded and microcontroller technology training. Moreover, ARM Thumb-2 is specially designed for C/C++ compilers, which means that the development and application of Cortex-M3 series processors can be completed in the C language environment.
  The launch of the STM32 microcontroller marks a major step taken by ST Company in its two main product lines (low-price main line and high-performance main line). The STM32 was initially released in 14 different models, divided into two versions: "Enhanced" with a maximum CPU clock of 72MHZ and "Basic" with a maximum CPU clock of 36MHZ. The built-in Flash in these different STM32 models can be up to 128KB, and the SRAM can be up to 20KB. At the beginning of the release of STM32, versions with larger Flash, RAM and more complex peripherals were already being planned. No matter what version or model of STM32 device, they are compatible in terms of pin functions and application software. This allows developers to change device models as needed without changing the PCB when using the STM32 series microcontrollers. At first glance, the equipment configuration of STM32 is somewhat similar to the familiar 51 microcontroller in the past. Generally, STM32 will be equipped with common peripherals, such as multi-channel ADC, general timer, I2C bus interface, SPI bus interface, CAN bus interface, USB controller, real-time clock RTC, etc. However, each of its external devices has something unique to offer. For example, a 12-bit precision ADC has multiple conversion modes and has an internal temperature sensor. An STM32 device with dual ADCs can also make two ADCs work at the same time, resulting in 9 more advanced conversion modes. ; Each timer of STM32 has 4 capture comparison units, and each timer can work in conjunction with other timers to generate more precise timing; STM32 has an advanced timer specially designed for motor control. It has 6 PWM output channels with programmable dead time, and its emergency braking channel can force the PWM signal output to remain in a predetermined safe state when abnormal conditions occur; the SPI interface contains a hardware CC8 unit , supports CC8 calculations for 8-bit bytes and 16-bit halfword data. It is very useful when accessing data from storage media such as SD or MMC. Moreover, STM32 also contains 7 DMA channels. No spoof channel can be used to transfer 8-bit, 16-bit, and 32-bit data between the device and memory. Each device can request the DMA controller to send or receive data. The STM32 internal bus arbiter and bus matrix greatly simplify the connection between the CPU data interface and the DMA channel, which means that the DMA channel unit is very flexible and its use is simple enough to handle common data in microcontroller applications. Transmission requirements.


 

3. Schematic diagram

During the process of this design, many problems were encountered in both hardware and software. However, compared to software, hardware is still a faster solution because it is easier to detect errors in hardware than in software. It is relatively obscure and difficult to understand.
Regarding hardware debugging, after welding the physical component board, first use a multimeter to measure the power supply of the industrial board. The power supply is the most important issue and should be particularly checked. place to prevent short circuit of the power supply and positive and negative polarity errors. Then carefully check whether there is any problem with the connection of the circuit, or whether there is any weak soldering or missing parts, and then check whether there is any problem with the installation of the components and whether the installation complies with the regulations, since I have been doing this for four years in college. After a lot of practical training, I am still comfortable with these, but after debugging on the computer, I still found a lot of problems.

4. Program source code  

Keil 5 is a C language software development system for 51 and STM32 series compatible microcontrollers produced by Keil Software of the United States. Compared with assembly, C language has obvious advantages in functionality, structure, readability, and maintainability, making it easy to learn. Easy to use. Keil provides a complete development solution including C compiler, macro assembly, linker, library management and a powerful simulation debugger, etc., and combines these parts through an integrated development environment (μVision). Running Keil software requires WIN98, NT, WIN2000, WINXP and other operating systems. If you use C language to program, then Keil is almost your best choice. Even if you do not use C language but only use assembly language to program, its convenient and easy-to-use integrated environment and powerful software simulation debugging tools will make you get twice the result with half the effort.

Information includes:

If you need complete information, you can click on the business card below to add me, and ask me for the Baidu network disk download address and extraction code of the resource compression package.
 

Guess you like

Origin blog.csdn.net/ENGLISH_HHZ/article/details/132906602