Automatic charging and discharging test system based on STM32 design

By integrating the INA219 current and voltage detection module, DS18B20 temperature sensor, and ESP8266-WIFI module into an STM32-based automatic charge and discharge test system, the shortcomings of existing equipment in terms of functionality, accuracy, and intelligence are solved. This enables real-time monitoring and remote control of the lithium battery charging and discharging process, improving testing efficiency and safety.

CN120949045APending Publication Date: 2025-11-14SHANGHAI SENIOR TECH SCHOOL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511036729.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-28
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Existing lithium battery charge and discharge testing equipment is inadequate in terms of functionality, accuracy, intelligence, and remote monitoring capabilities. In particular, it lacks highly integrated testing systems with real-time monitoring, precise control, and automatic recording and analysis on large-scale production lines.

Method used

Design an automatic charge and discharge test system based on STM32, integrating an INA219 current and voltage detection module, a DS18B20 temperature sensor, and an ESP8266-WIFI module. The system uses an STM32 microcontroller to control relays to achieve independent charging and discharging of lithium batteries, and combines Qt framework host computer software for remote control and data analysis.

Benefits of technology

It enables real-time monitoring and recording of the lithium battery charging and discharging process, ensuring safety and performance stability, providing convenient data viewing and analysis, improving the automation and intelligence level of the testing system, reducing manual intervention, and lowering costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120949045A_ABST
    Figure CN120949045A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic charging and discharging test system based on STM32 design, and relates to the field of automatic charging and discharging test. According to the invention, a modern embedded technology and an Internet of Things technology are fully utilized, an STM32 microcontroller, an INA219 current and voltage detection module, a DS18B20 temperature sensor, a relay and an ESP8266-WIFI communication module are integrated, real-time accurate monitoring and control of parameters such as voltage, current, temperature, electric quantity and the like in the charging and discharging process of the lithium battery are realized, and meanwhile, real-time monitoring and control of the parameters are realized. Intelligent switching of a charging mode and a discharging mode is achieved through a relay, the functions of real-time data display, remote control, data analysis and the like are achieved by means of upper computer software designed through a Qt frame, the system integrates automation, intelligentization and safety, the battery performance testing process is optimized, the testing efficiency is improved, the battery safety is guaranteed, and the system is suitable for popularization and application. Powerful test tools and technical support are provided for battery production and scientific research, and the method has a good application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automatic charge and discharge test systems, specifically an automatic charge and discharge test system based on STM32 design. Background Technology

[0002] With the widespread application of lithium batteries in consumer electronics, new energy vehicles, energy storage systems and other fields, higher requirements have been placed on their performance characteristics and safety. Accurate, efficient and intelligent lithium battery charge and discharge testing systems have become an indispensable part of product research and development, production and maintenance. Currently, although there are some charge and discharge testing devices on the market, many devices still have shortcomings in terms of functionality, accuracy, intelligence, and remote monitoring capabilities. In particular, on large-scale production lines, there is a lack of highly integrated testing systems that can monitor the battery charge and discharge status in real time, accurately control the charge and discharge process, automatically record and analyze test data, and support remote operation. To address this, we propose an automatic charge and discharge testing system based on STM32 design. Summary of the Invention

[0003] The technical problem this invention aims to solve is to overcome existing defects and provide an automatic charge and discharge testing system based on STM32 design. This system enables remote control and data interaction via a local area network. It not only improves the automation and intelligence level of lithium battery charge and discharge testing but also monitors and records key parameters in real time during the charging and discharging process, ensuring battery safety and performance stability. Furthermore, the design of the host computer software allows users to easily view and analyze test data, providing strong support for the research and development and application of lithium batteries, and effectively solving the problems in the background technology.

[0004] To achieve the above objectives, the present invention provides the following technical solution: an automatic charge and discharge test system based on STM32 design, including an STM32 microcontroller, a relay, an INA210 power monitoring module, a DS18820 temperature sensor, an ESP28266-WIFI module, and a host computer. The INA210 module accurately measures the current and voltage of the lithium battery during the charging and discharging process in real time, as well as the power and charge information calculated from them, and can accurately determine whether the battery is fully charged or discharged.

