The rapid development of the global economy places immense pressure on energy resources, the fundamental propellant for growth. Facing unprecedented shortages, the exploration of new energy sources like solar and wind power has intensified. However, the inherent randomness and intermittency of these clean energy sources necessitate the integration of robust energy storage systems (ESS). Among various energy storage technologies, the lithium-ion battery stands out due to its high energy density, long cycle life, low self-discharge rate, and absence of memory effect, making it the preferred choice for a wide range of applications. Concurrently, lithium-ion battery technology plays a pivotal role in powering modern consumer electronics like smartphones and is the cornerstone of the electric vehicle (EV) revolution.
The reliable operation of a lithium-ion battery is influenced by numerous complex and variable factors, including operational voltage, current, temperature, and internal resistance. Deviations in these parameters can lead to reduced performance, accelerated aging, or in extreme cases, safety hazards like thermal runaway. To ensure long-term reliability and safety, implementing a real-time remote monitoring system is imperative. Such a system enables personnel to promptly detect anomalies in the lithium-ion battery status and take necessary actions, such as maintenance or replacement, thereby mitigating potential risks and extending the overall service life. To address this need, and considering the widespread adoption and rapid development of WiFi communication technology within the Internet of Things (IoT) ecosystem—known for its low cost, excellent compatibility, broad coverage, and high transmission rates—utilizing WiFi for remote monitoring of lithium-ion battery systems presents a highly cost-effective solution.

