Design of a portable device battery monitoring system based on BQ27210
2026-04-06 04:46:26··#1
[b]1 Introduction[/b] With the continued trend of functional integration and technological convergence, portable devices such as digital camcorders, smartphones, and media players are placing increasingly higher demands on power supply. These portable devices are typically battery-powered; however, battery life is limited. To ensure continuous and complete use, operators need to promptly monitor the remaining battery capacity and available time to prevent unexpected shutdowns due to battery depletion and unnecessary data loss. The BQ27210, a battery monitoring device from TI, is primarily used in portable devices such as digital camcorders, smartphones, PDAs, and MP3 players to provide high-precision monitoring and reporting of power systems composed of individual lithium-ion and lithium-polymer batteries. This device determines battery charging and discharging by monitoring the voltage drop of a small current-sensing resistor connected in series with the battery. It also compensates for battery usage time, capacity, temperature, self-discharge, and discharge rate to provide information such as usable time under various operating conditions. During a discharge cycle from full to empty, it automatically recalibrates or acquires battery capacity. The device's internal registers record information such as battery capacity, current, voltage, usable time, charging status, and temperature. An external processor can communicate with the BQ27210 via the I2C serial bus to read real-time information such as battery capacity, temperature, and usable time recorded in the chip's internal registers. [b]2 Main Features and Pin Functions[/b]The main features of the BQ27210 are: I2C serial interface communication; accurate reporting of battery usage time, discharge rate, temperature, voltage, current, and other information; high-precision integrated charging and discharging current with automatic offset calibration, eliminating the need for user calibration; programmable input/output ports; internal user-configurable EEPROM memory; stable oscillator without external components; detection delay after dynamic discharge, allowing use in high dynamic load environments; automatic sleep mode when communication lines are low; and an operating temperature range of -20°C to 70°C. The BQ27210 uses a small QFN package, and its pin functions are as follows: BAT is the battery voltage sensing input; GPIO is a general purpose input/output terminal, which can be programmed; PGM is the EEPROM programming voltage input; RBI is the spare register input; SCL is the serial clock interface, used for data communication with the microcontroller; SDA is the serial data interface, used for data communication with the microcontroller; SRN is the battery charging/discharging current detection input (negative terminal); SRP is the battery charging/discharging current detection input (positive terminal); VCC is the power input; VSS is the ground terminal. [b]3 Working Principle[/b]The internal structure block diagram of the BQ27210 is shown in Figure 1. This device stores calculated data related to battery charging and discharging in its internal RAM. This data can be maintained by the voltage on the RBI, while the EPPROM is used to store permanent user data. Since the BQ27210 integrates an A/D converter and a temperature sensor, obtaining battery parameters such as voltage and temperature only requires an external processor to issue voltage and temperature control commands to the device. After sampling, the chip automatically stores the voltage and temperature measurements into the corresponding RAM registers, which are then read by the external processor. [img=333,206]http://21ic.com/news/upload/2008_11/081112094225571.jpg[/img] The most significant feature of this chip is its ability to monitor battery power in real time during battery use and update the parameters in the LMD register (latest battery discharge level) in RAM based on the latest monitored battery power value. The BQ27210 also retains the updated parameters and stores them in the LMD register until the register is reset. Throughout the entire battery charging and discharging process, the BQ27210 continuously monitors and updates real-time parameters related to battery power. The BQ27210's workflow is shown in Figure 2. [img=377,215]http://21ic.com/news/upload/2008_11/081112094225572.jpg[/img][b]4 Typical Applications 4.1 Interface Circuit[/b]Since the BQ27210 is commonly used in portable devices, a small, low-power microcontroller, the C8051F304, is used for hardware connection. The C8051F304 is a fully integrated mixed-signal system-on-a-chip (SoC) with only 11 pins. It features an 8051 microcontroller core with a pipelined architecture and a speed of up to 25 m/s. It includes a full-speed, non-intrusive in-circuit debug interface and an integrated SMBus I/O interface, fully compliant with the System Management Bus Specification version 1.1 and compatible with the I2C serial bus. The most unique feature of the C8051F304 is its digital crossbar switch, which allows internal digital system resources to be mapped to port I/O pins. By setting the value in the digital crossbar switch control register, the on-chip serial bus can be configured on the port I/O pins, and data transmission with the BQ27210 is automatically controlled by the SoC's SMBus serial interface. The interface circuit between the BQ27210 and the C8051F304 is shown in Figure 3. [img=645,269]http://21ic.com/news/upload/2008_11/081112094225573.jpg[/img] In Figure 3, the BQ27210 determines the battery's charging and discharging by monitoring the voltage drop across a small current-sensing resistor Rs connected in series with the battery. When the detected communication line voltage is low, the power supply is cut off, or the battery needs to be replaced, the system automatically enters sleep mode. Simultaneously, the device's voltage sensing pin BAT and current sensing pins SRN and SRP are connected to the battery via resistors and capacitors to measure voltage and charging/discharging current. RBI provides backup voltage to the internal register through connection to an external capacitor C8. Specifically, when VCC is above the threshold voltage, the capacitor charges; when VCC is below the threshold voltage, the capacitor provides a data-maintaining voltage for a period of time. During this time, the chip's internal register records the current data information. As long as the RBI voltage is above 1.3V, the data will be retained. The P0.0 and P0.1 ports of the C8051F304 are connected to the SCL and SDA pins of the BQ27210, and data transmission is achieved through the I2C bus. This is used by the microcontroller control circuit to query the battery charging and discharging status or handle interrupts. Simultaneously, this serial interface circuit can also be used to read and write various internal registers in the BQ27210 to read the required battery information. [b]4.2 Software Design[/b] The software design consists of two parts. The first is the initialization configuration of the C8051F304 microcontroller port I/O. This is mainly achieved by correctly configuring the values in the port I/O cross switch registers XBR0, XBR1, and XBR2 to enable the digital cross switch. At the same time, P0.0 and P0.1 ports are assigned to SDA and SCL. Assigning 0x00 to register XBR0 ensures that the cross switch does not skip any pins; simply setting bit 2 of register XBR1 to "1" connects SDA and SCL to the pins. The second part is the initialization configuration of the BQ27210's EEPROM. In fact, the correct configuration information can be stored in the EEPROM via the I2C bus interface. This important information includes the calculated initial battery discharge rate, EDV1 and EDVF threshold voltages, initial standby load current, discharge rate compensation constant, temperature compensation constant, etc. Each time the BQ27210 undergoes a strong reset, it forcibly writes the updated EEPROM information into the corresponding RAM register. However, it is important to note that before writing any data to the EEPROM data area, programming mode must be enabled. This is activated by writing the data 0xDD to the EE_EN register address 0x6E. Simultaneously, a 21V pulse signal with a duration of 50ms is applied to the PGM pin, thus writing the required data to the appropriate address in the EEPROM. Figure 4 shows the EEPROM programming flowchart for the BQ27210. [img=283,232]http://21ic.com/news/upload/2008_11/081112094225574.jpg[/img] The following is a partial program code showing how the C8051F304 microcontroller reads the latest battery discharge level and battery voltage information stored in the internal RAM of the BQ2721O via the I2C bus protocol: [img=422,782]http://21ic.com/news/upload/2008_11/081112094225575.jpg[/img] 5 Conclusion When using this instrument, please note the following: Before turning it on, reduce the treatment dose to avoid current stimulation. The treatment area should be relaxed; the arm should not be bent, and the hand should not be clenched. Treatment is strictly prohibited on the heart and temple areas. The therapeutic device designed using the embedded device AT89C51 SND1C has achieved the expected therapeutic effect, but the functions of this electronic therapeutic device still need to be further improved, such as the automatic memory of treatment dosage and the automatic matching of symptoms with song melodies.