[0005] Furthermore, the STM32 microcontroller controls two relays to independently charge and discharge the lithium battery, and intelligently switches the charging and discharging modes according to the battery status to ensure that the battery will not be overcharged or over-discharged.

[0006] Furthermore, the DS18B20 temperature sensor monitors the temperature changes during the battery charging and discharging process in real time, ensuring that the temperature is within a safe range, and displays the temperature information on the display screen in real time.

[0007] Furthermore, the ESP8266-WIFI module enables wireless connection with the host computer, transmitting real-time collected battery status data to a Qt application on a computer or mobile phone via WiFi.

[0008] Furthermore, the host computer is designed based on the Qt framework, which can receive and display various parameters from the device in real time, including temperature, voltage, current, etc., and dynamically display the voltage change trend during charging and discharging through curves. The host computer can remotely start or stop the charging and discharging process of the lithium battery, enhancing the convenience and controllability of the system.

[0009] Furthermore, the hardware modules of the automatic charge and discharge test system include the following core components: Component 1, Main Control Unit: STM32F103RCT6 (any STM32F103 series chip is acceptable) Microcontroller: As the central hub of the entire system, it is responsible for handling all data acquisition, control logic operations, communication protocol parsing, and interaction tasks with other modules; Component 2, Power Monitoring Module: INA219 Current / Voltage / Power Detection Module: Used to monitor the current, voltage, and power of the lithium battery in real time during charging and discharging, providing the system with accurate power data; Component 3, Charge / Discharge Control Module: Relay Control Circuit: Contains at least two relays, one for controlling the charging process and the other for controlling the discharging process. The relays are driven by an STM32 microcontroller to achieve intelligent switching between the charging and discharging processes of the lithium battery. Component 4, Temperature Detection Module: DS18B20 Digital Temperature Sensor: Embedded in or near the battery pack, it is used to monitor and provide feedback on the temperature information of the lithium battery during charging and discharging in real time, ensuring that the battery operates within a safe temperature range; Component 5, Data Display Module: OLED Display: A 0.96-inch OLED display with an SPI interface, which displays important parameters such as battery charging status, discharging status, remaining power, current, voltage and temperature in real time; Component 6, Wireless Communication Module: ESP8266-WIFI Module: Enables wireless connection between the system and external devices (such as computers or mobile phones), and uploads the collected battery status data to the host computer software in real time via WiFi protocol; Component 7, Battery charging and discharging actuator: Charging module: Connected to mains power or a specific power source, it charges the lithium battery through the control system.

[0010] Compared with the prior art, the beneficial effects of the present invention are: This invention integrates an INA219 current and voltage detection module, a DS18B20 temperature sensor, and an ESP8266-WIFI module. Using the INA219 module, it accurately measures the current and voltage of the lithium battery during charging and discharging, and calculates the power and capacity information accordingly, enabling accurate determination of whether the battery is fully charged or discharged. An STM32F103RCT6 microprocessor (or any STM32F103 series chip) controls two relays to independently charge and discharge the lithium battery, intelligently switching charging and discharging modes based on battery status to prevent overcharging or over-discharging. Locally, a 0.96-inch SPI interface OLED display shows the current charging / discharging status, remaining battery capacity, current, and voltage values ​​in real time, providing a clear view of the battery's condition. The integrated DS18B20 temperature sensor... The temperature sensor monitors the battery's temperature changes in real time during charging and discharging, ensuring the temperature remains within a safe range and displaying the temperature information on the screen. It also records and stores key parameters (such as time, current, voltage, temperature, and charge) in real time for later data analysis and product quality tracking. The system is equipped with an ESP8266-WIFI module, enabling wireless connection to a host computer. Real-time battery status data is transmitted via WiFi to a Qt application on a computer or mobile phone. The host computer software, based on the Qt framework, receives and displays various parameters from the device, including temperature, voltage, and current, and dynamically shows voltage trends during charging and discharging through graphs. Users can remotely start or stop the lithium battery charging and discharging process via the host computer, enhancing the system's convenience and controllability. This system enables real-time and precise monitoring and control of parameters such as voltage, current, temperature, and capacity during the charging and discharging process of lithium batteries. Simultaneously, it achieves intelligent switching of charging and discharging modes through relays, and utilizes Qt-based host computer software to realize real-time data display, remote control, and data analysis functions. This system integrates automation, intelligence, and safety, optimizing battery performance testing processes, improving testing efficiency, and ensuring battery safety. It provides powerful testing tools and technical support for battery production and research. Automated and intelligent charging and discharging testing reduces manual intervention, improves testing efficiency, and lowers labor costs. Furthermore, through meticulous management of the entire battery charging and discharging process, energy can be used scientifically and rationally, reducing ineffective losses and promoting efficient resource utilization. Attached Figure Description

