Battery charging protection method, battery charging protection circuit, device, and medium
Patent Information
- Application Number
- CN202611440322.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-10-30
AI Technical Summary
[0004]本申请实施例的目的是提供一种电池充电保护方法、电池充电保护电路、设备及介质,能够解决采用低成本芯片由于长期插电使用时维持在满电的高压状态,引发电池老化、鼓包,缩短使用寿命的问题
在本申请实施例中,针对低成本充电芯片未配置硬件充电使能引脚的物理局限,通过在输入回路串联MOS开关,利用MCU控制MOS的通断来控制充电芯片的供电,也就是说,仅使用一个通用MOS管和通用MCU,替代了价格昂贵的集成式电源管理芯片或专用电池管理芯片,节约了高精度充电控制的硬件成本。进一步地,利用MCU控制MOS的通断实现了高精度的充电截止与恢复控制,解决了长期插电设备的电池老化问题。
Smart Images

Figure CN123019179A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of battery charging technology, specifically relating to a battery charging protection method, battery charging protection circuit, device and medium. Background Technology
[0002] With the development of IoT technology, various electronic devices that require long-term connection to mains power are becoming increasingly common, such as surveillance cameras, self-service terminals, smart access control systems, industrial sensors, and home smart platforms. These electronic devices typically use low-cost linear charging chips to charge backup lithium batteries.
[0003] However, because low-cost chips typically cannot actively intervene in the charging process, the battery is forced to remain at 100% full charge and high voltage when the device is plugged in for extended periods. This can easily lead to battery aging, bulging, and a shortened battery lifespan. Summary of the Invention
[0004] The purpose of this application is to provide a battery charging protection method, battery charging protection circuit, device and medium, which can solve the problem that using low-cost chips to maintain a fully charged high-voltage state during long-term plug-in use causes battery aging, bulging and shortened service life.
[0005] To solve the above-mentioned technical problems, this application is implemented as follows: In a first aspect, embodiments of this application provide a battery charging protection method applied to a microcontroller unit in a battery charging protection circuit. The charging protection circuit includes a power input, a metal-oxide-semiconductor field-effect transistor (MOS) switch, a charging chip, a lithium battery, a microcontroller unit, and a voltage sampling unit. The charging chip has no hardware charging enable control pin or does not use a charging enable pin. The MOS switch is connected in series between the power input and the input circuit of the charging chip. The voltage sampling unit is used to obtain a sampled voltage value. The method includes: When the power input meets the charging conditions, the MOS switch is turned on to connect the power input to the charging chip and start charging the lithium battery. Based on the sampled voltage value, determine the estimated battery voltage value; The MOS switch is controlled to turn off or on based on the estimated battery voltage, the preset stop charging threshold, and the resume charging threshold; a hysteresis is provided between the stop charging threshold and the resume charging threshold.
[0006] Optionally, controlling the MOS switch to turn off or on based on the battery voltage estimate, a preset stop charging threshold, and a resume charging threshold includes: Based on the estimated battery voltage and the stop charging threshold, the MOS switch is controlled to turn off to cut off the input power to the charging chip; If the estimated battery voltage drops back to the recovery charging threshold, the MOS switch is turned on again to resume charging.
[0007] Optionally, after controlling the MOS switch to turn off or on based on the battery voltage estimate, a preset stop charging threshold, and a resume charging threshold, the method further includes: Switches to full charging mode according to a preset time period; the full charging threshold corresponding to the full charging mode is higher than the stop charging threshold. After controlling the lithium battery to charge to the full charge threshold and maintaining it for a preset duration, switch to lifespan priority mode.
[0008] Optionally, the full charge threshold is 100% state of charge, and the maintenance duration is 30 minutes to 2 hours; The step of controlling the lithium battery to charge to the full charge threshold and maintaining it for a preset time, and then switching to the lifespan priority mode, includes: Control the lithium battery to charge to 100% state of charge and maintain it for 30 minutes to 2 hours; Through natural power consumption or controlled discharge of the system load, the battery power drops back to the protection range corresponding to the lifespan priority mode; the protection range is the state of charge range where the battery voltage is greater than the recovery charging threshold and less than the stop charging threshold.
[0009] Optionally, determining the battery voltage estimate based on the sampled voltage value includes: The sampled voltage value is digitally filtered to obtain the filtered voltage value; The filtered voltage value is corrected according to the preset gain calibration coefficient and offset calibration coefficient to obtain the battery voltage estimate.
[0010] Optionally, the charging protection circuit further includes a temperature sensor for collecting the current ambient temperature; after controlling the MOS switch to turn off or on based on the battery voltage estimate, a preset stop charging threshold, and a resume charging threshold, the method further includes: If the current ambient temperature is lower than a preset low-temperature charging prohibition threshold, the MOS switch is turned off to prevent charging of the lithium battery. If the current ambient temperature is below the preset low-temperature charging limit threshold but above the low-temperature charging prohibition threshold, the charging current will be limited or the charging time will be extended.
[0011] Optionally, the method further includes: Based on the current ambient temperature and the preset temperature-voltage compensation relationship, the charging stop threshold and / or charging resume threshold are dynamically adjusted.
[0012] Secondly, embodiments of this application provide a battery charging protection circuit, which includes a power input, a MOS switch, a charging chip, a lithium battery, a microcontroller unit, and a voltage sampling unit. The charging chip has no hardware charging enable control pin or does not use a charging enable pin. The MOS switch is connected in series between the power input and the input circuit of the charging chip. The voltage sampling unit is used to obtain the sampled voltage value; The microcontroller unit is used for: When the power input meets the charging conditions, the MOS switch is turned on to connect the power input to the charging chip and start charging the lithium battery. Based on the sampled voltage value, determine the estimated battery voltage value; The MOS switch is controlled to turn off or on based on the estimated battery voltage, the preset stop charging threshold, and the resume charging threshold; a hysteresis is provided between the stop charging threshold and the resume charging threshold.
[0013] Thirdly, embodiments of this application provide an electronic device including the battery charging protection circuit described in the second aspect.
[0014] Fourthly, embodiments of this application provide a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the battery charging protection method as described in the first aspect.
[0015] The beneficial effects of this application are: In this embodiment, addressing the physical limitation of low-cost charging chips lacking a hardware charging enable pin, a MOS switch is connected in series in the input circuit. The power supply to the charging chip is controlled by the on / off state of the MOS switch via an MCU. In other words, only a general-purpose MOS transistor and a general-purpose MCU are used, replacing expensive integrated power management chips or dedicated battery management chips, thus saving on the hardware costs of high-precision charging control. Furthermore, using the MCU to control the on / off state of the MOS switch achieves high-precision charging cutoff and recovery control, solving the battery aging problem in long-term plugged-in devices. Attached Figure Description
[0016] Figure 1 This is a block diagram of a battery charging protection circuit provided in an embodiment of this application.
[0017] Figure 2 This is a flowchart of a battery charging protection method provided in an embodiment of this application.
[0018] Figure 3 This is a flowchart illustrating the specific steps of a battery charging protection method provided in an embodiment of this application.
[0019] Figure 4 This is a block diagram of a battery charging protection device provided in an embodiment of this application.
[0020] Figure 5 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0021] The present application will be further described below with reference to the accompanying drawings and embodiments.
[0022] The following will clearly and completely describe the concept, specific structure, and resulting technical effects of this application in conjunction with embodiments and accompanying drawings, so as to fully understand the purpose, features, and effects of this application. Obviously, the described embodiments are only a part of the embodiments of this application, not all of them. Other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are all within the scope of protection of this application. Furthermore, all connections / linkages involved in the patent do not simply refer to direct contact between components, but rather to the ability to form a better connection structure by adding or reducing connecting accessories according to specific implementation conditions. The various technical features in this application can be combined interactively without contradicting each other.
[0023] With the development of IoT technology, various electronic devices that operate continuously with electricity are becoming increasingly common, such as surveillance cameras, self-service terminals, smart access control systems, industrial sensors, and home smart platforms. These devices are typically equipped with a single lithium battery as a backup power source in case of a mains power outage, ensuring business continuity.
[0024] For charging management of the aforementioned devices, the industry typically uses low-cost linear charging chips such as TP4054 and TP4056. These chips have high integration, simple peripheral circuits, and low cost, and are widely used in consumer electronics and industrial control fields. However, the following drawbacks exist in their use.
[0025] 1. The TP4054 and some packages of the TP4056 chips lack a charge enable (CE) pin, making it impossible to directly shut off the charging circuit via the microcontroller unit's (MCU) general purpose input / output (GPIO) ports. This forces the system to passively rely on the chip's internal constant voltage cutoff logic to maintain the battery at 100% charge during prolonged periods of plugging in. When lithium batteries are continuously float-charged at a high voltage of 4.2 volts (V), electrolyte decomposition and electrode passivation accelerate, leading to irreversible capacity degradation and increased internal resistance, severely shortening the lifespan of backup batteries.
[0026] 2. Even when using an MCU for voltage sampling control, a single analog-to-digital converter (ADC) sample is typically performed before a decision is made. Towards the end of the charging process, battery voltage is susceptible to ripple caused by load fluctuations, switching noise, and temperature drift. A single sample is highly prone to misjudgment, leading to frequent switching of the metal-oxide-semiconductor (MOS) transistor near the threshold voltage. This not only generates electromagnetic interference but may also damage power devices. Furthermore, traditional solutions lack a temperature compensation mechanism for the voltage threshold. Under different ambient temperatures, the voltage threshold alone cannot accurately correspond to the battery's state of charge (SOC), resulting in protection point drift.
[0027] 3. Traditional solutions typically only support a single mode of charging until the battery is fully charged, failing to provide flexible configuration based on device application scenarios. For example, for devices that rarely experience power outages, users prefer to limit the charging limit to extend battery life; while for devices that require periodic battery capacity calibration, periodic full charging is necessary. Traditional solutions struggle to implement such intelligent maintenance strategies on low-cost hardware platforms.
[0028] While high-end power management ICs (PMICs) with integrated I²C interfaces exist on the market that can achieve the aforementioned complex functions, their high cost makes them unsuitable for cost-sensitive general-purpose embedded devices. Therefore, how to solve these technical problems through hardware-software co-design while retaining the advantages of low-cost charging chips such as the TP4054 / TP4056 has become a pressing technical challenge in this field.
[0029] To address the aforementioned problems, this application provides a battery charging protection method, a battery charging protection circuit, an apparatus, and a medium. The battery charging protection method provided in this application will be described in detail below with reference to the accompanying drawings.
[0030] Figure 1 This is a battery charging protection circuit provided in an embodiment of this application. For example... Figure 1 As shown, the charging protection circuit includes a power input 101, a MOS switch 102, a charging chip 103, a lithium battery 104, an MCU 105, and a voltage sampling unit 106.
[0031] In this embodiment, the voltage sampling unit 106 is used to obtain the sampled voltage value.
[0032] In this embodiment, the microcontroller unit 105 is configured to: control the MOS switch to turn on when the power input meets the charging conditions, so that the power input is connected to the charging chip and charging of the lithium battery is started; determine the battery voltage estimate based on the sampled voltage value; control the MOS switch to turn off or on based on the battery voltage estimate, a preset stop charging threshold and a resume charging threshold; and provide a hysteresis between the stop charging threshold and the resume charging threshold.
[0033] In some embodiments, power input 101 may be a direct current (DC) input. For example, power input 101 may be a 5V / 9V adapter, a USB port, or the device's main power supply.
[0034] In some embodiments, the MOS switch 102 may be a P-channel metal-oxide-semiconductor field-effect transistor (P-MOSFET).
[0035] In some embodiments, the charging chip 103 is selected from TP4056 or a chip of the same series, such as TP4054.
[0036] In some embodiments, the charging chip 103 has no hardware charging enable control pin or does not use a charging enable pin.
[0037] It should be noted that the charging chip 103 does not have a CE pin, or although it has a CE pin, it cannot be brought out due to the limitations of the package. In other words, since the direct enable control terminal cannot be used, the MCU 105 cannot control the charging chip 103 to start or stop the charging process through a simple level signal, and can only passively rely on the constant voltage cutoff logic inside the chip.
[0038] In some embodiments, the MOS switch 102 is connected in series between the power input 101 and the input circuit (VIN) of the charging chip 103.
[0039] For example, the gate (G) of the MOS switch 102 is controlled by the GPIO port of the MCU 105. When the MCU 105 outputs a low level, the MOS switch 102 is turned on, the power input 101 supplies power to the charging chip 103, and the charging chip 103 starts charging the lithium battery 104; when the MCU 105 outputs a high level, the MOS switch 102 is turned off, and the charging chip 103 stops working due to the loss of input power, thereby realizing the hard cut-off of the charging circuit by software.
[0040] In some embodiments, the voltage sampling unit 106 consists of a voltage divider resistor and an RC filter circuit. The input terminal of the voltage sampling unit 106 is connected to the positive terminal of the lithium battery 104, and the output terminal is connected to the ADC pin of the MCU 105, which is used to convert the high voltage of the lithium battery 104 into a low voltage sampling signal that can be recognized by the MCU 105.
[0041] It should be noted that the MCU needs to monitor the battery's power status in real time to determine when to stop charging. Since the voltage of the lithium battery (typically 3.0V~4.2V) may exceed the tolerance range of the MCU's ADC pin (typically 3.3V), the battery voltage is proportionally converted through the voltage sampling unit 106.
[0042] In some embodiments, the MCU105 is configured to execute computer program instructions stored therein to perform the steps of the charging protection method described below.
[0043] In some embodiments, the charging protection circuit further includes a temperature sensor for acquiring the current ambient temperature, wherein the temperature sensor includes at least one of an internal temperature sensor of the MCU, a negative temperature coefficient (NTC) thermistor, or a battery pack temperature sensor.
[0044] Figure 2 This is a flowchart of a battery charging protection method provided in an embodiment of this application. See also... Figure 2 The method includes the following steps.
[0045] Step 201: When the power input meets the charging conditions, control the MOS switch to turn on, so that the power input is connected to the charging chip and the charging of the lithium battery is started.
[0046] In some embodiments, before step 201, the above method may further include: detecting the power supply status of the power input, and determining that the power input meets preset charging conditions when the power input is normally connected and there is no high or low temperature prohibition charging fault.
[0047] For example, the MCU first monitors the voltage amplitude at the power input terminal in real time through the ADC module or a dedicated voltage detection pin, and detects the battery temperature through an NTC thermistor.
[0048] In some embodiments, when the input voltage is detected to be stable within a preset normal power supply window and no prohibition condition is triggered, it is determined that the power input meets the charging conditions; wherein the prohibition condition includes any of the following: the battery temperature exceeds the safe charging range; the system is in a software-disabled charging mode; the input voltage is undervoltage or overvoltage. For example, the normal power supply window is 4.5V to 6.0V.
[0049] In some embodiments, controlling the MOS switch to turn on includes: the MCU outputs a control signal through the GPIO port to control the MOS switch to switch from off to on.
[0050] For example, the MCU outputs a low-level signal to the gate (G) of the MOSFET, turning on the MOSFET and thus establishing an electrical connection between the power input terminal and the input pin (VIN) of the charging chip.
[0051] Understandably, charging initiation is achieved by the MCU actively controlling the MOS switch to turn on after confirming that the charging conditions are met. Since the charging chip lacks a CE pin, or if it has one but it's not enabled, physically connecting the chip to power through the MOS switch is the only way to initiate the charging process. When the MOS switch is on, an electrical connection is formed between the power input terminal and the VIN of the charging chip, allowing the chip to obtain its operating voltage and initiating the constant current or constant voltage charging process for the lithium battery. In this way, by controlling the timing of the MOS switch's on-time via the MCU, precise management of the charging initiation process is achieved, avoiding false starts due to power fluctuations.
[0052] Step 202: Determine the estimated battery voltage value based on the sampled voltage value.
[0053] In this embodiment, since the sampled voltage value may contain quantization error, voltage divider resistor accuracy error and temperature drift, the MCU cannot directly use the value for judgment, but needs to convert the sampled voltage value into a battery voltage estimate that reflects the true state of the battery.
[0054] In some embodiments, step 203 may include: performing digital filtering on the sampled voltage value to obtain a filtered voltage value; and correcting the filtered voltage value according to a preset gain calibration coefficient and offset calibration coefficient to obtain a battery voltage estimate.
[0055] In some embodiments, the voltage sampling unit continuously acquires multiple ADC sampling values to obtain the sampled voltage value.
[0056] For example, collect data 5 times consecutively, sort the data, and then take the median value.
[0057] In some embodiments, the voltage sampling unit consists of voltage divider resistors R1 and R2 and an RC filter circuit. The input terminal of the voltage sampling unit is connected to the positive terminal of the lithium battery, and the other end is grounded. The sampling point is taken from the common connection node of R1 and R2.
[0058] Step 203: Based on the battery voltage estimate, the preset stop charging threshold, and the resume charging threshold, control the MOS switch to turn off or on.
[0059] In this embodiment, a hysteresis loop is provided between the stop charging threshold and the resume charging threshold. The hysteresis loop is used to avoid frequent switching of the MOS switch caused by small voltage fluctuations.
[0060] It is understandable that hysteresis refers to the voltage lag range formed when the charging stop threshold is higher than the charging recovery threshold. It is used to avoid frequent operation of MOS switches due to voltage fluctuations near the charging cutoff point, thereby improving system reliability.
[0061] In some embodiments, step 203 may include: if the battery is currently in a charging state and the estimated battery voltage reaches the stop charging threshold, then control the MOS switch to turn off, cut off the input power of the charging chip, and stop the lithium battery from charging; if the battery is currently in a stop charging state and the estimated battery voltage drops back to the recovery charging threshold, then control the MOS switch to turn on again and resume charging the lithium battery.
[0062] In some embodiments, after step 203, the method further includes: switching to a target working mode in response to a user configuration instruction or a mode switching instruction sent from the cloud; the target working mode includes any one of lifespan priority mode, balanced mode, full charge mode, intelligent maintenance mode and remote configuration mode; in different working modes, the stop charging threshold, restore charging threshold and charging control logic are configured to different preset strategies.
[0063] In summary, in this embodiment, addressing the physical limitation of low-cost charging chips lacking a hardware charging enable pin, a MOS switch is connected in series in the input circuit. The MCU controls the on / off state of the MOS to control the power supply to the charging chip. In other words, only a general-purpose MOS transistor and a general-purpose MCU are used, replacing expensive integrated power management chips or dedicated battery management chips, thus saving on the hardware costs of high-precision charging control. Furthermore, using the MCU to control the on / off state of the MOS achieves high-precision charging cutoff and recovery control, solving the battery aging problem in long-term plugged-in devices.
[0064] Figure 3 This is a flowchart illustrating the specific steps of a battery charging protection method provided in an embodiment of this application. See also... Figure 3The method includes the following steps.
[0065] Step 301: When the power input meets the charging conditions, control the MOS switch to turn on, so that the power input is connected to the charging chip and the charging of the lithium battery is started.
[0066] The method for this step is similar to that of step 201, and will not be repeated here to avoid repetition.
[0067] Step 302: Perform digital filtering on the sampled voltage value to obtain the filtered voltage value.
[0068] In some embodiments, prior to step 302, the method may further include: obtaining multiple sampled voltage values through a voltage sampling unit at preset sampling intervals. Specifically, for long-term low-power devices, the sampling frequency can be reduced; when charging approaches a threshold, the sampling frequency can be increased.
[0069] For example, collect data 8, 16, or 32 times, and then calculate the average value to reduce random noise.
[0070] For example, the sampling interval is 1 millisecond (ms) to 20 ms. The MCU periodically samples the output of the voltage sampling unit through the ADC. The voltage sampling unit consists of series-connected voltage divider resistors R1 and R2 and an RC filter capacitor C1. R1 is 100 kΩ, R2 is 100 kΩ, and C1 is 0.1 microfarads (μF). The battery voltage is divided by R1 and R2 to obtain the sampled voltage value, and then filtered by C1 to remove high-frequency noise before being sent to the MCU's ADC pin.
[0071] In some embodiments, the sampling point of the voltage sampling unit is taken from the common connection node of R1 and R2, converts the original ADC value into the corresponding analog voltage value, and converts the analog voltage value into the sampled voltage value.
[0072] For example, the MCU converts the raw ADC value into the corresponding analog voltage value as shown below.
[0073]
[0074] in, Indicates the analog voltage value. This is the reference voltage for the MCU. For ADC full-scale counting, This represents the raw value of the ADC.
[0075] For example, the MCU converts the analog voltage value into the battery voltage as shown below.
[0076]
[0077] in, This indicates the sampled voltage value.
[0078] In some embodiments, the sampled voltage value is subjected to extreme value removal averaging and first-order infinite impulse response (IIR) filtering to obtain the filtered voltage value.
[0079] For example, to avoid single spike interference, the maximum and minimum values are removed from N samples, and then the remaining data are averaged. To make the voltage curve smoother, IIR filtering is used to eliminate instantaneous voltage fluctuations caused by load changes and switching power supply ripple. The following formula is used to perform IIR filtering on the sampled voltage values.
[0080] .
[0081] in, This is the filter voltage value for the current cycle. This is the filter voltage value from the previous cycle. The sampled voltage value is the averaged value after removing extreme values, and α is the filtering coefficient.
[0082] For example, α can be taken from 0.7 to 0.95. The larger α is, the smoother the curve, but the slower the response. When approaching the charging stop threshold, α can be appropriately reduced to improve the response speed.
[0083] In some embodiments, the sampled voltage values are subjected to median filtering, for example, by continuously sampling 5 times, sorting them, and then taking the median value.
[0084] In some embodiments, to make the voltage curve smoother, a moving average is used to save the voltage values of the most recent M cycles and average them to obtain the filtered voltage value.
[0085] It's understandable that extreme value averaging is suitable for handling occasional ADC spikes. Median filtering is suitable for handling short-duration pulse interference. If the device has interference sources such as wireless transmitters, motors, or buzzers, sampling can be avoided before and after these actions, or the sampling window can be increased.
[0086] Step 303: Correct the filtered voltage value according to the preset gain calibration coefficient and offset calibration coefficient to obtain the battery voltage estimate.
[0087] In some embodiments, the gain calibration coefficient and the offset calibration coefficient are pre-stored in the non-volatile storage device (Flash) memory of the microcontroller unit.
[0088] For example, during the production testing phase, the system calculates the gain calibration coefficient and offset calibration coefficient using the least squares method under a standard voltage source input, and then burns the gain calibration coefficient and offset calibration coefficient to the non-volatile memory area of the MCU.
[0089] In other embodiments, a calibration update command is received from the cloud, gateway, or host computer via a communication interface. The command includes the gain calibration coefficient, offset calibration coefficient, and check code to be updated. The check code is verified, and after successful verification, the updated gain calibration coefficient and offset calibration coefficient are written into the non-volatile memory of the microcontroller unit.
[0090] Understandably, due to the accuracy errors of the voltage divider resistors R1 and R2, the deviation of the ADC reference voltage, and the offset of the signal link, the voltage value directly calculated by the voltage sampling unit has inherent errors. Therefore, the MCU uses gain calibration coefficients and offset calibration coefficients to correct the sampled voltage value.
[0091] For example, after the MCU reads the current environmental parameters, it first reads the values from the Flash memory and then corrects the filter voltage value according to the following formula.
[0092]
[0093] in, It is the gain calibration coefficient, used to correct for errors in the voltage divider resistors and the ADC gain. It is the offset calibration coefficient, used to correct zero-point deviation.
[0094] In this way, through filtering and calibration, the voltage detection accuracy is improved without increasing the cost of the high-precision reference source, thus ensuring the accuracy of the charging protection threshold.
[0095] Step 304: Based on the estimated battery voltage and the stop charging threshold, control the MOS switch to turn off to cut off the input power to the charging chip.
[0096] In some embodiments, step 304 includes: when the battery is in a charging state and the estimated battery voltage is greater than or equal to the stop charging threshold for a first preset number of consecutive cycles, controlling the MOS switch to turn off to cut off the input power to the charging chip.
[0097] For example, the charging stop threshold is 4.05V, which can be configured according to battery and product requirements. The first preset number of times can be 3, 5, or 10 times; the judgment period for each time can be 1 second, 5 seconds, or longer.
[0098] In some embodiments, after step 304, the method further includes: switching to a target working mode in response to a user configuration instruction or a mode switching instruction sent from the cloud; the target working mode includes any one of a lifespan priority mode, a balanced mode, a full charge mode, an intelligent maintenance mode, and a remote configuration mode; in different working modes, the stop charging threshold, the restore charging threshold, and the charging control logic are configured with different preset strategies.
[0099] For example, the lifespan priority mode is suitable for ordinary user terminals that require both battery life and longevity; the balanced mode is suitable for backup power devices that are plugged in for extended periods; the full charge mode is suitable for emergency scenarios that require the longest possible battery life during power outages; the intelligent maintenance mode can be set according to actual needs; and the remote configuration mode is suitable for centralized operation and maintenance and management of batch devices.
[0100] In one possible implementation, when the target operating mode is balanced mode, the charging stop threshold is the voltage value corresponding to approximately 70%~85% SOC of the lithium battery; the control logic includes: when the estimated battery voltage reaches the charging stop threshold, controlling the MOS switch to turn off to stop charging; when the estimated battery voltage falls back to the charging recovery threshold, controlling the MOS switch to turn on to resume charging, so that the battery is maintained in a safe range of approximately 80% SOC for a long time. In one possible implementation, when the target operating mode is balanced mode, the charging stop threshold is the voltage value corresponding to approximately 85%~95% SOC of the lithium battery; the control logic includes: achieving a balance between lifespan priority mode and full charge mode, taking into account both the battery's backup power range and cycle life.
[0101] In one possible implementation, when the target operating mode is full charge mode, the charging stop threshold is the voltage value corresponding to the lithium battery's 95%~100% state of charge (SOC), or the early shutdown logic based on the voltage estimate is directly disabled; the control logic includes: allowing the charging chip to continuously charge the lithium battery to full charge, or delaying the shutdown of the MOS switch after reaching the full charge threshold.
[0102] In one possible implementation, when the target operating mode is remote configuration, configuration parameters are received from a cloud server, a mobile terminal APP, or a local gateway. The configuration parameters include at least one or more of the following: the selection instruction for the target operating mode, the value of the stop charging threshold, the value of the resume charging threshold, the hysteresis magnitude, the length of the maintenance cycle, and the full charge maintenance duration. The locally stored policy configuration table is updated according to the received configuration parameters, and charging control is executed according to the updated policy.
[0103] In one possible implementation, receiving configuration parameters from a cloud server further includes: validating the received configuration parameters, including verifying whether the numerical range is within a preset security range and verifying the integrity check code of the data packet; after successful verification, writing the updated configuration parameters into a designated storage area in the non-volatile memory of the microcontroller unit, and loading and taking effect upon the next system reset or mode switch.
[0104] Step 305: If the estimated battery voltage drops back to the recovery charging threshold, the MOS switch is turned on again to resume charging.
[0105] In some embodiments, step 305 includes: when the battery is in a stopped charging state and the estimated battery voltage is less than or equal to the charging recovery threshold for a second consecutive preset number of times, re-controlling the MOS switch to turn on to resume charging.
[0106] For example, the charging recovery threshold is 3.90V, which can be configured according to battery and product requirements. The second preset number of times can be 3, 5, or 10 times; the judgment period for each time can be 1 second, 5 seconds, or longer.
[0107] Step 306: Switch to full charge mode according to the preset time cycle.
[0108] In this embodiment, the full charge threshold corresponding to the full charge mode is higher than the stop charging threshold, and the full charge threshold is the stop charging threshold corresponding to the full charge mode.
[0109] For example, the full charge threshold can be 100% state of charge. For instance, the full charge threshold could be 4.2V, 4.8V, etc.
[0110] In some embodiments, the MCU internally operates a maintenance cycle timer. The system defaults to a lifespan priority mode, which controls the battery level to remain below a charging stop threshold. The MCU monitors the timer in real time, and when the timer value reaches a preset maintenance cycle, the MCU automatically triggers an intelligent maintenance process, switching from lifespan priority mode to full charge mode. For example, the maintenance cycle can be configured via software according to the device application scenario; the maintenance cycle can be 30 days, or any cycle from 15 days to 90 days.
[0111] In some embodiments, the MCU controls the MOS switch to remain on, allowing the charging chip to continuously charge the lithium battery. During this process, the MCU continues to monitor the battery voltage through the voltage sampling unit. When the estimated battery voltage reaches the full charge threshold and meets the stability condition, the battery is determined to be fully charged; the stability condition includes the battery voltage obtained from 10 consecutive samplings being above the full charge threshold.
[0112] Step 307: After controlling the lithium battery to charge to the full charge threshold and maintaining it for a preset duration, switch to lifespan priority mode.
[0113] For example, the duration can be any length of time, from 30 minutes to 3 hours.
[0114] In some embodiments, after determining that the battery is fully charged, the MCU does not immediately turn off the MOS switch, but instead starts a sustain timer to control the battery to maintain the fully charged state for a preset sustain period. During this period, the charging chip automatically enters the micro-current replenishment state at the end of constant voltage charging.
[0115] In the embodiments of this application, the micro-current charging state can eliminate the cumulative error of the fuel gauge caused by long-term shallow charging and discharging; it also promotes the full reaction of the chemical substances inside the battery, which helps to alleviate battery passivation.
[0116] In some embodiments, the full charge threshold is 100% state of charge, and the duration is maintained for 30 minutes to 3 hours; step 307 includes: Step 3071: Control the lithium battery to charge to 100% and maintain it for 30 minutes to 3 hours; Step 3072: Through the natural power consumption or controlled discharge of the system load, the battery power drops back to the protection range corresponding to the life priority mode.
[0117] In this embodiment of the application, the protection range is the state of charge range in which the battery voltage is greater than the recovery charging threshold and less than the stop charging threshold.
[0118] For example, the protection range is the voltage range corresponding to 80% SOC.
[0119] In one possible implementation, the system load is switched to DC input power, and the battery is in an open circuit or micro-load state; the system load naturally dissipates or is controlled to fall back to the protection range of the life-priority mode.
[0120] In one possible implementation, the voltage is gradually reduced by utilizing the system's internal quiescent current and periodic self-test power consumption.
[0121] In another possible implementation, if the voltage does not drop back to the target range within a specified time, the MCU can control the activation of an internal load for short-term discharge until the voltage drops to a protection range above the recovery charging threshold and below the stop charging threshold.
[0122] For example, after the device is connected to a 5VDC power supply, the system load is directly powered by DC. The MCU controls the MOS to turn on, enabling the TP4054 / TP4056 to receive input and begin charging a single 3.7V lithium battery. The battery voltage passes through a voltage divider resistor and enters the MCU's ADC. The MCU samples the voltage 16 times consecutively, removes the maximum and minimum values, calculates the average, and then filters it through an IIR filter to obtain a stable voltage value. When the filtered battery voltage reaches the protection threshold configured according to the battery's SOC curve and meets the criteria for 5 consecutive times, the MCU turns off the MOS, disconnecting the input of the TP4054 / TP4056, and the battery stops charging. Afterward, the device continues to operate on DC power, and the battery remains in the protection range as a backup power source. If the battery voltage drops below the recovery threshold, or if the user switches to full charge mode via software, the MCU turns the MOS back on to resume charging. The MCU temporarily allows full charging once a month, and after full charging is complete, it re-enters the approximately 80% protection strategy. This process records maintenance time, maximum voltage, charging duration, and abnormal states, and reports these data via the communication interface.
[0123] Thus, for devices that rarely experience power outages, users prefer to limit the charging limit to extend lifespan, while for devices that require periodic battery capacity calibration, periodic full charging is necessary. By performing the aforementioned periodic full charge calibration, the problem of inaccurate battery capacity estimation and shortened lifespan of low-cost devices under long-term shallow charge and discharge conditions is effectively solved.
[0124] Step 308: When the current ambient temperature is lower than the preset low-temperature charging prohibition threshold, control the MOS switch to turn off and prohibit charging the lithium battery.
[0125] For example, the low-temperature charging prohibition threshold is 0°C. In some embodiments, the MCU acquires the current ambient temperature at a frequency of 1 Hz using a temperature sensor and performs a moving average filter on the sampled data to eliminate the effects of instantaneous temperature fluctuations.
[0126] In some embodiments, the MCU may use a built-in semiconductor temperature sensor, a negative temperature coefficient thermistor attached to the battery surface, or a digital temperature sensor integrated inside the battery pack. Taking an NTC as an example, the NTC is connected in series with a precision resistor of a fixed resistance value to form a voltage divider circuit. The MCU acquires the voltage across the NTC through its ADC pin and calculates the current temperature value based on the NTC's resistance-temperature characteristic curve.
[0127] In some embodiments, when the current ambient temperature is lower than a preset low-temperature charging prohibition threshold, the MCU controls the MOS switch to turn off, cutting off the input power to the charging chip and prohibiting any form of charging operation on the lithium battery.
[0128] In this way, regardless of whether the estimated battery voltage is lower than the recovery charging threshold, the possibility of low-temperature lithium plating can be reduced from a physical perspective, forming the first line of defense for charging safety.
[0129] In some embodiments, the method further includes: during the production testing phase, recording the temperature deviation between the original temperature value measured by the temperature sensor at a known standard temperature and the standard temperature value; calculating a temperature offset calibration coefficient based on the temperature and storing it in a non-volatile memory. Accordingly, before step 308, the method further includes: calibrating the original temperature acquired by the temperature sensor according to the temperature offset calibration coefficient to obtain the current ambient temperature.
[0130] For example, the temperature offset calibration factor is Current ambient temperature ,in, This indicates the original temperature.
[0131] Step 309: If the current ambient temperature is lower than the preset low-temperature charging limit threshold but higher than the low-temperature charging prohibition threshold, limit the charging current or extend the charging time.
[0132] For example, the low-temperature charging limit threshold is 10°C.
[0133] In some embodiments, when the current ambient temperature is below a preset low-temperature charging limit threshold but above a low-temperature charging prohibition threshold, the MCU limits the maximum output current of the charging chip to 50% of its nominal value by controlling the enable signal or adjusting the peripheral circuitry. A smaller charging current helps reduce the polarization effect inside the battery, decreases heat generation, slows the voltage rise rate, and allows the battery to be safely charged at low temperatures.
[0134] In some embodiments, the total charging time will increase accordingly due to current limitation. The charging timer inside the MCU automatically adapts to this change, no longer using the standard charging time at room temperature as the criterion for full charge, but instead using the actual full charge threshold reached.
[0135] In some embodiments, if the current ambient temperature is below a preset low-temperature charging limit threshold but above a low-temperature charging prohibition threshold, it is determined that the current environment allows charging, but the battery activity is low and the internal resistance is high. In this case, if the estimated battery voltage meets the charging recovery conditions, the MCU controls the MOS switch to turn on, starting charging, but simultaneously activating the limited charging mode.
[0136] In this way, while ensuring low-temperature safety, the equipment's backup power capability in cold environments is preserved to the greatest extent.
[0137] In some embodiments, the above method further includes: dynamically adjusting the stop charging threshold and / or resume charging threshold according to the current ambient temperature and a preset temperature-voltage compensation relationship.
[0138] For example, the MCU's internal Flash memory pre-stores a multidimensional lookup table, which is indexed by temperature and records the corresponding stop charging threshold and resume charging threshold for different temperature ranges.
[0139] In one possible implementation, the target temperature range to which the current ambient temperature belongs is determined by traversing a lookup table based on the current ambient temperature; the stop charging threshold and resume charging threshold corresponding to the target temperature range are then used as the adjusted stop charging threshold and resume charging threshold.
[0140] In some embodiments, the method further includes: correcting the actual SOC estimate of the battery by looking up a table based on the temperature-state-of-charge (SOC).
[0141] In this way, the charging stop threshold and / or charging resume threshold are dynamically adjusted under different ambient temperatures, reducing the risk of protection point drift caused by the inaccurate correspondence between the voltage threshold and the battery's state of charge (SOC).
[0142] In some embodiments, the above method further includes: when the current ambient temperature is higher than a preset high temperature protection threshold, controlling the MOS switch to turn off, stopping the charging of the lithium battery, and generating temperature abnormality reporting information; after stopping charging, if it is detected that the current ambient temperature has fallen back to the safe temperature range, then allowing the MOS switch to be turned on again to resume charging based on the battery voltage estimate.
[0143] In summary, in this embodiment, firstly, the MOS switch is controlled to turn off or on based on the charging stop threshold and the charging resume threshold, ensuring that the battery does not immediately restart charging due to minor voltage ripples after charging stops. This effectively reduces the number of invalid MOS switch operations, extends the lifespan of power devices and the battery, and ensures the stability of the system under long-term plug-in conditions. Secondly, the intelligent maintenance mode solves the problems of SOC estimation drift and battery activity degradation in low-cost devices under long-term shallow charge and discharge conditions. This not only helps correct the cumulative error of the fuel gauge and ensures the accuracy of the power display, but also activates the chemical substances inside the battery, alleviating battery passivation, thus achieving the best balance between extending battery life and maintaining battery health. Thirdly, digital filtering effectively suppresses random noise and ripple interference in the sampling signal, solving the problem of voltage reading jumps; while gain and offset calibration eliminate systematic measurement errors such as voltage divider resistor accuracy errors and ADC reference voltage deviations. Finally, a two-level protection architecture with low-temperature charging prohibition threshold and low-temperature charging restriction threshold is set to address the safety hazard of lithium ions precipitating on the negative electrode surface and forming lithium dendrites when lithium batteries are charged at low temperatures, thereby reducing the risk of short circuits, leakage or explosion caused by low-temperature charging.
[0144] Figure 4 This is a block diagram of a battery charging protection device provided in an embodiment of this application, such as... Figure 4 As shown, the battery charging protection device 400 is applied to the microcontroller unit in the battery charging protection circuit and includes the following modules.
[0145] The first switch control module 401 is used to control the MOS switch to turn on when the power input meets the charging conditions, so that the power input is connected to the charging chip and the charging of the lithium battery is started. The voltage calculation module 402 is used to determine the estimated battery voltage value based on the sampled voltage value; The second switch control module 403 is used to control the MOS switch to turn off or on based on the battery voltage estimate, the preset stop charging threshold and the resume charging threshold; a hysteresis is provided between the stop charging threshold and the resume charging threshold.
[0146] Optionally, the second switch control module 403 is specifically used for: Based on the estimated battery voltage and the stop charging threshold, the MOS switch is controlled to turn off, thereby cutting off the input power to the charging chip. If the estimated battery voltage drops back to the charging recovery threshold, the MOS switch is turned on again to resume charging.
[0147] Optionally, the battery charging protection device 400 further includes a charging module switching module for: Switches to full charging mode according to a preset time period; the full charging threshold corresponding to full charging mode is higher than the stop charging threshold. After controlling the lithium battery to charge to the full charge threshold and maintaining it for the preset duration, switch to lifespan priority mode.
[0148] Optionally, the full charge threshold is 100% state of charge, maintained for 30 minutes to 2 hours; the charging module switching module is specifically used for: Control the lithium battery to charge to 100% and maintain it for 30 minutes to 2 hours; Through natural power consumption or controlled discharge of the system load, the battery power drops back to the protection range corresponding to the lifespan priority mode; the protection range is the state of charge range where the battery voltage is greater than the recovery charging threshold and less than the stop charging threshold.
[0149] Optionally, the voltage calculation module 402 is specifically used for: The sampled voltage value is digitally filtered to obtain the filtered voltage value; The filtered voltage value is corrected based on the preset gain calibration coefficient and offset calibration coefficient to obtain the battery voltage estimate.
[0150] Optionally, the charging protection circuit also includes a temperature sensor for acquiring the current ambient temperature, and the battery charging protection device 400 also includes a charging temperature protection module for: When the current ambient temperature is lower than the preset low-temperature charging prohibition threshold, the MOS switch is turned off to prevent charging of the lithium battery. If the current ambient temperature is below the preset low-temperature charging limit threshold but above the low-temperature charging prohibition threshold, the charging current will be limited or the charging time will be extended.
[0151] Optionally, the battery charging protection device 400 also includes a charging threshold adjustment module for: Based on the current ambient temperature and the preset temperature-voltage compensation relationship, the charging stop threshold and / or charging resume threshold are dynamically adjusted.
[0152] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0153] Figure 5 This is a structural block diagram of an electronic device according to an exemplary embodiment. In some embodiments, the electronic device includes the battery charging protection circuit described above. Figure 5As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the steps of the battery charging protection method of the aforementioned embodiment.
[0154] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory including instructions that can be executed by a processor of an electronic device to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0155] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described battery charging protection method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0156] This application also provides a computer program product, including a computer program that implements a battery charging protection method when executed by a processor.
[0157] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar parts between the various embodiments can be referred to each other.
[0158] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0159] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks of the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0160] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a predictive manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0161] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0162] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0163] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0164] The above is a detailed description of the preferred embodiments of this application. However, the invention of this application is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
Claims
1. A battery charging protection method, characterized in that, A microcontroller unit is used in a battery charging protection circuit. The charging protection circuit includes a power input, a metal-oxide-semiconductor field-effect transistor (MOS) switch, a charging chip, a lithium battery, the microcontroller unit, and a voltage sampling unit. The charging chip has no hardware charging enable control pin or does not use a charging enable pin. The MOS switch is connected in series between the power input and the input circuit of the charging chip. The voltage sampling unit is used to obtain a sampled voltage value. The method includes: When the power input meets the charging conditions, the MOS switch is turned on to connect the power input to the charging chip and start charging the lithium battery. Based on the sampled voltage value, determine the estimated battery voltage value; The MOS switch is controlled to turn off or on based on the estimated battery voltage, the preset stop charging threshold, and the resume charging threshold; a hysteresis is provided between the stop charging threshold and the resume charging threshold.
2. The method according to claim 1, characterized in that, The step of controlling the MOS switch to turn off or on based on the estimated battery voltage value, a preset stop charging threshold, and a resume charging threshold includes: Based on the estimated battery voltage and the stop charging threshold, the MOS switch is controlled to turn off to cut off the input power to the charging chip; If the estimated battery voltage drops back to the recovery charging threshold, the MOS switch is turned on again to resume charging.
3. The method according to claim 1, characterized in that, After controlling the MOS switch to turn off or on based on the battery voltage estimate, a preset stop charging threshold, and a resume charging threshold, the method further includes: Switches to full charging mode according to a preset time period; the full charging threshold corresponding to the full charging mode is higher than the stop charging threshold. After controlling the lithium battery to charge to the full charge threshold and maintaining it for a preset duration, switch to lifespan priority mode.
4. The method according to claim 3, characterized in that, The full charge threshold is 100% state of charge, and the maintenance duration is 30 minutes to 2 hours; The step of controlling the lithium battery to charge to the full charge threshold and maintaining it for a preset time, and then switching to the lifespan priority mode, includes: Control the lithium battery to charge to 100% state of charge and maintain it for 30 minutes to 2 hours; Through natural power consumption or controlled discharge of the system load, the battery power drops back to the protection range corresponding to the lifespan priority mode; the protection range is the state of charge range where the battery voltage is greater than the recovery charging threshold and less than the stop charging threshold.
5. The method according to claim 1, characterized in that, The step of determining the battery voltage estimate based on the sampled voltage value includes: The sampled voltage value is digitally filtered to obtain the filtered voltage value; The filtered voltage value is corrected according to the preset gain calibration coefficient and offset calibration coefficient to obtain the battery voltage estimate.
6. The method according to claim 1, characterized in that, The charging protection circuit also includes a temperature sensor for collecting the current ambient temperature; after controlling the MOS switch to turn off or on based on the battery voltage estimate, a preset stop charging threshold, and a resume charging threshold, the method further includes: If the current ambient temperature is lower than a preset low-temperature charging prohibition threshold, the MOS switch is turned off to prevent charging of the lithium battery. If the current ambient temperature is below the preset low-temperature charging limit threshold but above the low-temperature charging prohibition threshold, the charging current will be limited or the charging time will be extended.
7. The method according to claim 6, characterized in that, The method further includes: Based on the current ambient temperature and the preset temperature-voltage compensation relationship, the charging stop threshold and / or charging resume threshold are dynamically adjusted.
8. A battery charging protection circuit, characterized in that, The charging protection circuit includes a power input, a MOS switch, a charging chip, a lithium battery, a microcontroller unit, and a voltage sampling unit. The charging chip has no hardware charging enable control pin or does not use a charging enable pin. The MOS switch is connected in series between the power input and the input circuit of the charging chip. The voltage sampling unit is used to obtain the sampled voltage value; The microcontroller unit is used for: When the power input meets the charging conditions, the MOS switch is turned on to connect the power input to the charging chip and start charging the lithium battery. Based on the sampled voltage value, determine the estimated battery voltage value; The MOS switch is controlled to turn off or on based on the estimated battery voltage, the preset stop charging threshold, and the resume charging threshold; a hysteresis is provided between the stop charging threshold and the resume charging threshold.
9. An electronic device, characterized in that, Includes the battery charging protection circuit as described in claim 8.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the battery charging protection method as described in any one of claims 1-7.
