Real-time power monitoring method, electronic device and computer readable storage medium
Through the real-time power monitoring method and the use of ADC correction operation, the problem of inaccurate power reading of the remote control at low voltage is solved, the accuracy of power reading and battery life are improved, and low-voltage protection malfunctions are reduced.
Patent Information
- Application Number
- CN202010548620.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-05-28
- Filing Date
- 2020-06-16
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-06-16
AI Technical Summary
Existing remote controls are prone to inaccurate reading of battery power due to microprocessor errors when the voltage is low, causing the power to fluctuate and enter the low-voltage protection state early, causing confusion to users.
Using the real-time power monitoring method, through the analog-to-digital converter (ADC) correction operation, the oblique line of the battery voltage is calculated and judged to be within the error range from the ideal value. If it is within the range, the voltage correction is judged to be successful. Otherwise, defective product analysis and Correction, recalibrate the voltage.
It improves the accuracy of battery power reading, avoids the sudden rise and fall of power due to errors, extends the battery life, and reduces malfunctions of low-voltage protection.
Smart Images

Figure CN113740733B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a monitoring method for a computer device, and more particularly to a real-time power monitoring method, an electronic device and a computer-readable storage medium. Background Art
[0002] Currently, many electronic products on the market are equipped with remote controls for convenient remote operation, and diversified applications have been developed to meet the diverse needs of current consumers, such as the Bluetooth voice remote control used in Over-The-Top (OTT) set-top boxes. Most of these remote controls are used with carbon-zinc batteries, and for this reason, the microprocessors used in the remote controls all have the characteristics of low power consumption and low starting voltage.
[0003] However, the low starting voltage of these microprocessors will make the carbon-zinc battery still work normally at low voltage. When the carbon-zinc battery is less than 0.9V, there is a risk of leakage, which will cause irreversible damage to the product. Therefore, the protection mechanism for low battery voltage is very important. In the process of introducing the low-voltage protection mechanism for set-top box products, it was found that the battery voltage is prone to fluctuations due to errors in the microprocessor itself or reading the voltage at the wrong time, which may cause confusion to users or premature entry into the low-voltage protection state. Summary of the invention
[0004] In view of the above, it is necessary to provide a real-time power monitoring method, an electronic device and a computer-readable storage medium to accurately determine the power level of the remote control and avoid reading abnormal voltage rise or drop ranges caused by battery loading.
[0005] An embodiment of the present invention provides a real-time power monitoring method, which is applied to an electronic device, and the method includes: performing an analog-to-digital converter (ADC) correction operation on the voltage of a first battery of the electronic device; calculating an inclined straight line to generate the voltage value of the first battery; judging whether the comparison result of the slope and displacement of the inclined straight line with the ideal slope and ideal displacement is within a preset error range; if the comparison result is within the preset error range, judging that the voltage correction of the first battery is successful; and if the comparison result is not within the preset error range, judging that the voltage correction of the first battery has failed, performing analysis, maintenance and testing operations of defective products, and then re-performing the ADC correction on the voltage of the first battery.
[0006] An embodiment of the present invention also provides an electronic device, including an ADC correction module, which is used to perform an ADC correction operation on the voltage of a first battery of the electronic device, calculate an inclined straight line to generate the voltage value of the first battery, and determine whether the comparison result of the slope and displacement of the inclined straight line with the ideal slope and ideal displacement is within a preset error range. If the comparison result is within the preset error range, it is determined that the voltage correction of the first battery is successful; if the comparison result is not within the preset error range, it is determined that the voltage correction of the first battery has failed, and analysis, maintenance and testing operations of defective products are performed, and then the ADC correction is re-performed on the voltage of the first battery.
[0007] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed, the steps of the real-time power monitoring method as described above are implemented.
[0008] The real-time power monitoring method, electronic device and computer-readable storage medium of the embodiment of the present invention add the instantaneously monitoring battery algorithm (IMBA) to the microcontroller (MCU) of the low-power product to obtain a more accurate voltage value. The battery voltage is read through the ADC of the MCU, and the accuracy of the ADC will affect the correctness of reading the battery power. A high-accuracy voltage detection method is integrated through ADC calibration, battery power conversion, modulated voltage detection and other operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 It is a flowchart of the steps of the real-time power monitoring method according to an embodiment of the present invention.
[0010] Figure 2 4 is a flowchart of the steps of ADC calibration according to an embodiment of the present invention.
[0011] Figure 3A It is a schematic diagram of an oblique straight line formed by voltage values of the remote controller read by the digital electric meter and the ADC in an ideal state and an actual state according to an embodiment of the present invention.
[0012] Figure 3B It is a schematic diagram of an oblique straight line formed by the voltage values of the remote controller read by the digital electric meter and the ADC in an actual state according to an embodiment of the present invention.
[0013] Figure 3C It is a schematic diagram of an oblique straight line formed by the voltage values of the remote controller read by the digital meter and the ADC in an ideal state according to an embodiment of the present invention, which also includes upper and lower limits of the slope and the displacement.
[0014] Figure 4 It is a schematic diagram of the battery voltage discharge curve when the remote control is continuously using voice.
[0015] Figure 5 It is a schematic diagram of the voltage setting of the total power and the cut-off protection voltage setting of the remote controller according to an embodiment of the present invention.
[0016] Fig. 6A and Figure 6B Schematic diagram showing the change in battery voltage when a key is pressed and the voice function is used.
[0017] Figure 7 It is a flowchart of the steps of the battery reference voltage updating method according to an embodiment of the present invention.
[0018] Figure 8 FIG. 4 is a schematic diagram of a modulation voltage detection during a no-load period according to an embodiment of the present invention.
[0019] Fig. 9 FIG. 4 is a schematic diagram of a modulation voltage detection during a short load period according to an embodiment of the present invention.
[0020] Fig.10 FIG. 4 is a schematic diagram of a modulation voltage detection during a long load period according to an embodiment of the present invention.
[0021] Fig.11 Schematic diagram of the hardware architecture of the electronic device according to an embodiment of the present invention.
[0022] Fig.12 is a functional block diagram of an electronic device according to an embodiment of the present invention.
[0023] Main component symbols
[0024]
[0025]
[0026] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0027] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0028] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. The embodiments described are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0030] It should be noted that the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0031] Figure 1 This is a flowchart of the steps of the real-time power monitoring method of an embodiment of the present invention, which is applied to a microcontroller of an electronic device. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0032] Step S11, performing ADC calibration operation on the battery voltage.
[0033] MCU generally samples the continuous voltage change of the battery through the ADC pin on its chip. However, due to the resolution of the MCU itself or the tolerance of the circuit components, the voltage read by the ADC deviates from the actual battery voltage. Therefore, the error amplitude must be confirmed at the factory test station, and the machine with excessive error must be calibrated.
[0034] Figure 2 This is a flowchart of the steps of ADC calibration in an embodiment of the present invention, which is applied to an electronic device. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0035] In step S21 , a power supply is used to provide a stable voltage source to the electronic device (eg, a remote controller), and two sets of high and low voltages are set.
[0036] In step S22, the voltage values of the remote controller read by the digital multimeter (DMM) (X axis) and the ADC (Y axis) are recorded respectively, and an oblique straight line formed by the XY coordinate axes can be obtained.
[0037] refer to Figure 3A , the X-axis represents the precise voltage value displayed by the digital meter (VBAT_DMM), and the Y-axis represents the voltage value read by the ADC (VBAT_ADC). The VBAT_ADC voltage value may be less accurate and needs to be calibrated. Ideally, the voltage value read by the ADC is consistent with the voltage value read by the DMM (y=x), but in reality, the voltage value read by the ADC is inconsistent with the voltage value read by the digital meter (y=ax+b).
[0038] In step S23, a calibration operation is performed to calculate the slope (Gain) and the displacement (Offset) of the inclined straight line to obtain the coordinate equation of the inclined straight line and store it in the MCU, so that the MCU can convert the voltage value read by the ADC into a more accurate actual voltage value.
[0039] refer to Figure 3B According to the inclined straight line of the actual value in the coordinate system, we can get the binary linear equation y=ax+b of the line segment, where a is the slope (Gain) and b is the displacement (Offset). Substituting the calculated a and b values into the binary linear equation and storing them in the MCU completes the calibration. In the future, we only need to calculate the value read by the ADC through the equation to get the precise voltage value of the remote control.
[0040] refer to Figure 3C You can also set the upper and lower limits of the values of a and b (for example, Gain Set / Offset Set) to prevent the remote control from being damaged due to process defects and still being shipped normally.
[0041] Step S12, determining whether the calculated slope and displacement are compared with the ideal slope (Gain=1) and ideal displacement (Offset=0) within a preset error range, in other words, determining whether the battery voltage of the remote controller is calibrated successfully.
[0042] Step S13: if the comparison result is within the preset error range, it means that the battery voltage calibration is successful and the remote controller can be shipped.
[0043] Step S14: if the comparison result is not within the preset error range, indicating that the calibration has failed, the defective product is analyzed and repaired. After the repair is completed, the process returns to step S11 to retest and continue to perform ADC correction on the remote control.
[0044] Step S15, installing new batteries into the remote controller.
[0045] Step S16, performing a battery power conversion operation on the new battery.
[0046] Some audio-visual products, such as set-top boxes (OTT), can display the information of their remote controllers in the user interface (UI). The battery data displayed is usually the battery percentage rather than the battery voltage, so the battery voltage must be converted to the battery percentage. From the experimental results, it can be seen that even if the remote control is continuously used with voice and consumes the maximum power (about 10mA), the battery of the remote control can still be used for more than 53 hours (2xAAA, 3.3V→2.2V). Figure 4 Therefore, from a microscopic point of view, the battery voltage discharge curve can be regarded as linear, and the current charge can be calculated proportionally.
[0047] The voltage required for carbon-zinc batteries to be shipped must be above 1.5V. The remote control will require two carbon-zinc batteries, so the voltage of 100% power is set at 3V, and the cut-off protection voltage depends on the product requirements. In the embodiment of the present invention, the cut-off protection voltage is set to 2.1V. Figure 5 shown.
[0048] The calculation formula of battery power percentage Y% is shown in formula (1):
[0049] Among them, X represents the current voltage.
[0050] Step S17, a battery reference voltage (V f ) update operation, and determine whether the reference voltage is updated. If the update is not completed, continue to repeat the battery reference voltage update operation. If the update is completed, return to step S16 and continue to repeat the battery power conversion operation.
[0051] In the past, remote controls with pure buttons could no longer meet the increasingly complex needs of users, so functions such as somatosensory, voice, and mouse have been actually applied in remote controls. However, the power consumed by these functions varies, and the battery will produce different degrees of voltage drop or voltage rise when opening or ending the function. If the voltage is detected within the range of voltage rise or voltage drop, the displayed power will fluctuate, causing confusion to the user. In addition, when the battery voltage is low, if the voltage recorded when a large voltage drop occurs is also easily misjudged by the system as being lower than the protection voltage, causing malfunction of the system. Based on the above shortcomings, it is necessary to optimize the detection time point of the battery voltage to avoid recording these unreal voltage drops or voltage rises, which can be called a modulated voltage detection mechanism. The modulated voltage detection mechanism divides the behavior of the remote control into three states: no-load, instant load, or heavy load. The method of the present invention designs different voltage sampling times for the two states of instant load and heavy load.
[0052] Fig. 6A and Figure 6B It shows the impact on the battery voltage when pressing a button or using the voice function, while the box is the interval that you do not want to record due to voltage instability caused by using the above functions.
[0053] Figure 7 It is a flowchart of the steps of the battery reference voltage updating method according to an embodiment of the present invention.
[0054] Step S301, in this embodiment, taking the Bluetooth voice remote control of the TV box as an example, refer to Figure 8 One second after the remote control is installed with batteries, the system first records the first voltage value and converts the power display, and uses the first voltage value as the initial reference voltage value of the battery pack (V f ).
[0055] Step S302, determining whether to use the function of the remote controller.
[0056] Step S303: If the function of the remote controller is not used, refer to Figure 8 , indicating that the battery voltage is read every seven seconds during the no-load period. At this time, the first voltage value (V1) is read, and it is determined whether the first voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value, for example, 97% (0.97V f <V1≤V f In this embodiment, the initial reference voltage (V f ) is 3.12V (3.02<V1≤3.12).
[0057] Step S304: if the first voltage value is less than or equal to the initial reference voltage value and greater than 97% (3.02<V1≤3.12) of the initial reference voltage value, then update the battery power and use the first voltage value as a new reference voltage value.
[0058] Step S305, if the first voltage value is less than or equal to 97% of the initial reference voltage value (V1≤3.02) or greater than the initial reference voltage value (V1>3.12), then temporarily store the first voltage value, do not update the voltage value and continue to read the next battery voltage value, i.e., the second voltage value (V2), and determine whether the second voltage value is less than or equal to the initial reference voltage value and greater than 97% of the initial reference voltage value (0.97V f <V2≤V f ).
[0059] If the second voltage value is less than or equal to the initial reference voltage and greater than 97% of the initial reference voltage value (3.02<V2≤3.12), the battery power is updated and the second voltage value is used as a new reference voltage value (step S304).
[0060] Step S306, if the second voltage value is less than or equal to 97% of the initial reference voltage value (V2≤3.02) or greater than the initial reference voltage value (V2>3.12), then temporarily store the second voltage value, do not update the voltage value and continue to read the next battery voltage value, i.e., the third voltage value, and determine whether the third voltage value is less than or equal to the initial reference voltage value and greater than 97% of the initial reference voltage value (0.97V f <V3≤V f ).
[0061] If the third voltage value is less than or equal to the initial reference voltage value and greater than 97% of the initial reference voltage value (3.02<V3≤3.12), the battery power is updated and the second voltage value is used as a new reference voltage value (step S304).
[0062] Step S307, if the third voltage value is less than or equal to 97% of the second voltage value (V3≤3.02) or greater than the initial reference voltage value (V3>3.12), the third voltage value is temporarily stored and the voltage value is not updated. At this time, if three consecutive voltage values are all less than or equal to 97% of the initial reference voltage value or greater than the initial reference voltage value, the voltage value that is less than and closest to the initial reference voltage value is recorded as the new reference voltage value.
[0063] Step S308, if there is a function of using the remote controller, it is determined whether it is a short-term unloading function or a long-term unloading function.
[0064] refer to Fig. 9Regarding the short-term load-drawing function, for example, the behavior of pressing a button can be divided into two actions: "pressing the button" and "releasing the button". When the button is pressed, the battery voltage will drop, and when the button is released, the battery voltage will increase and slowly return to a stable state. In software control, pressing the button and releasing the button can be regarded as two different data.
[0065] Step S309, if the short-time load removal function is executed, read the voltage value two seconds after the last key release action.
[0066] Step S310, determining whether the read voltage value is less than or equal to the initial reference voltage value and greater than 97% (0.97V f <V1≤V f In this embodiment, the initial voltage (V f ) is 2.95V (2.86<V1≤2.95).
[0067] In step S311, if the read voltage value is less than or equal to the initial reference voltage value and greater than 97% of the initial reference voltage value (2.86<V1≤2.95), the battery power is updated and the read voltage value is used as a new reference voltage value. Otherwise, the process returns to step S303 and enters the voltage detection method of the no-load mode.
[0068] refer to Fig.10 Regarding the long-term unloading function, for example, using the voice function, since the voice function cannot know the start and end time like the key function, it cannot use the same detection mechanism as the key function. When the voice is detected, the battery voltage will drop, and when the voice detection ends, the battery voltage will increase and slowly return to a stable state.
[0069] Step S312, if the long-time extraction function is executed, when the voice key is pressed, it will pause for three seconds, and then continuously sample the five-bit voltage value at a frequency of once every two seconds.
[0070] Step S313, selecting a voltage value that is less than or equal to and closest to the reference voltage value from the five values as a new reference voltage value.
[0071] Step S314, repeating the above continuous sampling operation until a new action occurs or the no-load mode is entered.
[0072] Fig.11 The electronic device 200 is a schematic diagram showing the hardware architecture of an electronic device according to an embodiment of the present invention. The electronic device 200, but not limited to, can communicate with each other through a system bus to connect a processor 210, a memory 220, and a real-time power monitoring system 230. Fig.11Only the electronic device 200 is shown with components 210 - 230 , but it is understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0073] The memory 220 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 220 can be an internal storage unit of the electronic device 10, such as a hard disk or memory of the electronic device 200. In other embodiments, the memory can also be an external storage device of the electronic device 200, such as a plug-in hard disk equipped on the electronic device 200, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. Of course, the memory 220 can also include both the internal storage unit of the electronic device 200 and its external storage device. In this embodiment, the memory 220 is generally used to store the operating system and various application software installed in the electronic device 200, such as the program code of the real-time power monitoring system 230. In addition, the memory 220 can also be used to temporarily store various data that have been output or will be output.
[0074] The processor 210 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 210 is generally used to control the overall operation of the electronic device 200. In this embodiment, the processor 210 is used to run the program code stored in the memory 220 or process data, for example, to run the real-time power monitoring system 230, etc.
[0075] It should be noted that Fig.11 The electronic device 200 is merely illustrated as an example. In other embodiments, the electronic device 200 may also include more or fewer components, or have a different component configuration.
[0076] Fig.12The figure shows a functional block diagram of an electronic device according to an embodiment of the present invention, which is used to perform a real-time power monitoring method. The real-time power monitoring method according to the embodiment of the present invention can be implemented by a computer program in a storage medium, for example, a memory 220 in an electronic device 200. When the computer program implementing the method of the present invention is loaded into the memory 220 by the processor 210, the processor 210 of the device 200 is driven to perform the real-time power monitoring method according to the embodiment of the present invention.
[0077] The electronic device 200 according to the embodiment of the present invention includes an ADC calibration module 310 , a power conversion module 320 , and a voltage detection and update module 330 .
[0078] The ADC calibration module 310 performs an ADC calibration operation on the battery voltage.
[0079] MCU generally samples the continuous voltage change of the battery through the ADC pin on its chip. However, due to the resolution of the MCU itself or the tolerance of the circuit components, the voltage read by the ADC deviates from the actual battery voltage. Therefore, the error amplitude must be confirmed at the factory test station, and the machine with excessive error must be calibrated.
[0080] The ADC calibration module 310 uses a power supply to provide the electronic device (e.g., remote control) with a stable voltage source, and sets two sets of high and low voltages, and respectively records the voltage values of the remote control read by a digital multimeter (DMM) (X-axis) and an ADC (Y-axis), thereby obtaining an oblique straight line formed by the XY coordinate axis field.
[0081] refer to Figure 3A , the X-axis represents the precise voltage value displayed by the digital meter (VBAT_DMM), and the Y-axis represents the voltage value read by the ADC (VBAT_ADC). The VBAT_ADC voltage value may be less accurate and needs to be calibrated. Ideally, the voltage value read by the ADC is consistent with the voltage value read by the DMM (y=x), but in reality, the voltage value read by the ADC is inconsistent with the voltage value read by the digital meter (y=ax+b).
[0082] The ADC calibration module 310 performs a calibration operation to calculate the slope (Gain) and the offset (Offset) of the inclined straight line to obtain the coordinate equation of the inclined straight line and store it in the MCU, so that the MCU can convert the voltage value read by the ADC into a more accurate actual voltage value.
[0083] refer to Figure 3BAccording to the inclined straight line of the actual value in the coordinate system, we can get the binary linear equation y=ax+b of the line segment, where a is the slope (Gain) and b is the displacement (Offset). Substituting the calculated a and b values into the binary linear equation and storing them in the MCU completes the calibration. In the future, we only need to calculate the value read by the ADC through the equation to get the precise voltage value of the remote control.
[0084] refer to Figure 3C You can also set the upper and lower limits of the values of a and b (for example, Gain Set / Offset Set) to prevent the remote control from being damaged due to process defects and still being shipped normally.
[0085] The ADC calibration module 310 determines whether the calculated slope and displacement are compared with the ideal slope (Gain=1) and ideal displacement (Offset=0) within a preset error range. In other words, it determines whether the battery voltage of the remote controller is successfully calibrated. If the comparison result is within the preset error range, it indicates that the battery voltage calibration is successful and the remote controller can be shipped. If the comparison result is not within the preset error range, it indicates that the calibration has failed, and the defective product is analyzed and repaired. After the repair is completed, it returns to step S11 to retest and continue to perform ADC correction on the remote controller.
[0086] When a new battery is installed in the remote controller, the power conversion module 320 performs a battery power conversion operation on the new battery.
[0087] Some audio-visual products, such as set-top boxes (OTT), can display the information of their remote controllers in the user interface (UI). The battery data displayed is usually the battery percentage rather than the battery voltage, so the battery voltage must be converted to the battery percentage. From the experimental results, it can be seen that even if the remote control is continuously used with voice and consumes the maximum power (about 10mA), the battery of the remote control can still be used for more than 53 hours (2xAAA, 3.3V→2.2V). Figure 4 Therefore, from a microscopic point of view, the battery voltage discharge curve can be regarded as linear, and the current charge can be calculated proportionally.
[0088] The voltage required for carbon-zinc batteries to be shipped must be above 1.5V. The remote control will require two carbon-zinc batteries, so the voltage of 100% power is set at 3V, and the cut-off protection voltage depends on the product requirements. In the embodiment of the present invention, the cut-off protection voltage is set to 2.1V. Figure 5 shown.
[0089] The calculation formula of battery power percentage Y% is shown in formula (1):
[0090] Among them, X represents the current voltage.
[0091] The voltage detection and updating module 330 performs a battery reference voltage (V f ) update operation, and determine whether the reference voltage update is completed. If the update is not completed, continue to repeat the battery reference voltage update operation. If the update is completed, continue to repeat the battery power conversion operation.
[0092] The battery reference voltage update also includes the following steps. In this embodiment, taking the Bluetooth voice remote control of the TV box as an example, reference Figure 8 One second after the remote control is installed with batteries, the system first records the first voltage value and converts the power display, and uses the first voltage value as the initial reference voltage value of the battery pack (V f ).
[0093] Determine whether to use the remote control function.
[0094] If you do not use the remote control function, refer to Figure 8 , indicating that the battery voltage is read every seven seconds during the no-load period. At this time, the first voltage value (V1) is read, and it is determined whether the first voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value, for example, 97% (0.97V f <V1≤V f In this embodiment, the initial reference voltage (V f ) is 3.12V (3.02<V1≤3.12).
[0095] If the first voltage value is less than or equal to the initial reference voltage value and greater than 97% of the initial reference voltage value (3.02<V1≤3.12), the battery power is updated and the first voltage value is used as a new reference voltage value.
[0096] If the first voltage value is less than or equal to 97% of the initial reference voltage value (V1≤3.02) or greater than the initial reference voltage value (V1>3.12), the first voltage value is temporarily stored, and the voltage value is not updated and the next battery voltage value, i.e., the second voltage value (V2), is read, and it is determined whether the second voltage value is less than or equal to the initial reference voltage value and greater than 97% of the initial reference voltage value (0.97V f <V2≤V f ).
[0097] If the second voltage value is less than or equal to the initial reference voltage and greater than 97% of the initial reference voltage value (3.02<V2≤3.12), the battery power is updated and the second voltage value is used as a new reference voltage value (step S304).
[0098] If the second voltage value is less than or equal to 97% of the initial reference voltage value (V2≤3.02) or greater than the initial reference voltage value (V2>3.12), the second voltage value is temporarily stored, and the voltage value is not updated and the next battery voltage value, i.e., the third voltage value, is read, and it is determined whether the third voltage value is less than or equal to the initial reference voltage value and greater than 97% of the initial reference voltage value (0.97V f <V3≤V f ).
[0099] If the third voltage value is less than or equal to the initial reference voltage value and greater than 97% of the initial reference voltage value (3.02<V3≤3.12), the battery power is updated and the second voltage value is used as a new reference voltage value (step S304).
[0100] If the third voltage value is less than or equal to 97% of the second voltage value (V3≤3.02) or greater than the initial reference voltage value (V3>3.12), the third voltage value is temporarily stored and the voltage value is not updated. At this time, if three consecutive voltage values are all less than or equal to 97% of the initial reference voltage value or greater than the initial reference voltage value, the voltage value that is less than and closest to the initial reference voltage value is recorded as the new reference voltage value.
[0101] If there is a function of using the remote control, determine whether it is a short-term load-drawing function or a long-term load-drawing function.
[0102] refer to Fig. 9 Regarding the short-term load-drawing function, for example, the behavior of pressing a button can be divided into two actions: "pressing the button" and "releasing the button". When the button is pressed, the battery voltage will drop, and when the button is released, the battery voltage will increase and slowly return to a stable state. In software control, pressing the button and releasing the button can be regarded as two different data.
[0103] If the short-time load removal function is executed, read the voltage value two seconds after the last button release action.
[0104] Determine whether the read voltage value is less than or equal to the initial reference voltage value and greater than 97% (0.97V) of the initial reference voltage value. f <V1≤V f In this embodiment, the initial voltage (V f ) is 2.95V (2.86<V1≤2.95).
[0105] If the read voltage value is less than or equal to the initial reference voltage value and greater than 97% (2.86<V1≤2.95) of the initial reference voltage value, the battery power is updated and the read voltage value is used as a new reference voltage value. Otherwise, the voltage detection method of the no-load mode is entered.
[0106] refer to Fig.10 Regarding the long-term unloading function, for example, using the voice function, since the voice function cannot know the start and end time like the key function, it cannot use the same detection mechanism as the key function. When the voice is detected, the battery voltage will drop, and when the voice detection ends, the battery voltage will increase and slowly return to a stable state.
[0107] If the long-time loading function is executed, when the voice button is pressed, it will pause for three seconds, and then continuously sample the five-bit voltage value at a frequency of once every two seconds.
[0108] A voltage value that is less than or equal to and closest to the reference voltage value is selected from the five values as a new reference voltage value.
[0109] The above continuous sampling operation is repeated until the next new action occurs or the no-load mode is entered.
[0110] If the module / unit integrated in the electronic device 200 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0111] It is understandable that the module division described above is only a logical function division, and there may be other division methods in actual implementation. In addition, the functional modules in each embodiment of the present application may be integrated in the same processing unit, or each module may exist physically separately, or two or more modules may be integrated in the same unit. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0112] For ordinary technicians in this field, other corresponding changes or adjustments can be made according to actual needs generated by combining the technical solutions and technical concepts provided by the embodiments of the present invention, and these changes and adjustments should all fall within the scope of protection of the claims of the present invention.
Claims
1. A real-time power monitoring method, applied in an electronic device, characterized in that: The method comprises: performing an analog-to-digital converter (ADC) calibration operation on the voltage of a first battery of the electronic device; Calculate a slanted straight line that generates a voltage value of the first battery; Determine whether the comparison result of the slope and displacement of the oblique straight line with the ideal slope and ideal displacement is within a preset error range; If the comparison result is within the preset error range, it is determined that the voltage calibration of the first battery is successful; and If the comparison result is not within the preset error range, it is determined that the voltage calibration of the first battery has failed, and an analysis, repair and test operation of a defective product is performed, and then the ADC calibration is performed again on the voltage of the first battery, wherein the ADC calibration operation further includes: Using a power supply to provide a voltage source to the electronic device, and setting two sets of high and low voltages; Recording a plurality of voltage values obtained by reading the electronic device by a digital meter representing the X axis and an ADC representing the Y axis respectively, and obtaining the oblique straight line composed of the XY coordinate axes according to the voltage values; and The ADC calibration operation is performed to calculate the slope and displacement of the oblique straight line, and the coordinate equation of the oblique straight line is obtained according to the slope and the displacement.
2. The real-time power monitoring method according to claim 1, characterized in that: Also includes: performing a battery reference voltage updating operation on a second battery of the electronic device; Determining whether the reference voltage of the second battery is updated; If the reference voltage of the second battery is not updated, continue to repeat the battery reference voltage update operation; as well as If the reference voltage of the second battery has been updated, a battery capacity conversion operation is performed on the second battery.
3. The real-time power monitoring method according to claim 2, characterized in that: The battery reference voltage update operation also includes: Recording a first voltage value of the second battery, and using the first voltage value as an initial reference voltage value of the second battery; Determining whether to use the function of the electronic device; If the function of the electronic device is not used, it is determined that the second battery is in a no-load period, then the voltage value of the second battery is read once every first time interval to obtain a first voltage value; and it is determined whether the first voltage value is less than or equal to the initial reference voltage value and greater than a default percentage value of the initial reference voltage value; If the first voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value, updating the power of the second battery and using the first voltage value as the second reference voltage value of the second battery; If the first voltage value is less than or equal to the default percentage value of the initial reference voltage value or is greater than the initial reference voltage value, temporarily storing the first voltage value and not updating the voltage value of the second battery; obtaining a second voltage value of the second battery; Determine whether the second voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value; If the second voltage value is less than or equal to the initial reference voltage and greater than the default percentage value of the initial reference voltage value, updating the power of the second battery and using the second voltage value as the third reference voltage value of the second battery; If the second voltage value is less than or equal to the default percentage value of the initial reference voltage value or is greater than the initial reference voltage value, temporarily storing the second voltage value and not updating the voltage value of the second battery; obtaining a third voltage value of the second battery; Determining whether the third voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value; If the third voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value, updating the power of the second battery and using the second voltage value as the fourth reference voltage value of the second battery; If the third voltage value is less than or equal to the default percentage value of the second voltage value or is greater than the initial reference voltage value, temporarily storing the third voltage value and not updating the voltage value of the second battery; and A voltage value among the first voltage value, the second voltage value and the third voltage value which is smaller than and closest to the initial reference voltage value is used as a new reference voltage value.
4. The real-time power monitoring method according to claim 3, characterized in that: Also includes: If the electronic device has a function, determine whether it is a short-term load-drawing function or a long-term load-drawing function; If the short-time load withdrawal function is executed, the voltage value of the second battery is read at a first preset time interval after the last key release action; Determining whether the voltage value of the second battery is less than or equal to the initial reference voltage value and greater than the initial reference voltage value; If the voltage value of the second battery is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value, then updating the power of the second battery and using the read voltage value as a new reference voltage value of the second battery; as well as If the voltage value of the second battery is less than or equal to the default percentage value of the initial reference voltage value or is greater than the initial reference voltage value, a voltage detection method of a no-load mode is entered.
5. The real-time power monitoring method according to claim 4, characterized in that: Also includes: If the long-time unloading function is executed, after the voice key is pressed, a second preset time is paused, and a preset number of voltage values of the second battery are continuously sampled at a frequency of every second time interval; as well as A voltage value that is smaller than and closest to the reference voltage value is selected from the default number of voltage values as a new reference voltage value of the second battery.
6. The real-time power monitoring method according to claim 5, characterized in that: Also includes: The battery power conversion operation is performed on the second battery through a formula, and the formula is expressed as follows: Wherein, Y is the power of the second battery, X is the current voltage of the second battery, M is the voltage when the power of the second battery is 100%, and N is the cut-off protection voltage of the second battery.
7. An electronic device, characterized in that: include: An ADC calibration module is used to perform an ADC calibration operation on the voltage of a first battery of the electronic device, calculate an inclined straight line to generate the voltage value of the first battery, determine whether the comparison result of the slope and displacement of the inclined straight line with the ideal slope and displacement is within a preset error range, if the comparison result is within the preset error range, determine that the voltage calibration of the first battery is successful, and if the comparison result is not within the preset error range, determine that the voltage calibration of the first battery fails, perform analysis, maintenance and testing operations on defective products, and then re-perform the ADC calibration on the voltage of the first battery, wherein the ADC calibration operation also includes: Using a power supply to provide a voltage source to the electronic device, and setting two sets of high and low voltages; Recording a plurality of voltage values obtained by reading the electronic device by a digital meter representing the X axis and an ADC representing the Y axis respectively, and obtaining the oblique straight line composed of the XY coordinate axes according to the voltage values; and The ADC calibration operation is performed to calculate the slope and displacement of the oblique straight line, and the coordinate equation of the oblique straight line is obtained according to the slope and the displacement.
8. The electronic device as claimed in claim 7, characterized in that: The ADC correction module is further used to record a first voltage value of the second battery, and use the first voltage value as an initial reference voltage value of the second battery to determine whether the function of the electronic device is used. If the function of the electronic device is not used, it is determined that the second battery is in a no-load period, then the voltage value of the second battery is read once every first time interval, and the first voltage value is obtained to determine whether the first voltage value is less than or equal to the initial reference voltage value and greater than a default percentage value of the initial reference voltage value. If the first voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value, the power of the second battery is updated, and the first voltage value is used as a second reference voltage value of the second battery. If the first voltage value is less than or equal to the default percentage value of the initial reference voltage value or greater than the initial reference voltage value, the first voltage value is temporarily stored and the voltage value of the second battery is not updated. The second voltage value of the second battery is obtained to determine whether the second voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value. If the second voltage value is less than or equal to the default percentage value of the initial reference voltage value, The initial reference voltage is greater than the default percentage value of the initial reference voltage value, the power of the second battery is updated, and the second voltage value is used as the third reference voltage value of the second battery. If the second voltage value is less than or equal to the default percentage value of the initial reference voltage value or is greater than the initial reference voltage value, the second voltage value is temporarily stored and the voltage value of the second battery is not updated. The third voltage value of the second battery is obtained to determine whether the third voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value. If the third voltage value is less than or equal to the initial reference voltage value and greater than the default percentage value of the initial reference voltage value, the power of the second battery is updated, and the second voltage value is used as the fourth reference voltage value of the second battery. If the third voltage value is less than or equal to the default percentage value of the second voltage value or is greater than the initial reference voltage value, the third voltage value is temporarily stored and the voltage value of the second battery is not updated, and the voltage value that is less than and closest to the initial reference voltage value among the first voltage value, the second voltage value and the third voltage value is used as the new reference voltage value.
9. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed, implements the steps of the real-time power monitoring method according to any one of claims 1 to 6.