[0011] Figure 1 This is a system framework diagram of an automatic charge and discharge test system based on STM32 design according to the present invention; Figure 2 This is a diagram showing the system hardware modules of an automatic charge and discharge test system based on STM32, as described in this invention.

[0012] Figure 3 This is a system schematic diagram of an automatic charge and discharge test system based on STM32 according to the present invention. Detailed Implementation

[0013] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments.

[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0015] Example 1 An automatic charge and discharge test system based on STM32 includes an STM32 microcontroller, a relay, an INA210 power monitoring module, a DS18820 temperature sensor, an ESP28266-WIFI module, and a host computer. The INA210 module accurately measures the current and voltage of the lithium battery during charging and discharging in real time, as well as the power and charge information calculated from them, and can accurately determine whether the battery is fully charged or discharged.

[0016] The STM32 microcontroller controls two relays to independently charge and discharge the lithium battery, and intelligently switches the charging and discharging modes according to the battery status to ensure that the battery is not overcharged or over-discharged.

[0017] The DS18B20 temperature sensor monitors the temperature changes during the battery charging and discharging process in real time, ensuring that the temperature is within a safe range, and displays the temperature information on the display screen in real time.

[0018] The ESP8266-WIFI module enables wireless connection with the host computer, transmitting real-time collected battery status data to a Qt application on a computer or mobile phone via WiFi.

[0019] The host computer is designed based on the Qt framework and can receive and display various parameters from the device in real time, including temperature, voltage, current, etc. It can also dynamically display the voltage change trend during charging and discharging through curves. The host computer can remotely start or stop the charging and discharging process of the lithium battery, enhancing the convenience and controllability of the system.

[0020] The hardware modules of the automatic charge and discharge test system consist of the following core components: Component 1, Main Control Unit: STM32F103RCT6 (any STM32F103 series chip is acceptable) Microcontroller: As the central hub of the entire system, it is responsible for handling all data acquisition, control logic operations, communication protocol parsing, and interaction tasks with other modules; Component 2, Power Monitoring Module: INA219 Current / Voltage / Power Detection Module: Used to monitor the current, voltage, and power of the lithium battery in real time during charging and discharging, providing the system with accurate power data; Component 3, Charge / Discharge Control Module: Relay Control Circuit: Contains at least two relays, one for controlling the charging process and the other for controlling the discharging process. The relays are driven by an STM32 microcontroller to achieve intelligent switching between the charging and discharging processes of the lithium battery. Component 4, Temperature Detection Module: DS18B20 Digital Temperature Sensor: Embedded in or near the battery pack, it is used to monitor and provide feedback on the temperature information of the lithium battery during charging and discharging in real time, ensuring that the battery operates within a safe temperature range; Component 5, Data Display Module: OLED Display: A 0.96-inch OLED display with an SPI interface, which displays important parameters such as battery charging status, discharging status, remaining power, current, voltage and temperature in real time; Component 6, Wireless Communication Module: ESP8266-WIFI Module: Enables wireless connection between the system and external devices (such as computers or mobile phones), and uploads the collected battery status data to the host computer software in real time via WiFi protocol; Component 7, Battery charging and discharging actuator: Charging module: Connected to mains power or a specific power source, it charges the lithium battery through the control system.