1. Overall System Design
The monitoring system is architected around four core components: the data acquisition module, the wireless transmission module, the main controller, and the cloud server. The system is designed to monitor a standard 18650 lithium-ion battery with specifications including a nominal voltage of 3.7 V, a nominal capacity of 2600 mAh, a maximum charge/discharge current of 2 A/6 A, an internal resistance of approximately 60 mΩ, and an operational temperature range of -20°C to 60°C.
The STM32F407 microcontroller unit (MCU) serves as the central controller, tasked with collecting critical parameters such as voltage, current, internal resistance, and temperature from the lithium-ion battery. The acquired data is then packaged and transmitted via an ESP-12S WiFi module. This module establishes a connection to the internet and sends the data to a remote Tencent Cloud server. The cloud server hosts a MySQL database for structured data storage and a web-based application platform developed using the Spring-Boot framework. The front-end interface, built with LayUI, allows users to visually monitor the real-time status and historical trends of the lithium-ion battery from any standard web browser, fulfilling the B/S (Browser/Server) architecture model.
2. Hardware Design of the Monitoring System
The hardware design is bifurcated into the lithium-ion battery data acquisition circuit and the data communication module. The STM32F407 MCU, operating at 168 MHz with a 3.3V supply, was selected for its high-performance processing capabilities, ample peripheral interfaces (ADCs, timers, communication ports), and suitability for managing multiple data acquisition channels.
2.1 Charge/Discharge Circuit for Lithium-Ion Battery
A non-isolated bidirectional Buck-Boost converter topology is employed to manage the energy flow for both charging and discharging the single lithium-ion battery. This circuit facilitates energy transfer in both directions. During charging, the circuit operates in Buck mode, stepping down a higher input voltage to the battery’s required level. During discharging, it operates in Boost mode, stepping up the battery voltage to a usable level for a load. Power MOSFETs (e.g., IRF3250) are used as switching elements, controlled by Pulse Width Modulation (PWM) signals generated by the STM32F407. The duty cycle of these PWM signals is dynamically adjusted to implement specific control strategies: a multi-stage constant-current/constant-voltage (CC-CV) algorithm for safe charging and a constant-current (CC) algorithm for controlled discharging.
2.2 Data Acquisition Modules for Lithium-Ion Battery Parameters
The performance and safety of a lithium-ion battery are critically dependent on several key parameters:
- Temperature: Extremely low temperatures can reduce capacity and increase charging difficulty, while high temperatures accelerate aging and pose thermal runaway risks.
- Voltage: Operating outside safe voltage windows (overcharge or over-discharge) can cause irreversible damage and capacity loss.
- Current: Excessive charge/discharge currents generate heat, increase stress, and shorten lifespan.
- Internal Resistance: An increase in internal resistance reduces usable power, causes voltage sag under load, and generates excess heat.
Consequently, the monitoring system is designed to accurately measure these four parameters.
The specifications of the selected sensors are summarized in the table below:
| Parameter | Sensor / IC | Operating Range | Key Features |
|---|---|---|---|
| Temperature | DS18B20 | -20°C to +125°C | Digital one-wire interface, stable, low power consumption. |
| Voltage | ADS1115 (16-bit ADC) | 0 to 5 V (scaled) | High precision, low power, I²C interface. |
| Current | INA213 High-side Current Sense Amplifier | Based on shunt resistor | High bandwidth, excellent accuracy and sensitivity. |
For local data backup, an SD card is interfaced with the STM32F407 via its SDIO (Secure Digital Input Output) controller. The SDIO adapter provides a high-speed 4-bit parallel interface for efficient data logging, ensuring data persistence in case of network unavailability.
2.3 Internal Resistance Measurement for Lithium-Ion Battery
Measuring the internal resistance (typically in the milliohm range) of a lithium-ion battery is crucial for assessing its health. This system employs the AC injection method. A known, small-magnitude sinusoidal alternating current at a specific frequency is injected into the battery. The resulting AC voltage response across the battery terminals is measured. The internal impedance \( Z \) and its phase angle \( \theta \) are derived from these signals. The internal resistance \( R \) is the real part of this impedance.
The core measurement involves a lock-in amplification technique to extract the weak AC response signal from noise. A reference sinusoidal voltage \( U_{ref} \) is generated:
$$ U_{ref} = A \sin(\omega t + \alpha) $$
where \( A \) is the amplitude and \( \alpha \) is a phase shift. The voltage response \( U_s \) from the battery is:
$$ U_s = B |Z| \sin(\omega t + \theta + \alpha) $$
where \( B \) is a gain factor and \( |Z| \) is the impedance magnitude.
The lock-in amplifier (using AD630) multiplies \( U_s \) with a synchronous square wave \( U_r \) derived from \( U_{ref} \). After low-pass filtering to remove the high-frequency components, the output is a DC voltage \( U_0 \) proportional to the internal resistance \( R = |Z| \cos \theta \):
$$ U_0 = \frac{2}{\pi} A B |Z| \cos \theta = \frac{2}{\pi} A B R $$
The MCU measures \( U_0 \) and, knowing the calibration constants \( A \) and \( B \), calculates the lithium-ion battery internal resistance \( R \).
2.4 WiFi Communication Module
The ESP-12S module, integrating a WiFi radio and a full TCP/IP protocol stack, handles wireless communication. It is controlled via AT commands sent from the STM32F407 over a UART serial interface. The module can operate in station (STA) mode to connect to an existing WiFi network or in access point (AP) mode to create its own network. In this design, it functions in STA mode, connecting to the local internet router to transmit data packets to the cloud server’s public IP address.
3. Software Design and Cloud Platform Architecture
3.1 Overall Software Workflow
The software architecture consists of the embedded firmware on the STM32F407 and the cloud-based server application. The microcontroller software initializes all peripherals (ADCs, I²C, UART, SDIO, timers), connects to the WiFi network via the ESP-12S module, and then enters a main loop. In this loop, it periodically samples the temperature, voltage, current, and internal resistance of the lithium-ion battery. The collected data is formatted, timestamped, and stored locally on the SD card. Simultaneously, at a configured interval (e.g., every 10 seconds), the data packet is sent via the UART to the WiFi module, which transmits it to the cloud server.
3.2 WiFi Data Transmission Protocol
For reliable data transmission, a simple TCP socket connection is established between the ESP-12S module and the cloud server. The data from the lithium-ion battery monitoring system is encoded in JSON (JavaScript Object Notation) format, which is lightweight and easily parsable by web technologies. A sample JSON packet structure is:
{"voltage": 3.841, "current": 0.512, "temp": 25.3, "resistance": 0.062, "timestamp": "2025-01-12 14:30:05"}
The server listens on a specific port (e.g., 6666) for incoming connections. Upon receiving a connection and data, it parses the JSON string and inserts the values into the corresponding fields of the database table.
3.3 Cloud Monitoring Platform Design
The cloud platform is built on a Tencent Cloud server (CVM) and comprises three layers:
- Backend Server (Spring-Boot): A Java-based application framework that handles HTTP requests, business logic, and database interactions. It exposes RESTful APIs for the frontend and manages the TCP socket server for receiving data from the lithium-ion battery monitors.
- Database (MySQL): A relational database used for persistent storage of all historical lithium-ion battery parameter data. A table named, for example,
battery_logs, is created with columns for voltage, current, temperature, internal resistance, and timestamp. - Frontend Web Client (LayUI): A user-friendly web interface that sends requests to the Spring-Boot backend APIs to fetch data. It displays the data in dynamic tables and charts, allowing users to monitor real-time status and review historical trends of the lithium-ion battery. The B/S architecture ensures accessibility from any device with a web browser.
Port configuration on the cloud server is critical: port 9090 is assigned for HTTP/HTTPS access to the web interface; port 6666 is dedicated to the raw TCP data stream from the WiFi modules; and the default MySQL port 3306 is used for database connections.
4. System Testing and Validation
4.1 Functional Verification
The system’s end-to-end functionality was successfully verified. Data transmitted from the STM32-based monitoring terminal was consistently received and stored in the remote MySQL database. The cloud web interface, accessible via the server’s public IP and port (e.g., http://[Server_IP]:9090), successfully retrieved and displayed the lithium-ion battery parameters in a tabular format, updating at the defined reporting interval.
4.2 Voltage Measurement Accuracy Test
The accuracy of the voltage monitoring circuit was validated against a professional-grade battery tester (CT-4008T-5V6A). Tests were conducted for both charge and discharge cycles on a single 18650 lithium-ion battery.
Charge Test: A discharged battery (2.75V) was charged using a 2A constant current until reaching 4.2V, followed by a constant voltage phase until current dropped to 0.1A. Voltages recorded by our monitoring system were compared with the tester’s measurements at various state-of-charge points.
Discharge Test: A fully charged battery (4.2V) was discharged at a 2A constant current down to 2.75V. Voltage comparisons were made during this process.
The results, showing excellent agreement, are tabulated below:
| Sample Point | System Voltage (V) | Reference Voltage (V) | Absolute Error (V) |
|---|---|---|---|
| 1 | 3.480 | 3.481 | 0.001 |
| 2 | 3.650 | 3.646 | 0.004 |
| 3 | 3.740 | 3.737 | 0.003 |
| 4 | 3.830 | 3.832 | 0.002 |
| 5 | 3.920 | 3.921 | 0.001 |
| Sample Point | System Voltage (V) | Reference Voltage (V) | Absolute Error (V) |
|---|---|---|---|
| 1 | 4.070 | 4.073 | 0.003 |
| 2 | 3.910 | 3.906 | 0.004 |
| 3 | 3.720 | 3.715 | 0.005 |
| 4 | 3.620 | 3.616 | 0.004 |
| 5 | 3.490 | 3.492 | 0.002 |
The maximum observed error was 0.005 V (5 mV), which is within an acceptable range for state-of-charge estimation and health monitoring of a lithium-ion battery.
4.3 Current Measurement Validation
The current measurement subsystem was tested by discharging the lithium-ion battery at two different constant current levels set on the professional tester. The current values reported by our monitoring system were recorded and compared.
| Test Set Point (A) | Measured Current (A) | Absolute Error (A) |
|---|---|---|
| 3.8 | 3.75 – 3.82 | < 0.1 |
| 5.7 | 5.65 – 5.78 | < 0.1 |
The system successfully tracked the discharge current with an error margin of less than 0.1 A, confirming its suitability for monitoring charge/discharge profiles and detecting overcurrent conditions in a lithium-ion battery system.
5. Conclusion
This paper presented the detailed design and implementation of a real-time, remote monitoring system for a lithium-ion battery based on WiFi communication and IoT cloud technology. The system hardware integrates precise sensing for voltage, current, temperature, and internal resistance, coupled with a bidirectional power converter for charge/discharge management. The STM32F407 MCU serves as an effective data aggregator and controller. The use of the ESP-12S WiFi module provides a reliable and cost-effective wireless link to the cloud. The cloud platform, built with Spring-Boot, MySQL, and LayUI, offers a scalable and accessible solution for data storage, visualization, and remote monitoring via a standard web browser.
Comprehensive testing validated the system’s functionality and measurement accuracy. The designed system successfully achieves the goals of remote data acquisition, cloud-based storage, and real-time visualization of lithium-ion battery status. This architecture is highly scalable and forms a solid foundation for future expansion into monitoring multi-cell battery packs or Battery Management Systems (BMS) for electric vehicles and large-scale energy storage, contributing to safer and more efficient utilization of lithium-ion battery technology.
