Voltage detection method, terminal equipment and computer readable storage medium
By obtaining the voltage sampling value and temperature of the battery module, combining it with the internal resistance to determine the float pressure, and calculating the battery module voltage, the problem of inaccurate voltage detection in complex charging scenarios of communication products is solved, and the accuracy and stability of the battery voltage and power percentage are achieved.
Patent Information
- Application Number
- CN202511072623.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-10-10
AI Technical Summary
In the prior art, communication products are unable to accurately detect battery voltage in complex charging scenarios, resulting in inaccurate battery power percentage.
By obtaining the voltage sampling value of the battery module, combining the temperature and internal resistance to determine the float pressure, and using the formula V=Vs-Vf-Vd or V=Vs+Vj+Vd to calculate the battery module voltage, voltage fluctuations and voltage drops are compensated to improve the accuracy of voltage detection.
The accuracy of battery voltage detection and the stability of power percentage are improved, voltage instability and jump are avoided, and the accuracy of battery power display is ensured.
Smart Images

Figure CN120761890A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of voltage detection, and in particular to a voltage detection method, a terminal device, and a computer-readable storage medium. Background Art
[0002] Currently, some communication products, such as portable Wi-Fi and portable routers, can only approximate the battery voltage by sampling the device's battery voltage signal using an analog-to-digital converter (ADC). However, in complex charging scenarios, the ADC sampling value cannot accurately reflect the battery voltage. Therefore, it is necessary to develop a voltage detection method to improve the accuracy of battery module voltage detection. Summary of the Invention
[0003] The embodiments of the present application provide a voltage detection method, which solves the problem of low accuracy in detecting the voltage of a battery module.
[0004] In a first aspect, an embodiment of the present application provides a voltage detection method, which is applied to a terminal device, wherein the terminal device includes a battery module, and the method includes: obtaining a voltage sampling value of the battery module; when the battery module is in a charging state, determining a float pressure based on the temperature of the battery module, wherein the float pressure is the voltage generated by the internal resistance of the battery module when the battery module is in the charging state; and determining the voltage of the battery module based on the voltage sampling value and the float pressure.
[0005] In an embodiment of the present application, by determining the float pressure, the terminal device is informed of the voltage generated by the internal resistance of the battery module when the battery module is in a charging state, thereby enabling the terminal device to determine the voltage of the battery module based on the voltage sampling value and the float pressure, thereby avoiding inaccurate voltage of the battery module due to float pressure, and thereby improving the accuracy of the voltage of the battery module obtained by sampling.
[0006] In one possible implementation, determining the float pressure based on the temperature of the battery module includes: when the temperature of the battery module is within a set temperature range, determining the float pressure based on a first current and the internal resistance of the battery module, the first current being a charging current configured according to a charging type; and when the temperature of the battery module exceeds the set temperature range, determining the float pressure based on a second current and the internal resistance, the second current being a preset current.
[0007] In the implementation, the set temperature is a temperature range for safe charging of the battery module. The temperature of the battery module is within the set temperature range and beyond the set temperature range, and the currents for determining the floating voltage are different, so the floating voltage determined in the two cases is different. By distinguishing the two cases of the temperature of the battery module being within the set temperature range and beyond the set temperature range, the determined floating voltage is more accurate, so that the voltage of the battery module determined according to the voltage sampling value and the floating voltage is more accurate.
[0008] In a possible implementation, the determining the voltage of the battery module according to the voltage sampling value and the floating voltage comprises: in a case where the battery module is in a charging state and the terminal device is in an initial start-up stage, the voltage of the battery module is determined according to the following formula:
[0009] V = V s - V f - V d
[0010] wherein V is the voltage of the battery module, V s is the voltage sampling value, V f is the floating voltage, and V d is a compensation voltage.
[0011] In the implementation, in a case where the battery module is in a charging state and the terminal device is in an initial start-up stage, because the voltage is unstable in the initial start-up stage, the voltage sampling value has voltage fluctuation in addition to the floating voltage. Therefore, the voltage of the battery module is equal to the voltage sampling value minus the floating voltage minus the compensation voltage, and the compensation voltage is generally 10-20 mV. By subtracting the compensation voltage, the voltage instability caused by voltage fluctuation can be avoided. The voltage of the battery module determined by the method is more in line with the change rule of the voltage of the battery module in the initial start-up stage and in the charging state, so that a more accurate voltage of the battery module can be determined.
[0012] In a possible implementation, the method further comprises: in a case where the battery module is in an uncharged state and the terminal device is in an initial start-up stage, determining the voltage of the battery module according to the voltage sampling value, a voltage drop and the compensation voltage.
[0013] In this implementation, when the battery module is uncharged and the terminal device is in the initial startup phase, the battery sampling value does not have floating voltage. However, due to the high power consumption of the terminal device in the initial startup phase, the voltage sampling value has a voltage drop. Furthermore, the voltage is unstable in the initial startup phase, and in addition to the voltage drop, the voltage sampling value also has voltage fluctuations. Therefore, the battery module voltage is equal to the voltage sampling value plus the voltage drop plus the compensation voltage, which is generally 10 to 20 mV. The battery module voltage determined by this method is more consistent with the variation pattern of the battery module voltage in the initial startup phase and in the uncharged state, thereby being able to determine a more accurate battery module voltage.
[0014] In a possible implementation, after determining the voltage of the battery module, the method further includes: determining a final power percentage of the battery module according to the voltage of the battery module.
[0015] In this implementation, the final power percentage of the battery module is determined according to the voltage of the battery module. By improving the accuracy of the voltage of the battery module, the accuracy of the final power percentage of the battery module can be improved.
[0016] In one possible implementation, determining the final power percentage of the battery module based on the voltage of the battery module includes: when the terminal device is in the initial stage of startup, determining the final power percentage of the battery module based on the voltage of the battery module; or, when the terminal device is in a stable period after startup, determining the initial power percentage of the battery module based on the voltage of the battery module; and determining the final power percentage of the battery module based on the initial power percentage and the future change trend of the power percentage of the battery module.
[0017] In this implementation, the final battery percentage is determined differently for the initial startup phase and the post-startup stabilization phase. By determining the final battery percentage based on whether the terminal device is in the initial startup phase, the final battery percentage is more accurate.
[0018] In a possible implementation, the determining of the final power percentage of the battery module based on the initial power percentage and the future change trend of the power percentage of the battery module includes: when the terminal device is in a stable period after startup and the battery module is in a charging state, if the future change trend of the power percentage of the battery module is: increasing by a first preset value for N1 consecutive times or increasing by D1 for N2 consecutive times, then determining the final power percentage to be the initial power percentage plus a second preset value; or, if the future change trend of the power percentage of the battery module is: decreasing by D2 for N3 consecutive times, then determining the final power percentage to be the initial power percentage minus the second preset value; or, if the future change trend of the power percentage of the battery module is: increasing by the first preset value for n1 consecutive times, or increasing by D1 for n2 consecutive times, or decreasing by D2 for n3 consecutive times, or remaining unchanged, then determining the final power percentage to be the initial power percentage, wherein N1, N2, N3, n1, n2, and n3 are positive integers, and N1 <N2<N3,n1<N1,n2<N2,n3<N3,D1、D2为百分数,且D1大于所述第一预设值,D2大于0。
[0019] The first preset value is a change granularity of the power percentage of the battery module, and the second preset value is an adjustment granularity for determining the final power percentage by adjusting the initial power percentage of the battery module.
[0020] In this implementation, when the battery module is charging and the terminal device is in a stable period after power-on, the final battery percentage is determined based on the battery module's future change trend, making the final battery percentage more accurate. Determining the final battery percentage by observing several consecutive battery percentage changes can avoid jumps in the battery percentage and ensure a stable change in the battery percentage.
[0021] In a possible implementation, determining the final power percentage of the battery module based on the change in the initial power percentage and the power percentage of the battery module includes: when the terminal device is in a stable period after power-on and the battery module is in an uncharged state, if the future change trend of the power percentage of the battery module is: decreasing by the first preset value for N4 consecutive times, or decreasing by D3 for N5 consecutive times, or decreasing by D4 for N6 consecutive times, then determining the final power percentage to be the initial power percentage minus the second preset value; or, if the future change trend of the power percentage of the battery module is: decreasing by the first preset value for n4 consecutive times, or decreasing by D3 for n5 consecutive times, or decreasing by D4 for n6 consecutive times, or remaining unchanged, or increasing, then determining the final power percentage to be the initial power percentage, wherein N4, N5, N6, n4, n5, and n6 are positive integers, and N4 <N5<N6,n4<N4,n5<N5,n6<N6,D3、D4均为百分数,且D3、D4均大于所述第一预设值,D3<D4。
[0022] In this implementation, when the battery module is uncharged and the terminal device is in a stable period after power-on, the final battery percentage is determined based on the battery module's future change trend, making the final battery percentage more accurate. Determining the final battery percentage by observing several consecutive battery percentage changes can avoid jumps in the battery percentage and ensure a stable change in the battery percentage.
[0023] In the second aspect, an embodiment of the present application provides a communication device, comprising: a battery module for powering the terminal device; a voltage sampling module for obtaining a voltage sampling value of the battery module; a processing module for determining a float pressure according to the temperature of the battery module when the battery module is in a charging state, the float pressure being the voltage generated by the internal resistance of the battery module when the battery module is in the charging state; the processing module is also used to determine the voltage of the battery module based on the voltage sampling value and the float pressure.
[0024] In a third aspect, an embodiment of the present application provides an electronic device, which includes a transceiver, a processor and a memory, wherein the transceiver is used to receive or send data, the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute some or all of the steps described in the first aspect of this embodiment.
[0025] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is run on a computer, some or all of the steps described in the first aspect of this embodiment are executed.
[0026] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, some or all of the steps described in the first aspect of this embodiment are executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments of the present application will be described below.
[0028] Figure 1 This is a flow chart of a voltage detection method provided in an embodiment of the present application;
[0029] Figure 2 is a schematic diagram of a sampling method provided in an embodiment of the present application;
[0030] Figure 3 This is a schematic diagram of a flow chart for adjusting the power percentage provided in an embodiment of the present application;
[0031] Figure 4 This is another flow chart of adjusting the power percentage provided in an embodiment of the present application;
[0032] Figure 5 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0033] Figure 6 This is a structural diagram of another terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0035] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.
[0036] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0037] First, the terms involved in the embodiments of the present application are introduced.
[0038] The battery module can be a battery or a battery pack, for example, a lithium battery, a lithium battery pack, etc.
[0039] Float voltage is the difference between the battery module's ADC sampled value and its actual open-circuit voltage. When charging, the battery module has internal polarization resistance. Higher currents increase the polarization voltage, leading to float voltage. This increases with current. Simply put, float voltage is the voltage generated by the internal resistance of the battery module when it is charging.
[0040] Terminal devices. The terminal devices involved in the embodiments of this application can be communication devices, especially mid-to-low-end products, such as portable WiFi, portable routers, industrial control hosts, and some low-power embedded devices that can be operated with batteries. These terminal devices can be used in scenarios such as sensor nodes and smart terminals.
[0041] At present, some communication products, especially mid- and low-end products, do not have external fuel gauges in their hardware devices, such as portable WiFi, portable routers, etc. These products can only fit the battery voltage by sampling the voltage signal of the device battery through an analog-to-digital converter (ADC). However, in complex charging scenarios, the ADC sampling value cannot accurately reflect the battery voltage. There are some products similar to portable WiFi on the market (for example, the portable WiFi model L716P MIFI), which reduce the battery voltage jump by performing the following processing on the ADC sampling value: after removing the maximum and minimum values of multiple ADC sampling values, the average value is taken as the battery voltage. The above method of detecting battery voltage has the following defects:
[0042] 1. The five charging types—Standard Downstream Port (SDP), Charging Downstream Port (CDP), Dedicated Charging Port (DCP), Unknown Adapter, and Non-standard Adapter—have different charging current configurations, resulting in different circuit float voltages. Furthermore, the charging current for the same charging type can vary at different temperatures, also leading to different circuit float voltages. These different float voltages can cause the sampled voltage value to be higher than the actual voltage, resulting in inaccurate battery charge percentage calculations based on the sampled voltage value.
[0043] 2. When the system is turned on (or the device is turned on), the negative pressure is unstable when the current flows into the circuit, causing the voltage sampling value to jump.
[0044] 3. During the system startup process, due to the large number of startup programs, the overall system power consumption is large, which will draw more current and cause the battery voltage to drop.
[0045] 4. When the battery is in low power state, the internal voltage of the battery is unstable. Using the above method to detect the battery voltage will cause the voltage to jump and the battery power will change too quickly.
[0046] 5. When the battery is in an extremely high or low temperature state and has not reached the battery's limit discharge temperature, if the charger is connected, although charging is prohibited, there is still float pressure in the circuit, which will cause the voltage sampling value to be higher.
[0047] In view of this, the present application proposes a voltage detection method, which can improve the accuracy of the battery voltage obtained by sampling.
[0048] The following describes the method provided in the embodiments of the present application.
[0049] See Figure 1 , Figure 1 This is a flow chart of a voltage detection method provided in an embodiment of the present application. Figure 1 The steps involved are performed by a terminal device, which includes a battery module. The description of the terminal device can refer to the above description and will not be described in detail here. The following describes the detailed steps involved in the embodiment of the present application.
[0050] 101. Obtain a voltage sampling value of the battery module.
[0051] Exemplarily, after performing multiple ADC sampling on the battery module, the multiple ADC sampling values are sorted, and after removing the maximum and minimum values, the remaining ADC sampling values are averaged to obtain the voltage sampling value of the battery module. Optionally, the multiple ADC sampling of the battery module is performed within one ADC jitter cycle, for example, one jitter cycle is 80ms. By removing the maximum and minimum values and then averaging the values, the obtained voltage sampling value of the battery module is more accurate and can avoid voltage sampling value jumps.
[0052] See Figure 2 , Figure 2 : This is a schematic diagram of a sampling method provided by an embodiment of the present application. This example takes a round of sampling as an example, sampling 20 times within 80ms, with an interval of 2s between each round of sampling. As shown in the figure, 20 samplings within the first 80ms are called the first round of sampling, and then, after an interval of 2s, the second round of sampling is performed, also sampling 20 times within 80ms, and so on, in the nth round of sampling, also sampling 20 times within 80ms. And in each round of sampling, based on the 20 sample values, the maximum and minimum values are removed and the average value is calculated to obtain the voltage sampling value of the battery module in step 101.
[0053] As a possible implementation method, since different voltage segments of the battery module have different voltage jitters, especially when the voltage is low, the voltage jitter is larger. Therefore, when the voltage of the battery module is low, remove the battery module from the terminal device, measure the actual voltage of the battery module with a multimeter, and then use the actual voltage to adjust the voltage sampling value of the battery module. For example, a battery module with a capacity of 5000mAh has a voltage of about 3750mV corresponding to 20% of the power at room temperature. When the voltage is within the range of 3650mV to 3750mV (that is, when the voltage is low), use a multimeter to measure the actual voltage of the battery module multiple times, and then use the actual voltage to adjust the voltage sampling value. In this implementation method, by adjusting the voltage sampling value with the actual voltage, the voltage sampling value of the battery module is made more accurate.
[0054] 102. When the battery module is in a charging state, determine the float pressure according to the temperature of the battery module.
[0055] The float voltage is the voltage generated by the internal resistance of the battery module when the battery module is in a charging state. For the description of the float voltage, please refer to the above description and will not be described in detail here.
[0056] As a possible implementation method, the float pressure is determined according to the temperature of the battery module, including: when the temperature of the battery module is within a set temperature range, the float pressure is determined according to a first current and the internal resistance of the battery module, the first current being a charging current configured according to the charging type; when the temperature of the battery module exceeds the set temperature range, the float pressure is determined according to a second current and the internal resistance, the second current being a preset current.
[0057] Exemplarily, the above-mentioned set temperature range is the temperature range for safe charging of the battery module, for example, 0 to 45°C. When the temperature of the battery module is within the set temperature range, the float voltage is the product of the first current and the internal resistance of the battery module, where the first current is the charging current configured according to the charging type. As an example, the temperature is 25°C, the charging type is DCP, the charging current configured for this charging type is 2A, and the polarization internal resistance is 50mΩ, then the float voltage is 2A×50mΩ=100V. When the temperature of the battery module exceeds the set temperature range, the float voltage is the product of the second current and the internal resistance of the battery module, where the second current is a preset current. Specifically, the second current is a preset current when charging is prohibited, generally set at 0 to 20mA. As an example, the temperature is -10°C, the second current is 10mA, and the polarization internal resistance is 50mΩ, then the float voltage is 10mA×50mΩ=500mV.
[0058] In this implementation, by distinguishing between the battery module temperature being within a set temperature range and exceeding the set temperature range, the float pressure is determined more accurately, thereby making the battery module voltage determined based on the voltage sampling value and the float pressure more accurate.
[0059] 103. Determine the voltage of the battery module according to the voltage sampling value and the float pressure.
[0060] For the description of the voltage sampling value and the floating voltage in this step, reference may be made to the description of step 101 and step 102 above, which will not be described in detail here.
[0061] As a possible implementation, when the battery module is in a charging state and the terminal device is in the initial startup state, the voltage of the battery module is determined according to the following formula:
[0062] V=V s -V f -V d
[0063] Where V is the voltage of the battery module, V s is the voltage sampling value, V f is the floating pressure, V d is the compensation voltage. V f The determination of V may refer to the above step 102. d =10~20mV, the V d The specific value of is determined according to the voltage range of the battery module. If the voltage is low, then V d The value of is higher, on the contrary, the voltage is higher, then determine V d For example, if the capacity of the battery module is 5000mAh, its charging limit voltage, i.e., the full-charge voltage, is 4400mV. At room temperature, the voltage corresponding to 20% is about 3750mV, and 0% is about 3487mV. Then, when the voltage is between 3750mV and 3487mV (i.e., the voltage is lower), V d =20mV.
[0064] In this implementation, when the battery module is in a charging state and the terminal device is in the initial stage of startup, due to the unstable voltage in the initial stage of startup, the voltage sampling value has voltage fluctuations in addition to the float voltage, resulting in a higher voltage sampling value. Therefore, the voltage of the battery module is equal to the voltage sampling value minus the float voltage and then minus the compensation voltage. By subtracting the compensation voltage, voltage instability caused by voltage fluctuations can be avoided. The battery module voltage determined by this method is more consistent with the variation pattern of the battery module voltage in the initial stage of startup and in the charging state, thereby being able to determine a more accurate battery module voltage.
[0065] As another possible implementation, when the battery module is in an uncharged state and the terminal device is in the initial startup state, the voltage of the battery module is determined based on the voltage sampling value, the voltage drop, and the compensation voltage. For example, the voltage of the battery module is determined according to the following formula:
[0066] V=V s +V j +V d
[0067] Where V is the voltage of the battery module, V s is the voltage sampling value, V k is the voltage drop, V d is the compensation voltage. Optionally, V d =10~20mV, about V d Please refer to the above for the description. j It depends on the specific situation of the terminal equipment. For example, when the terminal equipment is turned on, the voltage sampling value of a battery module is determined. Then the voltage drop V jThe actual voltage of the battery module is the difference between the actual voltage of the battery module and the voltage sampling value. The actual voltage can be the open circuit voltage of the battery module measured by a multimeter after the battery module is removed from the terminal device.
[0068] In this implementation, when the battery module is in an uncharged state and the terminal device is in the initial stage of startup, there is no floating voltage in the battery sampling value. Due to the high power consumption of the terminal device in the initial stage of startup, there is a voltage drop in the voltage sampling value. In addition, the voltage is unstable in the initial stage of startup. In addition to the voltage drop, the voltage sampling value also has voltage fluctuations, resulting in a low voltage sampling value. Therefore, the voltage of the battery module is equal to the voltage sampling value plus the voltage drop plus the compensation voltage. By subtracting the compensation voltage, voltage instability caused by voltage fluctuations can be avoided. The battery module voltage determined by this method is more consistent with the variation pattern of the battery module voltage in the initial stage of startup and in the uncharged state, thereby being able to determine a more accurate battery module voltage.
[0069] As another possible implementation, after determining the battery module voltage, the method further includes determining the final battery module charge percentage based on the battery module voltage. For example, according to the charge-discharge curve, the greater the battery module voltage and the smaller the battery module discharge percentage, the greater the final battery module charge percentage; and the smaller the battery module voltage and the larger the battery module discharge percentage, the smaller the final battery module charge percentage. Determining the final battery module charge percentage based on the battery module voltage can improve the accuracy of the final battery module charge percentage by improving the accuracy of the battery module voltage.
[0070] As an example, determining the final power percentage of the battery module based on the voltage of the battery module includes: when the terminal device is in the initial stage of startup, determining the final power percentage of the battery module based on the voltage of the battery module; or, when the terminal device is in the stable period after startup, determining the initial power percentage of the battery module based on the voltage of the battery module; determining the final power percentage of the battery module based on the initial power percentage and the future change trend of the power percentage of the battery module.
[0071] For example, when the terminal device is in the initial stage of startup, if the voltage of the battery module is 4000 mV, then directly based on the charge and discharge curve, it can be determined that the final power percentage of the battery module is approximately 70%.
[0072] For example, see Figure 3 and Figure 4 , Figure 3 This is a flow chart of adjusting the power percentage provided in an embodiment of the present application. Figure 4 This is another flow chart of adjusting the power percentage provided by the embodiment of the present application. Figure 3and Figure 4 As shown, first determine the voltage of the battery module, determine the initial power percentage of the battery module according to the voltage of the battery module, and then determine the number of sampling times of the voltage of the battery module. Figure 3 The initial time of the terminal device startup is 10s, and the sampling period is 2s. Figure 3 Taking the example of a cycle of 2s (each round of sampling may be multiple times, for example, 20 times in 80ms), the description of the sampling method can refer to the above description of Figure 2 The description of the above is not described in detail here. If the number of sampling rounds is greater than or equal to 5, the terminal device is in the stable period after startup; if the number of sampling rounds is less than 5, the terminal device is in the early stage of startup. When the terminal device is in the early stage of startup, the final power percentage of the battery module is determined according to the voltage of the battery module. When the terminal device is in the stable period after startup, it is determined whether the battery module is in the charging state. If it is in the charging state, it is determined as follows Figure 3 The flowchart shown in the figure determines the final power percentage of the battery module. If it is not in the charging state, follow the steps below. Figure 4 The flow chart shown determines the final charge percentage of the battery module.
[0073] The first preset value is the change granularity of the battery module's power percentage, and the second preset value is the adjustment granularity of the final power percentage by adjusting the initial power percentage of the battery module. Both the first preset value and the second preset value can be preset by the user, with values ranging from 1% to 100%. For example, in Figure 3 and Figure 4 In the description, the first preset value and the second preset value are both 1% as an example.
[0074] When the terminal device is in the stable period after power-on and the battery module is in the charging state.
[0075] like Figure 3 As shown, if the power percentage determined by the current sampling minus the power percentage determined by the previous sampling is less than 0, then the consecutive number n1 is determined to be 0, the consecutive number n2 is determined to be 0, and the consecutive number n3 is determined to be n3+1. If n3>10 is satisfied (i.e., for 10 consecutive cycles, the power percentage determined by the current sampling minus the power percentage determined by the previous sampling is less than 0), the final power percentage of the battery module is determined to be = the initial power percentage – 1%, and n3 is determined to be 0, and then the next cycle is entered. If the condition of n3>10 is not satisfied, the final power percentage is determined to be = the initial power percentage.
[0076] If the power percentage determined in the last sampling is equal to the power percentage determined in the current sampling, then the consecutive times n1 is determined to be 0, the consecutive times n2 is determined to be 0, and the consecutive times n3 is determined to be 0, and the final power percentage is determined to be equal to the initial power percentage.
[0077] If the power percentage determined by the current sampling minus the power percentage determined by the previous sampling = 1, then the consecutive number n1 is determined to be 0, the consecutive number n2 is determined to be n2+1, and the consecutive number n3 is determined to be 0. If n2>3 is satisfied (i.e., for three consecutive cycles, the power percentage determined by the current sampling minus the power percentage determined by the previous sampling is <0), the final power percentage of the battery module is determined to be = the initial power percentage + 1%, and n2 is determined to be 0, and then the next cycle is entered. If the condition n2>3 is not satisfied, the final power percentage is determined to be = the initial power percentage.
[0078] If the power percentage determined by the current sampling minus the power percentage determined by the previous sampling is greater than 1, then the consecutive number n1 is determined to be n1+1, the consecutive number n2 is determined to be 0, and the consecutive number n3 is determined to be 0. If n1>4 is satisfied (i.e., for four consecutive cycles, the power percentage determined by the current sampling minus the power percentage determined by the previous sampling is less than 0), the final power percentage of the battery module is determined to be equal to the initial power percentage + 1%, and n1 is determined to be 0, and then the next cycle is entered. If the condition n1>4 is not satisfied, the final power percentage is determined to be equal to the initial power percentage.
[0079] When the terminal device is in the stable period after power-on and the battery module is not in the charging state.
[0080] like Figure 4 As shown, if the power percentage determined in the last sampling is less than or equal to the power percentage determined in the current sampling, the consecutive times n4=0, n5=0, and n6=0 are determined, and the final power percentage is determined to be equal to the initial power percentage.
[0081] If the power percentage determined by the previous sampling minus the power percentage determined by the current sampling = 1, then the number of consecutive times n4 is determined to be n4 + 1, the number of consecutive times n5 is determined to be 0, and the number of consecutive times n6 is determined to be 0. If n4 > 3 (i.e., for three consecutive cycles, the power percentage determined by the previous sampling minus the power percentage determined by the current sampling = 1), the final power percentage is determined to be = the initial power percentage – 1%, and n4 is determined to be 0, and then the next cycle is entered. If the condition n4 > 3 is not met, the final power percentage is determined to be = the initial power percentage.
[0082] If 1 < the percentage of the power determined by the last sampling - the percentage of the power determined by the present sampling ≤ max, it is determined that the continuous number n4 = 0, the continuous number n5 = n5 + 1, and the continuous number n6 = 0. If n5 > 4 is satisfied (i.e. 1 < the percentage of the power determined by the last sampling - the percentage of the power determined by the present sampling ≤ max is satisfied for 4 consecutive times), it is determined that the final percentage of the power = the initial percentage of the power - 1%, and n5 = 0 is determined at the same time, and then the next cycle is entered; if the condition of n5 > 4 is not satisfied, it is determined that the final percentage of the power = the initial percentage of the power.
[0083] If the percentage of the power determined by the last sampling - the percentage of the power determined by the present sampling > max, it is determined that the continuous number n4 = 0, the continuous number n5 = 0, and the continuous number n6 = n6 + 1. If n6 > 10 is satisfied (i.e. the percentage of the power determined by the last sampling - the percentage of the power determined by the present sampling > max is satisfied for 10 consecutive times), it is determined that the final percentage of the power = the initial percentage of the power - 1%, and n6 = 0 is determined at the same time, and then the next cycle is entered; if the condition of n6 > 10 is not satisfied, it is determined that the final percentage of the power = the initial percentage of the power.
[0084] For example, the value of max is 3 or 6, as shown in the figure, in the case that the final percentage of the power is greater than 20% (i.e. the power is relatively high), it is determined that max = 6, and in the case that the final percentage of the power is less than or equal to 20% (i.e. the power is relatively low), it is determined that max = 3. Since the voltage is unstable when the battery module is charging in a low power state, the percentage of the power is also unstable, and the percentage of the power changes rapidly. Therefore, in the case that the final percentage of the power is low, the value of max is determined to be small, the final percentage of the power can be adjusted according to the small amplitude change of the percentage of the power, so as to improve the accuracy of the final percentage of the power.
[0085] By Figure 3 and Figure 4 The method for determining the final percentage of the power according to the future change trend of the battery module provided in the application respectively determines the case that the battery module is in a charging state and the terminal device is in a stable period after being turned on, and the case that the battery module is in an uncharged state and the terminal device is in a stable period after being turned on, and the final percentage of the power of the battery module in the above two cases can improve the accuracy of the final percentage of the power. The final percentage of the power is determined by the percentage of the power of the battery module changing for several consecutive times, which can avoid the jump of the percentage of the power, so that the percentage of the power of the battery module can change stably.
[0086] In the embodiments of the present application, by determining the float pressure, the terminal device is informed of the voltage generated by the internal resistance of the battery module when the battery module is in a charging state. This allows the terminal device to determine the voltage of the battery module based on the voltage sampling value and the float pressure, thus avoiding inaccurate voltage measurements of the battery module due to the float pressure, thereby improving the accuracy of the voltage obtained through sampling. By determining the final battery module charge percentage based on the future change trend of the battery module, the final charge percentage is made more accurate.
[0087] The following describes the device provided in the embodiments of the present application.
[0088] The present application divides the functional modules of the device according to the above method embodiment. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in this application is schematic and is only a logical function division. There may be other division methods in actual implementation. The following will be combined with Figures 5 and 6 The device of the embodiment of the present application is described in detail.
[0089] See Figure 5 , Figure 5 1 is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. As shown in the figure, the terminal device 500 includes a battery module 501, a voltage sampling module 502, and a processing module 503. Optionally, the voltage sampling module 502 can be integrated into the processing module 503.
[0090] The battery module 501 is used to supply power to the terminal device 500 .
[0091] The voltage sampling module 502 is used to obtain a voltage sampling value of the battery module 500 .
[0092] The processing module 503 is used to determine the float pressure according to the temperature of the battery module when the battery module is in a charging state. The processing module 503 is also used to determine the voltage of the battery module according to the voltage sampling value and the float pressure.
[0093] In some embodiments of the present application, the terminal device can be used to execute the actions performed by the terminal device in the above method embodiments. In this case, the terminal device can be the device itself or a chip or functional module that can be configured in the device.
[0094] See Figure 6 , Figure 6 This is a schematic diagram of the structure of another terminal device provided in an embodiment of the present application. Figure 6As shown, the terminal device 600 includes one or more processors 602 and a transceiver 601.
[0095] exist Figure 6 In various implementations of the terminal device shown, the transceiver may include a receiver and a transmitter, wherein the receiver is configured to perform a receiving function (or operation) and the transmitter is configured to perform a transmitting function (or operation). The transceiver is configured to communicate with other devices / apparatuses via a transmission medium.
[0096] Optionally, the terminal device 600 may further include one or more memories 603 for storing program instructions and / or data. The memories 603 are coupled to the processor 602. The processor 602 may operate in conjunction with the memories 603. The processor 602 may execute program instructions stored in the memories 603. The processor 602 may perform the actions described above by the processing module 503. Optionally, at least one of the one or more memories may be included in the processor.
[0097] The specific connection medium between the transceiver 601, the processor 602 and the memory 603 is not limited in the embodiment of the present application. Figure 6 The transceiver 601, the processor 602 and the memory 603 are connected via a bus 604. Figure 6 The connections between the other components are shown in bold lines, which are only for illustration and are not intended to be limiting. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0098] In the embodiments of the present application, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc., and may implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of the present application may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor, etc.
[0099] In the embodiment of the present application, the memory may include, but is not limited to, non-volatile memories such as a hard disk (Hard Disk Drive, HDD) or a solid-state drive (Solid-State Drive, SSD), random access memory (Random Access Memory, RAM), erasable programmable read-only memory (Erasable Programmable ROM, EPROM), read-only memory (Read-Only Memory, ROM) or portable read-only memory (Compact Disc Read-Only Memory, CD-ROM), etc. The memory is any storage medium that can be used to carry or store program code in the form of instructions or data structures and can be read and / or written by a computer (such as the terminal equipment shown in the present application), but is not limited thereto. The memory in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0100] Processor 602 is primarily used to process communication protocols and communication data, control the entire terminal device, execute software programs, and process software program data. Memory 603 is primarily used to store software programs and data. Transceiver 601 may include control circuitry and an antenna. The control circuitry is primarily used to convert baseband signals into radio frequency signals and process radio frequency signals. The antenna is primarily used to transmit and receive radio frequency signals in the form of electromagnetic waves. Input / output devices, such as a touch screen, display, and keyboard, are primarily used to receive user input and output data to the user.
[0101] When the terminal device is powered on, processor 602 can read the software program in memory 603, interpret and execute the instructions of the software program, and process the data of the software program. When data needs to be transmitted wirelessly, processor 602 performs baseband processing on the data to be transmitted and outputs the baseband signal to the RF circuit. The RF circuit performs RF processing on the baseband signal and transmits the RF signal to the outside in the form of electromagnetic waves via the antenna. When data is sent to the terminal device, the RF circuit receives the RF signal via the antenna, converts the RF signal into a baseband signal, and outputs the baseband signal to processor 602. Processor 602 converts the baseband signal into data and processes the data.
[0102] In another implementation, the RF circuit and antenna may be arranged independently of the processor performing baseband processing. For example, in a distributed scenario, the RF circuit and antenna may be arranged remotely from the terminal device.
[0103] The terminal device shown in the embodiment of the present application may also have Figure 6More components, etc., are not limited by the embodiments of the present application. The method performed by the processor and the transceiver shown above is only an example, and the steps specifically performed by the processor and the transceiver can refer to the method introduced above.
[0104] The embodiments of the present application are described in detail above, and the specific examples are applied to describe the principles and implementation modes of the present application. The above description of the embodiments is only used to help understand the method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above description should not be understood as a limitation of the present application.
Claims
1. A voltage detection method, characterized in that: The method is applied to a terminal device, the terminal device including a battery module, and the method includes: Obtaining a voltage sampling value of the battery module; When the battery module is in a charging state, determining a float pressure according to the temperature of the battery module, the float pressure being a voltage generated by an internal resistance of the battery module when the battery module is in the charging state; The voltage of the battery module is determined according to the voltage sampling value and the float pressure.
2. The method according to claim 1, characterized in that The determining the float pressure according to the temperature of the battery module includes: When the temperature of the battery module is within a set temperature range, determining the float voltage according to a first current and an internal resistance of the battery module, wherein the first current is a charging current configured according to a charging type; When the temperature of the battery module exceeds the set temperature range, the float voltage is determined according to a second current and the internal resistance, where the second current is a preset current.
3. The method according to claim 1 or 2, characterized in that The determining the voltage of the battery module according to the voltage sampling value and the float pressure includes: When the battery module is in a charging state and the terminal device is in the initial startup state, the voltage of the battery module is determined according to the following formula: V=V s -V f -V d Wherein, V is the voltage of the battery module, V s is the voltage sampling value, V f is the floating pressure, V d is the compensation voltage.
4. The method according to claim 1, wherein The method further comprises: When the battery module is in an uncharged state and the terminal device is in an initial startup state, the voltage of the battery module is determined according to the voltage sampling value, the voltage drop and the compensation voltage.
5. The method according to any one of claims 1 to 4, characterized in that After determining the voltage of the battery module, the method further includes: A final power percentage of the battery module is determined according to the voltage of the battery module.
6. The method according to claim 5, characterized in that Determining the final power percentage of the battery module according to the voltage of the battery module includes: When the terminal device is in an initial startup state, determining the final power percentage of the battery module according to the voltage of the battery module; or When the terminal device is in a stable period after startup, the initial power percentage of the battery module is determined according to the voltage of the battery module; and the final power percentage of the battery module is determined according to the initial power percentage and the future change trend of the power percentage of the battery module.
7. The method according to claim 6, characterized in that The determining, based on the initial power percentage and a future change trend of the power percentage of the battery module, a final power percentage of the battery module includes: When the terminal device is in a stable period after being powered on and the battery module is in a charging state, If the future change trend of the battery module power percentage is: increasing by the first preset value for N1 consecutive times or increasing by D1 for N2 consecutive times, then determining the final power percentage as the initial power percentage plus the second preset value; or If the future change trend of the battery module power percentage is: decreasing by D2 for N3 consecutive times, then determining the final power percentage as the initial power percentage minus the second preset value; or If the future change trend of the battery percentage of the battery module is: rising by the first preset value for n1 consecutive times, or rising by D1 for n2 consecutive times, or falling by D2 for n3 consecutive times, or remaining unchanged, then determine the final battery percentage as the initial battery percentage, where N1, N2, N3, n1, n2, n3 are positive integers, and N1 < N2 < N3, n1 < N1, n2 < N2, n3 < N3, D1 and D2 are percentages, and D1 is greater than the first preset value, and D2 is greater than 0.
8. The method according to claim 6, characterized in that Determining the final battery percentage of the battery module according to the initial battery percentage and the change of the battery percentage of the battery module includes: When the terminal device is in the stable period after startup and the battery module is in the uncharged state, If the future change trend of the battery percentage of the battery module is: falling by the first preset value for N4 consecutive times, or falling by D3 for N5 consecutive times, or falling by D4 for N6 consecutive times, then determine the final battery percentage as the initial battery percentage minus the second preset value; or, If the future change trend of the battery percentage of the battery module is: falling by the first preset value for n4 consecutive times, or falling by D3 for n5 consecutive times, or falling by D4 for n6 consecutive times, or remaining unchanged, or rising, then determine the final battery percentage as the initial battery percentage, where N4, N5, N6, n4, n5, n6 are positive integers, and N4 < N5 < N6, n4 < N4, n5 < N5, n6 < N6, D3 and D4 are both percentages, and D3 and D4 are both greater than the first preset value, and D3 < D4.
9. A terminal device, characterized in that: Including: A battery module for supplying power to the terminal device; A voltage sampling module for obtaining the voltage sampling value of the battery module; A processing module for determining the floating voltage according to the temperature of the battery module when the battery module is in the charging state, and the floating voltage is the voltage generated by the internal resistance of the battery module when the battery module is in the charging state; The processing module is further configured to determine the voltage of the battery module according to the voltage sampling value and the floating voltage.
10. A computer-readable storage medium, characterized in that Instructions are stored in the computer-readable storage medium, and when it runs on a computer, the method according to any one of claims 1 to 8 is executed.