[0021] The hardware architecture design includes: an STM32F103RCT6 microcontroller (any STM32F103 series chip is acceptable) as the core processor, whose high performance and abundant I / O resources meet the system's control and data processing requirements; an INA219 module for precise measurement of current, voltage, and power, reflecting the lithium battery's charging and discharging status in real time; relay control of the charging and discharging process to ensure switching under safe conditions; a DS18B20 temperature sensor to monitor battery operating temperature and prevent overheating; an ESP8266-WIFI module for wireless data transmission, facilitating remote monitoring and control; and an OLED display for local data visualization, updating charging and discharging status and various parameters in real time.

[0022] The software design and algorithm development include: developing STM32 firmware to drive and control various hardware modules, including data acquisition, relay switch control, and WiFi data transmission; designing reasonable charging and discharging strategy algorithms, such as constant current / constant voltage charging and constant current discharging, with logic to determine when charging and discharging are complete; and developing host computer software using the Qt framework to design a user-friendly graphical interface that receives and parses data from the device, displays battery parameters in real time, plots voltage change curves, and provides remote control functionality.

[0023] The ESP8266 module is configured as follows: In the entire design, the ESP8266 on the STM32 side is configured as AP mode + TCP server mode, emitting a WIFI hotspot signal. The host computer can search for the WIFI hotspot created by the ESP8266, connect to the TCP server, and complete communication.

[0024] The ESP8266 module has two commonly used operating modes: STA mode and AP mode. (1) STA Mode: In STA mode, the ESP8266 can connect to an existing Wi-Fi network as a client device. It can scan for surrounding Wi-Fi networks and connect based on the provided SSID and password. After obtaining an IP address, it can communicate with other devices through the network. In STA mode, the ESP8266 can connect to the Internet and perform various network-related operations.

[0025] (2) AP Mode (Access Point Mode): In AP mode, the ESP8266 can operate as an independent Wi-Fi access point (hotspot). It creates its own Wi-Fi network, allowing other devices (such as mobile phones, computers, etc.) to connect to this hotspot. In AP mode, The ESP8266 can act as a server within a local area network, communicating with other devices through TCP / IP connections to provide services such as web page access and data transmission.

[0026] In STA mode, the ESP8266 can connect to other devices or servers on the Internet to enable remote control and data exchange; while in AP mode, the ESP8266 can act as an independent access point, allowing other devices to connect and communicate through it.

[0027] Among them, the development of the host computer: The host computer is developed using Qt, a cross-platform software development framework based on C. Qt provides application developers with the functionality needed to create high-quality graphical user interfaces. In Qt, connecting to a specified TCP server as a TCP client is achieved using the QTcpSocket class, a class for TCP socket communication that provides functionality for establishing connections with the server and sending and receiving data. The following are the steps for using QTcpSocket to perform TCP client communication: (1) Create a QTcpSocket object: First, create a QTcpSocket object in the application as the socket for the client to communicate with the TCP server.

[0028] (2) Establish a connection: Use the connectToHost() function to connect to the specified TCP server address and port number, and use the waitForConnected() function to wait for the connection to succeed.

[0029] (3) Sending data: Use the write() function to send data to the server. You can use the waitForBytesWritten() function to wait for the data to be sent.

[0030] (4) Receiving data: Use the readyRead() signal to receive data returned from the server. You can read the received data using the readAll() or read() function.

[0031] (5) Disconnect: Use the disconnectFromHost() function to close the connection with the server.

