Power consumption detection apparatus, power consumption detection method, storage medium, and program product
By designing a power consumption detection device including power modules, power consumption detection modules and main control modules, the problem of inability to accurately detect power consumption of electronic devices in the prior art is solved, and efficient and low-cost power consumption detection and real-time data processing for different devices are realized.
Patent Information
- Application Number
- CN202410048484.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-11
- Publication Date
- 2025-07-11
AI Technical Summary
The prior art cannot realize real-time power consumption detection of different types of electronic devices, and there are measurement errors. The software method cannot adapt to multiple types of devices. The power measuring instrument is expensive and cannot communicate and save data in real time.
Design a power consumption detection device, including a power supply module, a power consumption detection module and a main control module, and power consumption data is detected by shielding the built-in power supply, and communicates with electronic devices in real time through the main control module to send power consumption data.
Real-time power consumption detection of different types of devices is realized, which reduces costs and improves detection accuracy, eliminates built-in power consumption and loss, and supports real-time data display and storage.
Smart Images

Figure CN120294403A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the power consumption detection technology in the field of electronics, and in particular, to a power consumption detection device, a power consumption detection method, a storage medium, and a program product. Background Art
[0002] By detecting the power consumption of electronic devices such as mobile terminals, the health status of the device to be tested can be understood, so as to adaptively adjust the usage of the device to be tested. However, the power consumption of the device to be tested varies in different usage environments.
[0003] To detect the power consumption of the device to be tested, in the related art, the power consumption of the device to be tested is usually detected by a software application or a power meter. However, the method of detecting power consumption by a software application can only measure the power consumption of some modules of the device to be tested, resulting in a large measurement error for the overall power consumption of the device to be tested, and it cannot adapt to multiple types of devices to be tested; the method of detecting power consumption by a power meter has a high cost and cannot save measurement data in real time.
[0004] In summary, the related art lacks a general and accurate solution for detecting the power consumption of electronic devices such as mobile terminals. Summary of the Invention
[0005] Embodiments of this application provide a power consumption detection device, a power consumption detection method, a computer-readable storage medium, and a computer program product, which can perform real-time detection on different types of devices to be tested and improve the accuracy of detection at the same time.
[0006] The technical solution of the embodiments of this application is implemented as follows:
[0007] Embodiments of this application provide a power consumption detection device, which includes:
[0008] A power supply module, connected to the device to be tested, for supplying power to the device to be tested, where the built-in power supply of the device to be tested is in a shielded state;
[0009] A power consumption detection module, connected to the power supply module, for detecting the first power consumption data of the power supply module;
[0010] A main control module, connected to the power consumption module and to an electronic device, for obtaining the first power consumption data from the power consumption detection module and sending the first power consumption data of the power supply module to the electronic device, where both the power consumption detection module and the main control module are powered by the electronic device.
[0011] Embodiments of this application provide a power consumption detection method, which is applied to a power consumption detection device. The method includes:
[0012] Power the device under test through the power supply module in the power consumption detection device, where the power supply module is connected to the device under test and the built-in power supply of the device under test is in a shielded state;
[0013] Detect the first power consumption data of the power supply module through the power consumption detection module in the power consumption detection device, where the power consumption detection module is connected to the power supply module;
[0014] Obtain the first power consumption data of the power supply module from the power consumption detection module through the main control module in the power consumption detection device, and send the first power consumption data of the power supply module to the electronic device, where the main control module is connected to the power consumption module and the electronic device, and both the power consumption detection module and the main control module are powered by the electronic device.
[0015] In the above solution, the method further includes:
[0016] Provide electrical energy to the device under test through the power supply module;
[0017] Detect the measurement data of the sampling resistor in the power supply module through the power consumption detection module, where the measurement data includes the current data and voltage data of the sampling resistor;
[0018] Transfer the current data of the sampling resistor to the current meter value in the register, and transfer the voltage data of the sampling resistor to the voltage meter value in the register.
[0019] In the above solution, the power consumption detection device further includes a first communication cable, and the two ends of the first communication cable are provided with a first communication port and a second communication port; the main control module includes a control unit, an analog-to-digital conversion unit and a voltage dividing resistor;
[0020] The method further includes:
[0021] When the device under test is connected to the first communication port and the electronic device is connected to the second communication port, detect the current data of the first communication cable through the power consumption detection module;
[0022] Detect the voltage data of the voltage dividing resistor through the control unit and the analog-to-digital conversion unit as the voltage data of the first communication cable, and use the current data and voltage data of the first communication cable as the second power consumption data to send to the electronic device.
[0023] In the above solution, the analog-to-digital conversion unit includes a successive approximation register, an analog-to-digital converter and a comparator; the detecting the voltage data of the voltage dividing resistor through the control unit and the analog-to-digital conversion unit includes:
[0024] The following processing is performed by the control unit:
[0025] Clear the successive approximation register;
[0026] Starting from the highest bit of the successive approximation register, the following processing is performed for each binary bit of the successive approximation register:
[0027] Set the binary bit of the successive approximation register to 1, and convert the binary bit into a corresponding analog voltage through the analog-to-digital converter;
[0028] Offset the analog voltage to obtain an offset voltage;
[0029] Obtain the comparison result between the analog voltage and the offset voltage through the comparator, and control the current value of the binary bit according to the comparison result;
[0030] Obtain the current data of each binary bit of the successive approximation register as the voltage data of the voltage-dividing resistor.
[0031] In the above solution, the controlling the current value of the binary bit according to the comparison result includes:
[0032] In response to the comparison result that the analog voltage is greater than the offset voltage, retain the current value of the binary bit through the comparator; in response to the comparison result that the analog voltage is less than the offset voltage, clear the current value of the binary bit through the comparator.
[0033] In the above solution, the power consumption detection device further includes a first communication cable, and a first communication port and a second communication port are provided at both ends of the first communication cable;
[0034] The method further includes:
[0035] When the device to be tested is connected to the first communication port and the electronic device is connected to the second communication port, obtain the current data of the first communication cable and the voltage data of the first communication cable from the register of the power consumption detection module through the main control module;
[0036] Use the current data of the first communication cable and the voltage data of the first communication cable as the second power consumption data to send to the electronic device.
[0037] In the above solution, the power consumption detection device further includes a second communication cable and a third communication port, and the second communication cable is used to connect the main control module and the third communication port;
[0038] The method further includes:
[0039] When the main control module connects a third communication cable through the second communication cable via the third communication port, and when the third communication cable is connected to the electronic device, the first power consumption data of the power supply module is sent to the electronic device through the main control module via the second communication cable and the third communication cable.
[0040] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions or a computer program, which is used to implement the power consumption detection method provided by the embodiment of the present application when executed by a processor.
[0041] An embodiment of the present application provides a computer program product storing computer-executable instructions or a computer program, which, when executed by a processor, implements the power consumption detection method provided by the embodiment of the present application.
[0042] The embodiment of the present application has the following beneficial effects:
[0043] By connecting the power supply module of the power consumption detection device to the device to be tested, and at the same time connecting the power consumption detection module of the power consumption detection device to the power supply module, the connection relationship of the power consumption detection device can be applicable to any device, with strong versatility; connecting the power supply module to the device to be tested to supply power to the device to be tested, and at the same time connecting the power consumption detection module of the power consumption detection device to the power supply module, and detecting the first power consumption data of the power supply module through the power consumption detection device. Since the built-in power supply of the device to be tested is in a shielded state, compared with the situation where the device to be tested uses the built-in power supply for power supply in the prior art, during the power consumption detection process, the power consumption loss caused by the built-in power supply of the device to be tested itself is eliminated, so the accuracy is higher; by connecting the main control module of the power consumption detection device to the power consumption detection module and the electronic device at the same time, and supplying power to the power consumption detection module and the main control module in the power consumption detection device through the electronic device, the influence of the power consumption modules (power consumption detection module and main control module) in the power consumption detection device on the power consumption detection of the power supply module is eliminated, and the accuracy is higher; sending the first power consumption data of the power supply module obtained by the power consumption detection module to the electronic device, so as to realize the real-time detection of the power of the device to be tested. Description of the Drawings
[0044] Figure 1 is the first structural schematic diagram of the power consumption detection device provided by the embodiment of the present application;
[0045] Figure 2 is the second structural schematic diagram of the power consumption detection device provided by the embodiment of the present application;
[0046] Figure 3It is the third structural schematic diagram of the power consumption detection device provided by the embodiments of the present application;
[0047] Figure 4 It is the structural schematic diagram of the analog-to-digital conversion unit provided by the embodiments of the present application;
[0048] Figure 5 It is the fourth structural schematic diagram of the power consumption detection device provided by the embodiments of the present application;
[0049] Figure 6A It is the first process schematic diagram of the power consumption detection method provided by the embodiments of the present application;
[0050] Figure 6B It is the process schematic diagram of obtaining the first power consumption data provided by the embodiments of the present application;
[0051] Figure 6C It is the process schematic diagram of power supply module detection provided by the present application;
[0052] Figure 6D It is the second process schematic diagram of the power consumption detection method provided by the embodiments of the present application;
[0053] Figure 6E It is the process schematic diagram of obtaining the voltage data of the voltage-dividing resistor provided by the embodiments of the present application;
[0054] Figure 6F It is the third process schematic diagram of the power consumption detection method provided by the embodiments of the present application;
[0055] Figure 7 It is the schematic diagram of the host computer display interface provided by the embodiments of the present application;
[0056] Figure 8 It is the circuit schematic diagram of the power supply module provided by the embodiments of the present application;
[0057] Figure 9 It is the first circuit schematic diagram of mobile phone power consumption detection provided by the embodiments of the present application;
[0058] Figure 10 It is the second circuit schematic diagram of mobile phone power consumption detection provided by the embodiments of the present application. Detailed implementation manners
[0059] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be construed as limitations on the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present application.
[0060] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it is understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0061] In the following description, the terms "first / second / third" are only used to distinguish similar objects and do not represent a specific order for the objects. It is understood that "first / second / third" can be interchanged with a specific order or sequence when permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0062] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of that module or unit.
[0063] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as commonly understood by those skilled in the art to which the present application belongs. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0064] Before further elaborating on the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.
[0065] 1) High-side current detection: A method for detecting current in a circuit. In the circuit, the sampling resistor is closer to the power supply end than the load, and a differential amplifier cannot be used. The common-mode noise in the circuit is extremely small, so it has a lower cost and higher measurement accuracy, and a wide measurement range.
[0066] 2) Buck converter circuit: A step-down circuit for direct current-direct current (DC-DC). It controls the on and off time through a metal-oxide-semiconductor field-effect transistor (MOSFET, abbreviated as MOS) switch, and cooperates with an output filter capacitor to achieve the effect of step-down rectification, and is commonly used in various electronic devices.
[0067] 3) Inter-Integrated Circuit (IIC), that is, I2C bus, is a simple, two-way, two-wire synchronous serial bus. Information can be transmitted between devices connected to the bus through two wires.
[0068] 4) Host computer: refers to a computer or microcontroller that can directly send operation instructions. Generally, it provides a user operation interaction interface and displays feedback data to the user. Typical device types: computers, mobile phones, tablets, panels, touch screens, etc.
[0069] 5) Sampling resistor: also called current detection resistor, sampling resistor. Current sampling and voltage sampling of devices are realized through sampling resistors. For current sampling, a resistor with a small resistance value can be connected in series. Its function is to accurately collect current in the circuit. For voltage sampling, a resistor with a large resistance value can be connected in parallel.
[0070] 6) Voltage-dividing resistor: the resistance of a conductor connected in series with a certain circuit. When the total voltage remains unchanged, connecting a voltage-dividing resistor in series with a certain circuit can play a voltage-dividing role. A part of the voltage will drop on the voltage-dividing resistor, reducing the voltage across this part of the circuit. The larger the resistance value of the voltage-dividing resistor, the more obvious the voltage-dividing effect.
[0071] 7) Least Significant Bit (LSB): refers to the 0th bit (i.e., the lowest bit) in a binary number, representing the smallest unit in a binary number, which can be used to indicate very small changes in numbers.
[0072] 8) Universal Serial Bus (USB): is a serial bus standard and also a technical specification for input / output interfaces. It is widely used in information communication products such as personal computers and mobile devices, and is extended to other related fields such as photographic equipment, digital TVs (set-top boxes), and game consoles.
[0073] In related technologies, one way is to use software, that is, to detect the power consumption of the device under test through a software application program. It can calculate the power consumption of each module in the device under test when working by retrieving the usage conditions of the processor of the device under test and the screen of the device to be detected, etc. Another way is to detect the power consumption through a power meter. A common power meter consists of a power supply module and a current detection module. It can adjust the voltage according to the device under test and then measure the current in the circuit to calculate the power consumption situation.
[0074] There are the following problems with power consumption detection through software:
[0075] 1) It cannot adapt to various models of devices under test;
[0076] 2) It can only measure the power consumption of each module of the device under test, resulting in a large error in measuring the overall power consumption of the device under test.
[0077] There are the following problems in power consumption detection using a power meter:
[0078] 3) The power meter is relatively large in size and high in cost;
[0079] 4) When the device under test is connected to an electronic device through a communication cable, the power consumption error of the communication cable cannot be eliminated;
[0080] 5) It cannot communicate with the electronic device in real time, resulting in cumbersome steps for saving measurement data.
[0081] Based on the above analysis, the applicant found that the methods for power consumption detection using software applications or power meters in related technologies cannot achieve real-time detection of different types of devices under test and there are measurement errors. To address the above problems, the embodiments of the present application provide a power consumption detection device, a power consumption detection method, a computer-readable storage medium, and a computer program product, which can perform real-time detection on different types of devices under test and improve the accuracy of detection at the same time.
[0082] A power consumption detection device provided by an embodiment of the present application includes a power supply module, a power consumption detection module, and a main control module. Refer to Figure 1 , Figure 1 is the first structural schematic diagram of the power consumption detection device provided by the embodiment of the present application. Taking the power consumption detection device including a power supply module, a power consumption detection module, and a main control module as an example for illustration.
[0083] Refer to Figure 1 The power consumption detection device 100 shown includes a power supply module 200, a power consumption detection module 300, and a main control module 400. The power supply module 200 is connected to the device under test 500 for supplying power to the device under test 500, where the built-in power supply of the device under test 500 is in a shielded state; the power consumption detection module 300 is connected to the power supply module 200 for detecting the first power consumption data of the power supply module 200; the main control module 400 is connected to the power consumption detection module 300 and is also connected to the electronic device 600 for obtaining the first power consumption data from the power consumption detection module 300 and sending the first power consumption data of the power supply module 200 to the electronic device 600. Among them, both the power consumption detection module 300 and the main control module 400 are powered by the electronic device 600.
[0084] Exemplarily, taking Figure 1 the electronic device 600 shown in as a PC, when the power consumption detection device is connected to the PC, through the built-in power supply of the PC, the alternating current received from the power supply circuit is converted into direct current for use by the power consumption detection module and the main control module in the power consumption detection device.
[0085] The device under test provided in the embodiments of the present application can be implemented as various types of user terminals, such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), smart phones, smart speakers, smart watches, smart TVs, vehicle terminals, etc.
[0086] In some embodiments, the power module 200 can be of the AC-DC conversion type, capable of converting the alternating current provided in the power supply line into direct current for use by the device under test 500, supporting multiple specifications of voltage input, such as 12 volts (V), 5V, 3.3V, etc. Its power flow can be bidirectional. The power flow from the power supply to the device under test is called "rectification", and the power flow from the device under test back to the power supply is called "active inversion". AC-DC conversion can be divided into half-wave circuits and full-wave circuits according to the wiring method of the circuit; it can be divided into single-phase, three-phase, and multi-phase according to the number of power supply phases; and it can be divided into one-quadrant, two-quadrant, three-quadrant, and four-quadrant according to the working quadrant of the circuit.
[0087] In some embodiments, the power consumption detection module detects the power consumption situation of the device under test in real time and collects power consumption data, which includes the voltage, current, and power of the device under test.
[0088] In some embodiments, the electronic device 600 can be connected to the power consumption detection device 100 through a Thunderbolt interface to supply power to the power consumption detection module 300 and the main control module 400. For example, the electronic device can be connected to the power consumption detection device through a cable-type Thunderbolt connection cable. In addition to providing a transmission bandwidth of 10 Gbps in both directions for two channels, it can also provide 12 watts (W) of power supply for the power-consuming device and can directly drive passive mobile devices.
[0089] In some embodiments, the electronic device 600 is connected to the power consumption detection device 100 through a USB interface to supply power to the power consumption detection module 300 and the main control module 400. The USB interface can realize the unity of data and power supply.
[0090] In some embodiments, the power consumption detection device 100 can be connected to the power supply port of the electronic device power supply, such as a 3.3V power supply port, through a power supply cable to supply power to the power consumption detection module 300 and the main control module 400 in the power consumption detection device 100.
[0091] In some embodiments, the power supply module 200 is used as an external power supply for the device under test to supply power to the device under test. The built-in power supply is a power supply module directly integrated inside the device under test, usually installed together with other circuit components inside the main board or the housing of the device under test, and is directly connected to the circuits inside the device under test through a power cord or a connector on the circuit board to provide the required electrical energy for the device under test. The external power supply is an independent power supply device, usually existing in the form of a box or a plug outside the device under test; the external power supply is connected to the power interface of the device under test through a power cord or a plug to transmit electrical energy to the device under test.
[0092] In some embodiments, the power consumption detection module 300 is connected to the power supply module 200 to detect the first power consumption data of the power supply module 200, including voltage data, current data, power data, etc.
[0093] In some embodiments, the main control module 400 can be connected to the power consumption detection module 300 through the I2C bus. The I2C bus is a simple, two-way, two-wire synchronous serial bus, and data can be transmitted between the devices connected to the bus with only two wires.
[0094] In some embodiments, the shielding state includes: the built-in power supply of the device under test is set in the device under test, and the power cord between the built-in power supply and the main board of the device under test is disconnected. For example, for a device under test for temporary testing, the plug used to connect to the main board on the power cord can be pulled out from the main board.
[0095] In some other embodiments, the shielding state includes: the built-in power supply of the device under test has been removed from the device under test. For example, for a device under test dedicated to testing for a long time, for the convenience of operation, the built-in power supply can be removed from the device under test.
[0096] When the built-in power supply of the device under test is in the shielding state, the power supply module of the power consumption detection device supplies power to the device under test, which can realize the non-discriminatory power supply of the power consumption detection device to the battery-less device, is applicable to the power consumption detection of various types of devices under test, can solve the problem that the power consumption detection by software in the related art cannot adapt to multiple models of devices under test, and has stronger applicability. At the same time, it can detect the overall power consumption of the device under test and reduce the error caused by only being able to detect the power consumption of each module of the device under test in the related art.
[0097] In some embodiments, the main control module is configured to obtain first power consumption data from the power consumption detection module in the following manner: First, the main control module obtains the voltmeter value from the register of the power consumption detection module, and determines the product of the voltmeter value and the least significant bit of the voltage data in the register as the voltage data of the device under test. Then, the main control module obtains the ammeter value from the register of the power consumption detection module, and determines the product of the ammeter value and the least significant bit of the current data in the register as the current data of the device under test 500. Finally, the current data and voltage data of the device under test are used as the first power consumption data.
[0098] In some embodiments, the power consumption detection module performs power consumption detection on the device under test, and the obtained first power consumption data may further include the power data of the device under test.
[0099] For example, Figure 1 the main control module 400 shown in is configured to obtain first power consumption data from the power consumption detection module 300 in the following manner: First, the main control module 400 obtains the voltmeter value from the register of the power consumption detection module 300, and determines the product of the voltmeter value and the least significant bit of the voltage data in the register as the voltage data of the device under test 500. Then, the main control module 400 obtains the ammeter value from the register of the power consumption detection module 300, and determines the product of the ammeter value and the least significant bit of the current data in the register as the current data of the device under test 500. Finally, the current data and voltage data of the device under test 500 are used as the first power consumption data.
[0100] For example, if the voltmeter value obtained from the register of the power consumption detection module 300 by the main control module 400 in the power consumption detection device 100 is 10V, and the least significant bit of the voltage data in the register is 1.25 millivolts (mV), then the voltage data of the device under test 500 is 12.5 mV. If the ammeter value obtained from the register of the power consumption detection module 300 by the main control module 400 is 3A, and the least significant bit of the current data in the register is 0.25 milliamperes (mA), then the current data of the device under test 500 is 0.75 mA.
[0101] In some embodiments, the power supply module is configured to supply electrical energy to the device under test; the power consumption detection module is further configured to detect the measurement data of the sampling resistor in the power supply module, where the measurement data includes the current data and voltage data of the sampling resistor, store the current data of the sampling resistor as the ammeter value in the register, and store the voltage data of the sampling resistor as the voltmeter value in the register.
[0102] In some embodiments, on the premise that the power supply unit of the power supply module provides electrical energy to the device under test, the power consumption detection module can detect the current data and voltage data of the sampling resistor of the power supply unit, transfer the current data of the sampling resistor to the current meter value in the register, and transfer the voltage data of the sampling resistor to the voltage meter value in the register, so as to obtain the current data and voltage data of the device under test.
[0103] Exemplarily, the sampling resistor of the power supply unit can be a wire-wound sampling resistor, a thin-film sampling resistor, a carbon-film sampling resistor, a metal-film sampling resistor, a metal-oxide-film sampling resistor, a synthetic-film resistor, a metal-glass-uranium sampling resistor, etc. When sampling current through the sampling resistor, a resistor with a small resistance value can be connected in series, and its function is to accurately collect current in the circuit; when sampling voltage through the sampling resistor, a resistor with a large resistance value can be connected in parallel.
[0104] In some embodiments, the power consumption detection device further includes a first communication cable, and the two ends of the first communication cable are provided with a first communication port and a second communication port; the main control module is further configured to obtain the current data of the first communication cable from the register of the power consumption detection module when the device under test is connected to the first communication port and the electronic device is connected to the second communication port.
[0105] Exemplarily, referring to Figure 2 , Figure 2 is the second structural schematic diagram of the power consumption detection device provided by the embodiments of the present application, Figure 2 The power consumption detection device 100 shown further includes a first communication cable 701, and the two ends of the first communication cable 701 are provided with a first communication port 801 and a second communication port 802. When the first communication port 801 of the first communication cable 701 is connected to the device under test 500, and the second communication port 802 of the first communication cable 701 is connected to the electronic device 600, the main control module 400 obtains the current data of the first communication cable 701 from the register of the power consumption detection module 300.
[0106] In some embodiments, the main control module includes a control unit, an analog-to-digital conversion unit, and a voltage-dividing resistor. The control unit is configured to detect the voltage data of the voltage-dividing resistor through the analog-to-digital conversion unit as the voltage data of the first communication cable, and use the current data of the first communication cable and the voltage data of the first communication cable as the second power consumption data to send to the electronic device.
[0107] In some embodiments, the voltage-dividing resistor in the main control module is in a parallel relationship with the first communication cable, and the voltage data of the voltage-dividing resistor detected by the control unit through the analog-to-digital conversion unit is the voltage data of the first communication cable.
[0108] In some embodiments, the control unit can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0109] In some embodiments, the executable instructions for the control unit to execute the control logic may be stored in a ROM and solidified in the power consumption detection device. In this case, the control module is a dedicated processor, such as a single-chip microcomputer.
[0110] In some embodiments, the control unit provided in the embodiments of the present application may be implemented in hardware. As an example, the control unit provided in the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed in the control module. For example, the processor in the form of a hardware decoding processor may be one or more application specific integrated circuits (Application Specific Integrated Circuit, ASIC), digital signal processors (Digital Signal Processor, DSP), programmable logic devices (Programmable Logic Device, PLD), complex programmable logic devices (Complex Programmable Logic Device, CPLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other electronic components.
[0111] For example, see Figure 3 , Figure 3 is a third structural diagram of the power consumption detection device provided in an embodiment of the present application, Figure 3 The main control module 400 shown includes a control unit 401, an analog-to-digital conversion unit 402 and a voltage-dividing resistor 403. The control unit 401 is used to detect the voltage data of the voltage-dividing resistor 403 through the analog-to-digital conversion unit 402 as the voltage data of the first communication cable 701, and use the current data of the first communication cable 701 and the voltage data of the first communication cable 701 in the above example as the second power consumption data to be sent to the electronic device.
[0112] In some embodiments, the analog-to-digital conversion unit includes a successive approximation register, an analog-to-digital converter, and a comparator; the control unit is further configured to detect the voltage data of the voltage-dividing resistor in the following manner: clear the successive approximation register; starting from the highest bit of the successive approximation register, perform the following processing for each binary bit of the successive approximation register: set the binary bit of the successive approximation register to 1, convert the binary bit into a corresponding analog voltage through the analog-to-digital converter; offset the analog voltage to obtain an offset voltage; obtain the comparison result between the analog voltage and the offset voltage through the comparator, and control the current value of the binary bit according to the comparison result; obtain the current data of each binary bit of the approximation register as the voltage data of the voltage-dividing resistor.
[0113] In some embodiments, the analog-to-digital conversion unit is an electronic integrated circuit used to convert analog signals such as voltage into digital or binary forms consisting of 1s and 0s. It usually uses voltage inputs such as 0 to 10V, -5V to +5V, etc., and correspondingly generates a digital output of a certain binary number. The types of analog-to-digital conversion units include dual-slope type, flash type, successive approximation type, semi-flash type, and pipeline type.
[0114] Exemplarily, when the analog-to-digital conversion unit is of the successive approximation type, the digital quantity obtained by conversion gradually approaches the corresponding value of the input analog quantity numerically by comparing the input analog signal with different reference voltages multiple times. For example, in the above example, by comparing the input analog signal with the offset voltage, the binary number in the successive approximation register obtained by conversion gradually approaches the corresponding value of the input analog quantity.
[0115] In some embodiments, the analog-to-digital converter is used to convert an analog quantity into a digital quantity through a certain circuit. The analog quantity can be electrical signals such as voltage and current, but before analog-to-digital conversion, the input signal input to the analog-to-digital converter must be converted into a voltage signal by various sensors for various physical quantities. After analog-to-digital conversion, the output digital signal can be 8-bit, 10-bit, 12-bit, 14-bit, 16-bit, etc.
[0116] Exemplarily, when the digital signal output by the successive approximation register is 8-bit, if the binary bit of the highest bit of the successive approximation register is set to 1 and the remaining bits are 0, the binary number recorded in the approximation register at this time is 10000000, which is converted into a corresponding analog voltage Vi through the analog-to-digital converter, and then obtained Vo after being offset by the offset voltage. The analog input voltage Vi is compared with Vo through the comparator. If Vi is greater than Vo, it means that the binary number recorded in the approximation register is not large enough, and this bit will be retained. Otherwise, it means that the binary number recorded in the approximation register is too large, and this bit will be reset to zero. After processing the remaining 7 binary bits of the successive approximation register in the same way as the highest bit binary bit, the final 8-bit binary number is obtained as the voltage data of the voltage-dividing resistor.
[0117] For example, refer to Figure 4 , Figure 4 which is a schematic structural diagram of the analog-to-digital conversion unit provided by an embodiment of the present application. Figure 4 The shown analog-to-digital conversion unit 402 includes a successive approximation register 4021, an analog-to-digital converter 4022, and a comparator 4023. Figure 3 The shown control unit 401 can detect Figure 3 the voltage data of the shown voltage-dividing resistor 403 in the following manner: First, clear the successive approximation register 4021; starting from the highest bit of the successive approximation register 4021, perform the following processing for each binary bit of the successive approximation register 4021: Set the binary bit of the successive approximation register 4021 to 1, convert the binary bit into a corresponding analog voltage through the analog-to-digital converter 4022; offset the analog voltage to obtain the offset voltage; obtain the comparison result between the analog voltage and the offset voltage through the comparator 4023, and control the current value of the binary bit according to the comparison result; obtain the current data of each binary of the successive approximation register 4021 as the voltage data of the voltage-dividing resistor.
[0118] In some embodiments, the comparator is further configured to, in response to the comparison result that the analog voltage is greater than the offset voltage, retain the current value of the binary bit; in response to the comparison result that the analog voltage is less than the offset voltage, clear the current value of the binary bit.
[0119] For example, when the digital signal output by the successive approximation register is 8 bits, if the highest bit binary bit of the successive approximation register is set to 1 and the remaining bits are 0, the binary number recorded in the approximation register at this time is 10000000, which is converted into a corresponding analog voltage Vi through the analog-to-digital converter, and after being offset by the offset voltage to obtain Vo, the analog input voltage Vi is compared with Vo through the comparator. If Vi is greater than Vo, it means that the binary number recorded in the approximation register is not large enough, and this bit will be retained. On the contrary, it means that the binary number recorded in the approximation register is too large, and this bit will be reset to zero. After processing the remaining 7-bit binary bits of the successive approximation register in the same way as the highest bit binary bit, the final 8-bit binary number is obtained as the voltage data of the voltage-dividing resistor.
[0120] In some embodiments, the power consumption detection device further includes a first communication cable, and a first communication port and a second communication port are provided at both ends of the first communication cable; the power consumption detection module is further configured to, when the device to be tested is connected to the first communication port and the electronic device is connected to the second communication port, obtain the current data of the first communication cable and the voltage data of the first communication cable from the register of the power consumption detection module; send the current data of the first communication cable and the voltage data of the first communication cable to the electronic device as the second power consumption data.
[0121] For example, refer to Figure 5 , Figure 5 is the fourth structural schematic diagram of the power consumption detection device provided by the embodiments of the present application. Figure 5 The shown power consumption detection device 100 further includes a first communication cable 701, and first communication ports 801 and second communication ports 802 are provided at both ends of the first communication cable 701. The power consumption detection module 300 is further configured to, when the device to be tested 500 is connected to the first communication port 801 and the electronic device 600 is connected to the second communication port 802, obtain the current data of the first communication cable 701 and the voltage data of the first communication cable 701 from the register of the power consumption detection module 300; and send the current data of the first communication cable 701 and the voltage data of the first communication cable 701 to the electronic device 600 as the second power consumption data.
[0122] In some embodiments, when the power consumption detection module performs power consumption detection on the device to be tested, the obtained first power consumption data may further include the power data of the device to be tested.
[0123] In some embodiments, the power consumption detection device further includes a second communication cable and a third communication port, and the second communication cable is used to connect the main control module and the third communication port; the main control module is further configured to connect to a third communication cable through the second communication cable and via the third communication port, and when the third communication cable is connected to the electronic device, send the first power consumption data of the power supply module to the electronic device through the second communication cable and the third communication cable.
[0124] For example, continue to refer to Figure 5 , Figure 5 The shown power consumption detection device 100 further includes a second communication cable 702 and a third communication port 803, and the second communication cable 702 is used to connect the main control module 400 and the third communication port; the main control module 400 is further configured to connect to a third communication cable 703 through the second communication cable 702 and via the third communication port 803, and when the third communication cable 703 is connected to the electronic device 600, send the first power consumption data of the power supply module 200 to the electronic device 600 through the second communication cable 702 and the third communication cable 803.
[0125] Through the power consumption detection device proposed by the embodiments of the present application, the power consumption detection function is integrated into a device with a relatively small volume. Compared with the power meter for power consumption detection in the related art, the power consumption detection cost can be effectively reduced.
[0126] In an embodiment of the present application, a power consumption detection method is provided. It should be noted that the implementation of the power consumption detection method corresponds to the implementation manner of the power consumption detection device provided in the foregoing embodiment. For details not disclosed in the implementation of the power consumption detection method, reference may be made to the description of the foregoing embodiment for implementation.
[0127] Next, the power consumption detection method provided by the embodiment of the present application will be described. Refer to Figure 6A , Figure 6A which is the first process schematic diagram of the power consumption detection method provided by the embodiment of the present application, and will be described in conjunction with Figure 6A the steps 101 to 103 shown.
[0128] In step 101, the power supply module in the power consumption detection device is used to supply power to the device under test. Among them, the power supply module is connected to the device under test, and the built-in power supply of the device under test is in a shielded state.
[0129] In some embodiments, the power supply module serves as an external power supply for the device under test to supply power to the device under test.
[0130] In some embodiments, the shielded state includes: the built-in power supply of the device under test is set in the device under test, and the power supply line between it and the main board of the device under test is disconnected; or, the built-in power supply of the device under test has been removed from the device under test.
[0131] When the built-in power supply of the device under test is in a shielded state, the power supply module of the power consumption detection device is used to supply power to the device under test, which can realize the non-discriminatory power supply of the power consumption detection device to the battery-less device, is applicable to the power consumption detection of various types of devices under test, and has stronger applicability.
[0132] In step 102, the power consumption detection module in the power consumption detection device is used to detect the first power consumption data of the power supply module. Among them, the power consumption detection module is connected to the power supply module.
[0133] In some embodiments, the power consumption detection module is connected to the power supply module, and detecting the first power consumption data of the power supply module includes voltage data, current data, power data, etc.
[0134] In step 103, the main control module in the power consumption detection device obtains the first power consumption data from the power consumption detection module and sends the first power consumption data of the power supply module to the electronic device. Among them, the main control module is connected to the power consumption detection module and is connected to the electronic device. The power consumption detection module and the main control module are both powered by the electronic device.
[0135] In some embodiments, the main control module is connected to the power consumption detection module and to the electronic device, and the power consumption detection module and the main control module in the power consumption detection device are powered by the electronic device. If the power consumption detection module and the main control module are powered by the power supply module in the power consumption test device, then when performing power consumption detection on the device under test, the power consumption of the power consumption detection module and the main control module will interfere with the power consumption detection of the power supply module, thus affecting the accuracy of the power consumption data of the device under test; while if the power supply module only powers the device under test, the power consumption interference of other electrical appliances can be excluded, ensuring the accuracy of the power consumption data of the device under test.
[0136] In some embodiments, Figure 5 The main control module 400 shown can be connected to the power consumption detection module 300 through the I2C bus. The I2C bus is a simple, two-way, two-wire synchronous serial bus, and information can be transmitted between the devices connected to the bus with only two wires.
[0137] In some embodiments, refer to Figure 6B , Figure 6B is a schematic flow chart of obtaining the first power consumption data provided by an embodiment of the present application, Figure 6A "Obtaining the first power consumption data from the power consumption detection module through the main control module in the power consumption detection device" in step 103 of Figure 6B can be implemented through steps 1031 to 1033 of
[0138] In step 1031, through the main control module in the power consumption detection device, obtain the voltage meter value from the register of the power consumption detection module, and determine the product of the voltage meter value and the least significant bit of the voltage data in the register as the voltage data of the device under test.
[0139] For example, if the voltage meter value obtained from the register of the power consumption detection module through the main control module in the power consumption detection device is 10V, and the least significant bit of the voltage data in the register is 1.25 mV, then the voltage data of the device under test is 12.5 mV.
[0140] In step 1032, through the main control module in the power consumption detection device, obtain the ammeter value from the register of the power consumption detection module, and determine the product of the ammeter value and the least significant bit of the current data in the register as the current data of the device under test.
[0141] For example, if the ammeter value obtained from the register of the power consumption detection module through the main control module in the power consumption detection device is 3A, and the least significant bit of the current data in the register is 0.25 mA, then the current data of the device under test is 0.75 mA.
[0142] In step 1033, the current data and voltage data of the device under test are used as the first power consumption data.
[0143] In some embodiments, referring to Figure 6C , Figure 6C is a schematic flow chart of power supply module detection provided by this application. Figure 6B The ammeter value and voltmeter value in Figure 6C can be realized through steps 201 to 203 in
[0144] In step 201, electrical energy is provided to the device under test by the power supply module.
[0145] In some embodiments, the power supply module can be of the AC-DC conversion type, providing AC-to-DC processing for the device under test.
[0146] In step 202, the measurement data of the sampling resistor of the power supply unit is detected by the power consumption detection module, where the measurement data includes the current data and voltage data of the sampling resistor.
[0147] In some embodiments, for current sampling through a sampling resistor, a resistor with a small resistance value can be connected in series, and its function is to accurately collect the current in the circuit. For voltage sampling through a sampling resistor, a resistor with a large resistance value can be connected in parallel.
[0148] In step 203, the current data of the sampling resistor is transferred and stored as the ammeter value in the register, and the voltage data of the sampling resistor is transferred and stored as the voltmeter value in the register.
[0149] In some embodiments, the power consumption detection device further includes a first communication cable, with a first communication port and a second communication port provided at both ends of the first communication cable; a main control module, including a control unit, an analog-to-digital conversion unit, and a voltage-dividing resistor. Referring to Figure 6D , Figure 6D is the second schematic flow chart of the power consumption detection method provided by the embodiments of this application, and will be described in combination with Figure 6D the steps 301 to 302 shown.
[0150] In step 301, when the device under test is connected to the first communication port and the electronic device is connected to the second communication port, the current data of the first communication cable is detected by the power consumption detection module.
[0151] In some embodiments, when the device under test is connected to the first communication port and the electronic device is connected to the second communication port, that is, when the device under test and the electronic device are both connected to the power consumption detection device at the same time, the current data of the first communication cable can be detected by the power consumption detection module.
[0152] In step 302, the control unit and the analog-to-digital conversion unit are used to detect the voltage data of the voltage-dividing resistor as the voltage data of the first communication cable, and the current data of the first communication cable and the voltage data of the first communication cable are used as the second power consumption data and sent to the electronic device.
[0153] In the embodiment of the present application, by detecting the current of the first communication cable, the power error caused by the first communication cable connecting the device under test and the electronic device can be eliminated when detecting the power consumption of the device under test.
[0154] In some embodiments, the analog-to-digital conversion unit includes a successive approximation register, an analog-to-digital converter, and a comparator. Refer to Figure 6E , Figure 6E is a schematic flowchart of obtaining the voltage data of the voltage-dividing resistor provided by the embodiment of the present application, Figure 6D "detecting the voltage data of the voltage-dividing resistor through the control unit and the analog-to-digital conversion unit" in step 302 of Figure 6E can be implemented by the control unit executing steps 3021 to 3025 of
[0155] In step 3021, the successive approximation register is cleared.
[0156] In some embodiments, before performing analog-to-digital conversion through the analog-to-digital conversion unit, the successive approximation register of the analog-to-digital conversion unit can be initialized.
[0157] Starting from the highest bit of the successive approximation register in step 3021, steps 3022 to 3025 are executed for each binary bit of the successive approximation register.
[0158] In step 3022, the binary bit of the successive approximation register is set to 1, and the binary bit is converted into a corresponding analog voltage through the analog-to-digital converter.
[0159] In some embodiments, the analog-to-digital converter is used to convert an analog quantity into a digital quantity through a certain circuit. The analog quantity can be an electrical signal such as voltage and current, or a non-electrical signal such as pressure, temperature, humidity, displacement, and sound. However, before analog-to-digital conversion, the input signal input to the analog-to-digital converter must be converted into a voltage signal by various sensors. After analog-to-digital conversion, the output digital signal can have 8 bits, 10 bits, 12 bits, 14 bits, 16 bits, etc.
[0160] In step 3023, the analog voltage is offset to obtain the offset voltage.
[0161] In some embodiments, voltage offset generally refers to negative offset, that is, voltage loss. It refers to the percentage of the voltage offset value at both ends of the line to the rated voltage value of the line. For example:
[0162] △U% = (U1 - U2) / Ue × 100% (1)
[0163] Wherein, U1 represents the voltage (V) at the beginning of the line, U2 represents the voltage (V) at the end of the line; Ue represents the rated voltage (V) of the line.
[0164] In step 3024, the comparator obtains the comparison result between the analog voltage and the offset voltage, and controls the current value of the binary bit according to the comparison result.
[0165] In some embodiments, in response to the comparison result that the analog voltage is greater than the offset voltage, the comparator retains the current value of the binary bit; in response to the comparison result that the analog voltage is less than the offset voltage, the comparator clears the current value of the binary bit.
[0166] In step 3025, the current data of each binary of the approximation register is obtained as the voltage data of the voltage dividing resistor.
[0167] In some embodiments, the power consumption detection device further includes a first communication cable, and a first communication port and a second communication port are provided at both ends of the first communication cable. Refer to Figure 6F , Figure 6F is the third process schematic diagram of the power consumption detection method provided by the embodiments of the present application, and will be described in conjunction with Figure 6F the steps 401 to 402 shown.
[0168] In step 401, when the device to be tested is connected to the first communication port and the electronic device is connected to the second communication port, the main control module obtains the current data of the first communication cable and the voltage data of the first communication cable from the register of the power consumption detection module.
[0169] In some embodiments, when the device to be tested is connected to the first communication port and the electronic device is connected to the second communication port, that is, when the device to be tested and the electronic device are both connected to the power consumption detection device, the main control module can obtain the current data of the first communication cable and the voltage data of the first communication cable from the register of the power consumption detection module.
[0170] In step 402, the current data of the first communication cable and the voltage data of the first communication cable are used as the second power consumption data to be sent to the electronic device.
[0171] In some embodiments, the power consumption detection device further includes a second communication cable and a third communication port. The second communication cable is used to connect the main control module and the third communication port. When the main control module is connected to a third communication cable through the second communication cable and via the third communication port, and when the third communication cable is connected to an electronic device, the first power consumption data of the power module is sent to the electronic device through the main control module, via the second communication cable and the third communication cable.
[0172] In some embodiments, the third communication port may be a serial communication interface. For example, the RS-232 standard interface (also known as EIA RS-232) is one of the commonly used serial communication interface standards. Its full name is "Technical Standard for Serial Binary Data Exchange Interface between Data Terminal Equipment and Data Communication Equipment".
[0173] In some embodiments, an electronic device applying the power consumption detection method in the above embodiments receives the first power consumption data sent by the power consumption detection device and displays the first power consumption data in a power consumption detection interface.
[0174] In some embodiments, the electronic device is used to receive the first power consumption data of the device to be tested sent by the power consumption detection device through the main control module. At the same time, in response to a display operation on the first power consumption data, the first power consumption data is displayed in a power consumption detection interface.
[0175] By connecting the power consumption detection device to the electronic device, real-time communication between the power consumption detection device and the electronic device can be achieved. At the same time, the power consumption data sent by the main control module in the power consumption detection device can be saved in real time, realizing the visualization of power consumption data. Compared with the cumbersome steps of data saving in the related art, the efficiency of data saving can be effectively improved.
[0176] Next, an exemplary application of the embodiments of the present application in an actual game scenario will be described.
[0177] The power consumption detection device and the power consumption detection method proposed by the embodiments of the present application can be applied to the scenario of detecting the power consumption of a mobile phone (device to be tested) in a game scenario, and respectively detecting the power consumption of the mobile phone during the game and the power consumption of the mobile phone when the game is not in progress, so as to obtain the power consumption situation of the game process on the mobile phone.
[0178] Mobile phones are widely used in modern life. While using mobile phones to provide convenience for life, the health status of mobile phones can be understood, so as to adapt and adjust the usage situation. However, the power consumption situations of mobile phones in different usage environments are different. For example, when a mobile phone uses a USB cable, when it is connected to the USB line, there will be current in the USB line. If the current in the USB line is ignored, measurement errors will occur.
[0179] Measuring the overall power consumption of a mobile phone can measure the voltage and current of the power supply circuit for the mobile phone, and calculate the real-time power. To obtain the most accurate real-time power consumption of the mobile phone, the mobile phone battery can be removed and an external power supply can be used. At this time, the power in the external power supply circuit can be regarded as the working power of the mobile phone at this time.
[0180] In view of the need to measure the power consumption of a mobile phone in a test task, an embodiment of the present application provides a power consumption detection device, including a power supply module, a power consumption detection module, and a main control module. The power supply module of the power consumption detection device provides a working power supply for the mobile phone, and at the same time, the power consumption detection module of the power consumption detection device measures the circuit power consumption, and transmits the data to the PC in real time in the form of serial communication to realize data visualization and save the data at the same time.
[0181] Continue to refer to Figure 5 when Figure 5 the device under test 500 shown is a mobile phone and the electronic device 600 is a PC, the power supply module 200 supplies power to the battery-less mobile phone to realize real-time detection of the power of the working mobile phone, and there is no restriction on the brand and model of the mobile phone; at the same time, considering the situation where the mobile phone uses a USB cable (the first communication cable), a USB interface is built into the power consumption detection device to detect the current in the USB line and eliminate the power error caused by the USB line. The power consumption detection device communicates with the PC through serial communication. At this time, the PC is used as the host computer, and the power consumption data measured by the power consumption detection device can be displayed in real time on the host computer and automatically saved. For example, the volume of the power consumption detection device is 76mm×51mm×1.6mm, which is much smaller than other power measurement devices.
[0182] Usage method of the power consumption detection device:
[0183] First, connect the mobile phone to the power supply module of the power consumption detection device through a power cord; then, connect the power adapter of the power consumption detection device to the power socket of the power consumption detection device; finally, connect the power consumption detection device to the PC using a USB cable.
[0184] When the mobile phone can be connected to the PC through a USB cable, then through two other USB cables, the mobile phone and the PC are respectively connected to the PC-mobile phone USB port of the power consumption detection device to measure the current in the USB line.
[0185] For example, the power cord connecting the mobile phone to the power supply module is a dedicated power cord, and the power cord is connected to the electrode on the mobile phone battery protection board by welding.
[0186] In some embodiments, for the interface display of the host computer, refer to Figure 7 , Figure 7 is a schematic diagram of the host computer display interface provided by an embodiment of the present application, Figure 7The display interface is shown to be divided into three parts: data graph output 701, data text output 702, and function buttons 703.
[0187] Exemplarily, as Figure 7 shown, in response to a graphical display operation on power consumption data, five line graphs are shown in the interface of data graph output 701. The data represented in the graphs are respectively the voltage data of the power module, the current data of the power module, the voltage data in the USB line, the current data in the USB line, and the total power of the device under test. In response to a text display operation on power consumption data, in the interface of data text output 702, the first power consumption data obtained by the power consumption detection device for the device under test is displayed. It should be noted that the power consumption data obtained by detecting the device under test depends on the type of the device under test, and no specific limitation is made here. The display operation on power consumption data can be achieved by triggering the function keys in function buttons 703. The display function keys include reconnect, stop, and save.
[0188] In some embodiments, the operations displayed on the host computer interface can be implemented through the following processing:
[0189] First, in response to the triggering operation of the reconnect function key, the host computer receives voltage, current, and power information through the serial port of the power consumption detection device and automatically saves it. Then, in response to the triggering operation of the stop function key, the host computer stops receiving data. Finally, in response to the triggering operation of the save function key, the host computer stores the received data as an excel format table in the current directory, and then automatically clears the current data to prepare for receiving the next batch of data.
[0190] Continue to refer to Figure 5 , Figure 5 the power module 200 shown in , which can step down the input 12V direct current through a synchronous BUCK circuit and output direct current for the normal operation of the mobile phone. Exemplarily, according to the rated working voltage of the mobile phone, the output voltage of the power module can be set to 4.35V, which meets the normal working voltage of the mobile phone in any case and enables the mobile phone to work normally for a long time.
[0191] To ensure the accuracy of mobile phone power consumption measurement, the power module in the power consumption detection device only powers the mobile phone, and the main control module and the power consumption detection module are directly powered by the connection line between the power consumption detection device and the PC.
[0192] Exemplarily, in the power module of the power consumption detection device, the TPS54302 chip can be used to implement the synchronous BUCK step-down circuit. The BUCK step-down circuit is a commonly used DC-DC step-down circuit. The main components in the circuit are switches, freewheeling diodes, energy storage inductors, etc. Refer to Figure 8 , Figure 8It is the circuit schematic diagram of the power module provided by the embodiments of this application. Figure 8 The shown TPS54302 chip has a wide input range of 4.5V - 28V, supports a maximum output of 6A, has a fixed switching frequency of 400kHz, and the output voltage ripple is about 30mV. Figure 8 The shown L1 is a storage inductor for continuous current in the circuit. In U4, the Vin pin is for 12V input voltage; SW is the switch; FB is the voltage feedback pin for adjusting the output voltage; EN is the enable pin. Through R7 and R8 as voltage-dividing resistors, when the potential value between R7 and R8 is at the operating voltage of the chip, the chip starts to work. The capacitors in the circuit are filtering capacitors to reduce the power supply ripple and the damage degree of the power supply ripple to the components of the mobile phone. At the same time, the output voltage can be adjusted by configuring the resistance value of the output terminal resistor. For example, Figure 8 The shown TPS54302 chip receives the voltage between the voltage-dividing resistors R5 and R25 through the FB pin to adjust the output voltage.
[0193] For example, Figure 5 As shown in the power test module 300, the INA226 chip can be used to detect the power consumption data of the power module 200. The data obtained by the internal data register of the INA226 chip are all 16-bit binary data. The INA226 chip can be used for high-side current detection with an accuracy of up to 0.25mA, and at the same time, the total line voltage can be detected with an accuracy of 1.25mV.
[0194] Specifically, the product of the ammeter value (Internal Current (Current Register)) read from the internal data register of the INA226 chip and the least significant bit (LSB) of the current data is used as the current data of the power module 200. At the same time, the product of the voltmeter value (Bus Voltage Register) read from the internal data register of the INA226 chip and the least significant bit (LSB) of the voltage data is used as the voltage data of the power module 200. The product of the detected current data and voltage data is the overall power of the circuit. Among them, the least significant bit (LSB) of the current data is 0.25mA, so the true current value = 0.25mA * Current Register; the least significant bit (LSB) of the voltage data is 1.25mV, so the true voltage value = 1.25mV * Bus Voltage Register.
[0195] The fastest single-item data conversion time of the INA226 is 140μs. To ensure data accuracy and system stability, a conversion time of 1.1ms is adopted, and the measurement frequency is close to 500Hz.
[0196] See Figure 9 ,Figure 9 is the first circuit schematic diagram for mobile phone power consumption detection provided by an embodiment of this application. Through Figure 9 the shown INA226 chip, it can detect Figure 5 the current data and voltage data of the power supply module 200 shown, and transmit the data to the main control module through the I2C bus. Figure 9 In the shown circuit, R9 is the sampling resistor of the mobile phone power supply circuit in the power supply module. The INA226 chip obtains the current data and voltage data in the bus circuit by detecting the voltage difference across R9.
[0197] When the mobile phone is connected to the PC through USB, in addition to detecting Figure 5 the power consumption data of the power supply module 200 shown, the INA226 chip is also used to detect the power consumption data in the USB line. To increase the measurement accuracy and reduce the measurement time, the INA226 chip only performs current detection in the USB line, and the voltage detection of the USB circuit uses a voltage dividing resistor, and the voltage in the USB line is directly measured by the ADC (analog-to-digital conversion unit) measurement pin of the main control module. See Figure 10 , Figure 10 is the second circuit schematic diagram for mobile phone power consumption detection provided by an embodiment of this application. Figure 10 The shown R17 in it is the sampling resistor in the power consumption detection, and U6 is the INA226 current detection chip to detect the current in the detection path. At the same time, for more accurate and higher measurement frequency, the voltage value between the voltage dividing resistors R20 and R21 is measured by using the ADC pin of the main control module, so as to obtain the voltage value in the USB line.
[0198] For example, the control unit in the main control module can be an STM32F103C8T6 chip. The STM32F103C8T6 chip is a microcontroller designed based on the Cortex-M3 architecture, with rich peripherals, a high-speed clock, and low power consumption. In the power consumption detection device, the I2C communication pin of the STM32F103C8T6 chip is connected to the power consumption detection module to obtain the power consumption data in the power consumption detection module, and the sorted data is transmitted to the PC through the serial port, and then the data visualization is realized through the PC display desktop.
[0199] The ADC of the STM32F103C8T6 chip is a successive approximation type ADC, which mainly includes a successive approximation register, a D / A converter (analog-to-digital converter), a comparator, etc. The working process is as follows:
[0200] First, before the conversion starts, clear the successive approximation register;
[0201] Then, after the control logic issues a conversion start signal, under the action of the clock source, in the first clock cycle, the highest bit of the successive approximation register is first set to 1, making it 10000000. This binary number is converted by the D / A converter into the corresponding analog voltage Vi, which is offset by the offset voltage to obtain Vo. The analog input voltage Vi is compared with Vo through a comparator. If Vi is greater than Vo, it indicates that the binary number recorded in the successive approximation register is not large enough, and this bit will be retained. Otherwise, it indicates that the binary number recorded in the successive approximation register is too large, and this bit will be reset to zero.
[0202] Finally, the remaining bits of the successive approximation register are sequentially set to 1 and compared until the lowest bit. At this time, the data in the successive approximation register is the binary value corresponding to the analog input voltage, that is, its corresponding digital quantity.
[0203] For example, the upper computer is developed using pyqt5, automatically connects to the power consumption detection device, real-time displays the power consumption data sent by the main control module in the power consumption detection device, and displays it in the form of waveforms and text on the interface. At the same time, the data is automatically saved as an excel format table.
[0204] The power consumption detection device provided by the embodiments of the present application is small in size and low in cost, and can greatly reduce the cost of measuring the power consumption of mobile phones. By connecting the power supply module of the power consumption detection device to the device to be tested to supply power to the device to be tested, and at the same time connecting the power consumption detection module of the power consumption detection device to the power supply module, the first power consumption data of the power supply module can be detected by the power consumption detection device. Compared with the related art that can only measure the power consumption of some modules of the device to be tested, the accuracy is higher. By connecting the main control module of the power consumption detection device to both the power consumption detection module and the electronic device, and sending the first power consumption data of the power supply module obtained by the power consumption detection module to the electronic device, the power consumption data can be real-time displayed and automatically saved in the electronic device, so as to realize the real-time detection of the power of the device to be tested. By detecting the voltage of the voltage dividing resistor through the analog-to-digital conversion unit in the main control unit as the voltage data of the first communication cable, compared with the related art that ignores the power consumption of the first communication cable, it can effectively reduce the power consumption detection error of the device to be tested and improve the accuracy of power consumption detection.
[0205] The embodiments of the present application provide a computer program product, which includes a computer program or computer executable instructions, and the computer program or computer executable instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instructions from the computer-readable storage medium, and the processor executes the computer executable instructions, so that the electronic device executes the power consumption detection method described above in the embodiments of the present application.
[0206] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, where computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute the power consumption detection method provided by the embodiment of the present application. For example, as Figure 6A shown in the power consumption detection method.
[0207] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disc, or CD-ROM; it may also be various devices including one or any combination of the above memories.
[0208] In some embodiments, the computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including being deployed as an independent program or being deployed as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0209] As an example, the computer-executable instructions may or may not correspond to a file in the file system, and may be stored as part of a file that stores other programs or data. For example, they may be stored in one or more scripts in a Hyper Text Markup Language (HTML) document, stored in a single file dedicated to the program being discussed, or stored in multiple cooperating files (for example, files that store one or more modules, subroutines, or code portions).
[0210] As an example, the computer-executable instructions may be deployed to execute on one electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed at multiple locations and interconnected by a communication network.
[0211] In summary, in the embodiment of the present application, the power supply module of the power consumption detection device is connected to the device to be tested to supply power to the device to be tested. At the same time, the power consumption detection module of the power consumption detection device is connected to the power supply module, and the first power consumption data of the power supply module is detected by the power consumption detection device. This connection method has no restrictions on the brand and model of the device to be tested and has universality. Since the built-in power supply of the device to be tested is in a shielded state, compared with the situation where the device to be tested uses the built-in power supply for power supply in the prior art, during the power consumption detection process, the power consumption loss caused by the built-in power supply of the device to be tested itself is eliminated, so the accuracy is higher. By connecting the main control module of the power consumption detection device to both the power consumption detection module and the electronic device, and the electronic device supplies power to the power consumption detection module and the main control module in the power consumption detection device, the influence of the power consumption modules (power consumption detection module and main control module) in the power consumption detection device on the power consumption detection of the power supply module is eliminated, and the accuracy is higher. At the same time, the first power consumption data sent by the main control module to the electronic device can be displayed in real time and automatically saved in the electronic device, so as to realize the real-time detection of the power of the device to be tested. By detecting the voltage of the voltage-dividing resistor through the analog-to-digital conversion unit in the main control unit as the voltage data of the first communication cable, compared with the related art that ignores the power consumption of the first communication cable, the power consumption detection error of the device to be tested can be effectively reduced, and the accuracy of the power consumption detection can be improved.
[0212] The above is only the embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A power consumption detection device, characterized in that, The power consumption detection device includes: A power supply module, connected to the device to be tested, for supplying power to the device to be tested, wherein the built-in power supply of the device to be tested is in a shielded state; A power consumption detection module, connected to the power supply module, for detecting the first power consumption data of the power supply module; A main control module, connected to the power consumption detection module and connected to an electronic device, for obtaining the first power consumption data from the power consumption detection module and sending the first power consumption data of the power supply module to the electronic device, wherein both the power consumption detection module and the main control module are powered by the electronic device.
2. The power consumption detection device according to claim 1, wherein: The main control module is further configured to obtain the first power consumption data from the power consumption detection module in the following manner: Obtain the voltmeter value from the register of the power consumption detection module, and determine the product of the voltmeter value and the least significant bit of the voltage data in the register as the voltage data of the device to be tested; Obtain the ammeter value from the register of the power consumption detection module, and determine the product of the ammeter value and the least significant bit of the current data in the register as the current data of the device to be tested; Use the current data and the voltage data of the device to be tested as the first power consumption data.
3. The power consumption detection device according to claim 2, wherein: The power supply module is used to provide electrical energy to the device to be tested; The power consumption detection module is further configured to detect the measurement data of the sampling resistor in the power supply module, wherein the measurement data includes the current data and voltage data of the sampling resistor, transfer the current data of the sampling resistor to the ammeter value in the register, and transfer the voltage data of the sampling resistor to the voltmeter value in the register.
4. The power consumption detection device according to claim 1, wherein: The power consumption detection device further includes a first communication cable, and a first communication port and a second communication port are provided at both ends of the first communication cable; The main control module is further configured to obtain the current data of the first communication cable from the register of the power consumption detection module when the device to be tested is connected to the first communication port and the electronic device is connected to the second communication port; The main control module includes a control unit, an analog-to-digital conversion unit and a voltage-dividing resistor. The control unit is configured to detect the voltage data of the voltage-dividing resistor through the analog-to-digital conversion unit as the voltage data of the first communication cable, and use the current data and the voltage data of the first communication cable as the second power consumption data to be sent to the electronic device.
5. The power consumption detection device according to claim 4, wherein: The analog-to-digital conversion unit includes a successive approximation register, an analog-to-digital converter and a comparator; The control unit is further configured to detect the voltage data of the voltage-dividing resistor in the following manner: Clear the successive approximation register; Starting from the most significant bit of the successive approximation register, the following processing is performed for each binary bit of the successive approximation register: Set the binary bit of the successive approximation register to 1, and convert the binary bit into a corresponding analog voltage through the analog-to-digital converter; Offset the analog voltage to obtain an offset voltage; Obtain the comparison result between the analog voltage and the offset voltage through the comparator, and control the current value of the binary bit according to the comparison result; Obtain the current data of each binary bit of the successive approximation register as the voltage data of the voltage dividing resistor.
6. The power consumption detection device according to claim 5, wherein The comparator is further configured to, in response to the comparison result that the analog voltage is greater than the offset voltage, retain the current value of the binary bit; and in response to the comparison result that the analog voltage is less than the offset voltage, clear the current value of the binary bit.
7. The power consumption detection device according to claim 1, wherein The power consumption detection device further includes a first communication cable, and a first communication port and a second communication port are provided at both ends of the first communication cable; The power consumption detection module is further configured to, when the device to be tested is connected to the first communication port and the electronic device is connected to the second communication port, obtain the current data of the first communication cable and the voltage data of the first communication cable from the register of the power consumption detection module; Send the current data of the first communication cable and the voltage data of the first communication cable as second power consumption data to the electronic device.
8. The power consumption detection device according to claim 1, wherein The power consumption detection device further includes a second communication cable and a third communication port, and the second communication cable is used to connect the main control module and the third communication port; The main control module is further configured to connect to the third communication cable through the second communication cable and via the third communication port, and when the third communication cable is connected to the electronic device, send the first power consumption data of the power supply module to the electronic device through the second communication cable and the third communication cable.
9. The power consumption detection device according to any one of claims 1 to 8, wherein The shielding state includes: the built-in power supply of the device to be tested is provided in the device to be tested and the power supply line between the built-in power supply and the main board of the device to be tested is disconnected; or, the built-in power supply of the device to be tested has been removed from the device to be tested.
10. A power consumption detection method, characterized in that, Applied to a power consumption detection device, the method includes: Power the device to be tested through the power supply module in the power consumption detection device, wherein the power supply module is connected to the device to be tested, and the built-in power supply of the device to be tested is in a shielded state; Detect the first power consumption data of the power supply module through the power consumption detection module in the power consumption detection device, wherein the power consumption detection module is connected to the power supply module; The main control module in the power consumption detection device obtains the first power consumption data from the power consumption detection module and sends the first power consumption data of the power supply module to the electronic device. Wherein, the main control module is connected to the power consumption detection module and the electronic device, and both the power consumption detection module and the main control module are powered by the electronic device.
11. The power consumption detection method according to claim 10, wherein The obtaining of the first power consumption data from the power consumption detection module by the main control module in the power consumption detection device includes: The main control module in the power consumption detection device obtains the voltmeter value from the register of the power consumption detection module, and determines the product of the voltmeter value and the least significant bit of the voltage data in the register as the voltage data of the device under test; The main control module in the power consumption detection device obtains the ammeter value from the register of the power consumption detection module, and determines the product of the ammeter value and the least significant bit of the current data in the register as the current data of the device under test; The current data and the voltage data of the device under test are used as the first power consumption data.
12. The power consumption detection method according to claim 10, wherein The shielded state includes: the built-in power supply of the device under test is set in the device under test and the power supply line between it and the main board of the device under test is disconnected; or, the built-in power supply of the device under test has been removed from the device under test.
13. A power consumption detection method, characterized in that, Applied to the electronic device according to any one of claims 10 to 12, the method includes: Receiving the first power consumption data sent by the power consumption detection device; Displaying the first power consumption data in the power consumption detection interface.
14. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that, The computer-executable instructions or computer program, when executed by a processor, implement the power consumption detection method according to any one of claims 10 to 13.
15. A computer program product storing computer-executable instructions or a computer program, characterized in that, The computer-executable instructions or computer program, when executed by a processor, implement the power consumption detection method according to any one of claims 10 to 13.