[0032] In Qt, the main classes used to connect to a specified TCP server as a TCP client include QTcpSocket, oHostAddress, and QAbstractSocket. These classes enable operations such as connecting to the server, sending and receiving data. This invention integrates an INA219 current and voltage detection module, a DS18B20 temperature sensor, and an ESP8266-WIFI module to achieve real-time and accurate monitoring and control of parameters such as voltage, current, temperature, and capacity during the charging and discharging process of lithium batteries. Simultaneously, it uses relays to achieve intelligent switching of charging and discharging modes, and leverages Qt-based host computer software to realize real-time data display, remote control, and data analysis functions. This system integrates automation, intelligence, and safety, optimizing battery performance testing processes, improving testing efficiency, and ensuring battery safety. It provides powerful testing tools and technical support for battery production and research. Automated and intelligent charging and discharging testing reduces manual intervention, improves testing efficiency, and lowers labor costs. Furthermore, through meticulous management of the entire battery charging and discharging process, energy can be used scientifically and rationally, reducing ineffective losses and promoting efficient resource utilization.

[0033] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. An automatic charge and discharge test system based on STM32 design, comprising an STM32 microcontroller, a relay, an INA210 power monitoring module, a DS18820 temperature sensor, an ESP28266-WIFI module, and a host computer, characterized in that: The INA219 module measures the current and voltage of the lithium battery in real time and accurately during the charging and discharging process, as well as the power and charge information calculated from them, and can accurately determine whether the battery is fully charged or discharged.

2. The automatic charge and discharge test system based on STM32 design according to claim 1, characterized in that: The STM32 microcontroller controls two relays to independently charge and discharge the lithium battery, and intelligently switches the charging and discharging modes according to the battery status to ensure that the battery is not overcharged or over-discharged.

3. The automatic charge and discharge test system based on STM32 design according to claim 1, characterized in that: The DS18B20 temperature sensor monitors the temperature changes during the battery charging and discharging process in real time, ensuring that the temperature is within a safe range, and displays the temperature information on the display screen in real time.

4. The automatic charge and discharge test system based on STM32 design according to claim 1, characterized in that: The ESP8266-WIFI module enables wireless connection with the host computer, transmitting real-time collected battery status data to a Qt application on a computer or mobile phone via WiFi.

5. The automatic charge and discharge test system based on STM32 design according to claim 1, characterized in that: The host computer is designed based on the Qt framework and can receive and display various parameters from the device in real time, including temperature, voltage, current, etc. It can also dynamically display the voltage change trend during charging and discharging through curves. The host computer can remotely start or stop the charging and discharging process of the lithium battery, enhancing the convenience and controllability of the system.

6. The automatic charge and discharge test system based on STM32 design according to claim 1, characterized in that: The hardware modules of the automatic charge and discharge test system consist of the following core components: Component 1, Main Control Unit: STM32F103RCT6 (any STM32F103 series chip is acceptable) Microcontroller: As the central hub of the entire system, it is responsible for handling all data acquisition, control logic operations, communication protocol parsing, and interaction tasks with other modules; Component 2, Power Monitoring Module: INA219 Current / Voltage / Power Detection Module: Used to monitor the current, voltage, and power of the lithium battery in real time during charging and discharging, providing the system with accurate power data; Component 3, Charge / Discharge Control Module: Relay Control Circuit: Contains at least two relays, one for controlling the charging process and the other for controlling the discharging process. The relays are driven by an STM32 microcontroller to achieve intelligent switching between the charging and discharging processes of the lithium battery. Component 4, Temperature Detection Module: DS18B20 Digital Temperature Sensor: Embedded in or near the battery pack, it is used to monitor and provide feedback on the temperature information of the lithium battery during charging and discharging in real time, ensuring that the battery operates within a safe temperature range; Component 5, Data Display Module: OLED Display: A 0.96-inch OLED display with an SPI interface, which displays important parameters such as battery charging status, discharging status, remaining power, current, voltage and temperature in real time; Component 6, Wireless Communication Module: ESP8266-WIFI Module: Enables wireless connection between the system and external devices (such as computers or mobile phones), and uploads the collected battery status data to the host computer software in real time via WiFi protocol; Component 7, Battery charging and discharging actuator: Charging module: Connected to mains power or a specific power source, it charges the lithium battery through the control system.