Current sampling method based on amplification factor adjustment and current detector

By using an operational amplifier in the current sampling circuit, the amplification ratio is dynamically adjusted to adapt to different current ranges, which solves the problem that the fixed amplification ratio in the prior art cannot meet multiple current sampling ranges, achieving high-precision current sampling and reducing hardware costs.

CN120214394APending Publication Date: 2025-06-27AMICRO SEMICONDUCTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311789549.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-25
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

In the existing current sampling and detection methods, the fixed amplification factor cannot meet the needs of various current sampling ranges, resulting in a reduction in sampling accuracy and increasing hardware cost and complexity.

Method used

By setting up an operational amplifier in the current sampling circuit and adjusting the amplification factor using the voltage value corresponding to the real-time current signal, the amplification factor is dynamically adjusted to accommodate different current ranges.

Benefits of technology

It realizes flexible adjustment of the amplification ratio within different current ranges, improves current sampling accuracy, reduces hardware cost and complexity, and is suitable for occasions where current changes are fast and amplitude are large.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120214394A_ABST
    Figure CN120214394A_ABST
Patent Text Reader

Abstract

The invention discloses a current sampling method and a current detector based on amplification factor adjustment, and the method comprises the steps: 1, converting an input real-time current signal into a sampling voltage signal through a current sampling circuit, amplifying the sampling voltage signal according to a current amplification factor, and obtaining a current amplification factor; the current sampling circuit is controlled to convert the amplified sampling voltage signal into a voltage value corresponding to a real-time current signal; then executing the step 2; step 2, adjusting the amplification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal, updating the adjusted amplification factor to the current amplification factor, then executing the step 1, and setting the voltage value corresponding to the real-time current signal converted in the step 1 executed newest as current information sampled currently; wherein an operational amplifier is arranged in the current sampling circuit to configure the current amplification factor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of current detection, and in particular to a current sampling method and a current detector based on amplification factor adjustment. Background Art

[0002] A common current sampling and detection method is to connect a high-precision current detecting resistor in series in the current path of a load interface (such as a USB interface), and then amplify the voltage across the current detecting resistor and send it to an ADC for sampling and detection. In order to reduce the power loss caused by the current detecting resistor, the current detecting resistor is generally very small, for example, 5 mΩ, so the voltage drop generated across the current detecting resistor will be very small, for example, a few millivolts. Directly sending such a small voltage to an analog-to-digital signal converter (ADC), the acquisition result of the ADC for the voltage has a large error. Therefore, it is necessary to amplify the acquired small voltage, and often one or even multiple amplification circuits are required to amplify it before it can be resolved by the analog-to-digital signal converter (ADC).

[0003] In the prior art, after collecting the voltage drop across the current detecting resistor, the voltage drop is generally amplified with a fixed amplification factor (the amplification factor of an operational amplifier, which is calculated from the relevant resistor ratio). Since this amplification factor is associated with the current sampling range, configuring a fixed amplification factor cannot meet the requirements of various current sampling ranges, and there will also be a problem that in order to meet a wider current sampling range (for example, the amplitude range of the analog signal output by the current detecting device is relatively wide), the sampling accuracy will be sacrificed, affecting the sampling accuracy of the load current.

[0004] The prior art may use multiple amplification circuits to form a current detection circuit with selectable amplification factors, or use multiple analog switches to connect multiple sensing resistors to form a multi-path parallel sensing resistor circuit with selectable ranges, so that multiple amplification branches or multiple current range generating branches coexist in the same current detection circuit. When the number of types of current sampling ranges that the current detection circuit needs to satisfy increases and various current sampling accuracies are taken into account, the number of amplification branches or the number of current range generating branches will increase, resulting in an increase in the hardware device cost of current detection, and an increase in the detection control complexity in a circuit system with multiple branch scales. Summary of the Invention

[0005] The present application discloses a current sampling method and a current detector based on amplification factor adjustment, and the specific technical solutions are as follows: To provide a basic understanding of some aspects of the disclosed technical solutions, a simple summary is given below. This summary part is not a general review, nor is it intended to identify key / important constituent elements or delineate the scope of protection of these embodiments. Its purpose is to present some concepts in a simple form as an outline for the subsequent detailed description.

[0006] A current sampling method based on magnification adjustment, comprising: Step 1, controlling an input analog signal to be sampled by a current sampling circuit to be amplified according to the current magnification, and then controlling the current sampling circuit to convert the amplified analog signal to be sampled into a voltage value corresponding to a real-time current signal; then perform Step 2; Step 2, adjusting the magnification of the current sampling circuit based on the voltage value corresponding to the real-time current signal, and then updating the adjusted magnification to the current magnification, and then performing Step 1 and setting the voltage value corresponding to the real-time current signal converted in the latest executed Step 1 as the currently sampled current value, so that the current magnification changes when the voltage value corresponding to the real-time current signal changes; wherein, an operational amplifier is provided inside the current sampling circuit to configure the current magnification; inside the current sampling circuit, the periphery of the operational amplifier is not connected to multiple groups of resistors in parallel.

[0007] In summary, based on the current sampling circuit, by performing the foregoing Step 1 and Step 2, the magnification of the current sampling circuit can change with the change of the voltage value corresponding to the real-time current signal, and can adjust the corresponding magnification within different current ranges. It is not necessary to set multiple groups of inductive resistors in parallel on the hardware to configure multiple selectable current sampling ranges, nor is it necessary to set multiple amplification resistors in parallel on the hardware to configure multiple magnification factors for circuit amplification. It can flexibly and real-time effectively configure a reasonable magnification of the current sampling circuit to be compatible with the current sampling accuracy, and can also make the hardware design part of current detection simpler.

[0008] Furthermore, on the basis of saving circuit area and reducing circuit device cost, when detecting large currents, the current sampling circuit can automatically adjust to a smaller magnification so that the voltage value corresponding to the amplified and converted real-time current signal can ensure the breadth of current detection without over-range problems; when detecting small currents, the current sampling circuit can automatically adjust to a larger magnification, which can improve the accuracy of small current detection, etc., improve the sampling accuracy in the small current segment and be compatible with the sampling range (detection breadth) in the large current segment, and is applicable to occasions where the current changes rapidly and has a large change range.

[0009] Further, in the step 2, the method for adjusting the amplification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal includes: when the voltage value corresponding to the currently converted real-time current signal becomes larger, the current amplification factor is adjusted to a smaller value to adjust an appropriate amplification factor; when the voltage value corresponding to the currently converted real-time current signal becomes smaller, the current amplification factor is adjusted to a larger value to adjust an appropriate amplification factor. Thus, within the full-range current sampling range, when sampling a larger current, a smaller amplification factor can be adjusted; when sampling a smaller current, a larger amplification factor can be adjusted; which not only ensures the accuracy of current sampling but also does not exceed the current sampling range.

[0010] Further, in step 2, whenever the current sampling circuit converts the voltage value corresponding to the real-time current signal through step 1, it is determined whether the voltage value corresponding to the currently converted real-time current signal is within the corresponding voltage threshold range; when the voltage value corresponding to the currently converted real-time current signal is within the first voltage threshold range, the current magnification is adjusted to the first magnification so that the voltage value corresponding to the real-time current signal does not exceed the pre-configured current sampling range; wherein, the first magnification becomes the magnification adapted to the voltage value corresponding to the currently detected real-time current signal, and the corresponding voltage threshold range is the first voltage threshold range; when the voltage value corresponding to the currently converted real-time current signal is within the second voltage threshold range, the current magnification is adjusted to the second magnification to improve the current sampling accuracy of the current sampling circuit, wherein, the second magnification becomes the magnification adapted to the voltage value corresponding to the currently detected real-time current signal, and the corresponding voltage threshold range is the second voltage threshold range; wherein, the lower limit value of the first voltage threshold range is greater than the upper limit value of the second voltage threshold range, and the first magnification is less than the second magnification; when the current sampling circuit adjusts the resistor used to calculate the current magnification set inside it, the current magnification changes, wherein, the resistor used to calculate the current magnification is connected to the operational amplifier inside the current sampling circuit. In the foregoing technical solution, in this embodiment, for the case where the amplitude range of the analog signal collected by the current detection resistor provided inside the current sampling circuit is relatively wide, different magnifications are required to implement signal conditioning; the smaller the current magnification, the wider the current range that can be sampled (current detection range). When the voltage value corresponding to the real-time current signal is within the first voltage threshold range, the current magnification is adjusted to the first magnification, and the formed wider current detection range does not exceed the current sampling range; the larger the current magnification, the narrower the current range that can be sampled. When the voltage value corresponding to the real-time current signal is within the second voltage threshold range, the current magnification is adjusted to the second magnification to improve the sampling accuracy. The magnification required for sampling the current can change with the change of the voltage value corresponding to the real-time current signal, so that both the current sampling range (for example, not exceeding the established current sampling range) can be taken into account, and a higher current sampling accuracy can be obtained when the current is small.

[0011] Further, when the initial value of the current magnification is set to the third magnification, if the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the initial state is within the second voltage threshold range, the current magnification is adjusted to the second magnification or maintained at the third magnification; when the initial value of the current magnification set in the current sampling circuit is the third magnification, if the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the initial state is within the first voltage threshold range, the current magnification is adjusted to the first magnification; wherein, the third magnification is greater than the second magnification. Thus, based on the judgment of the first voltage threshold range and the second voltage threshold range, the current magnification can be controlled to switch between the second magnification and the first magnification starting from the third magnification, which not only ensures the current sampling accuracy but also does not exceed the current sampling range.

[0012] Further, in step 2, the method for adjusting the magnification of the current sampling circuit based on the voltage value corresponding to the real-time current signal further includes: setting the voltage threshold range defined by the lower limit value of the first voltage threshold range and the upper limit value of the second voltage threshold range as the hysteresis sampling value range; when the voltage value corresponding to the currently converted real-time current signal is within the hysteresis sampling value range, controlling the current magnification to remain unchanged. Thus, during the switching between small current (which can be understood as the current value falling within the second voltage threshold range) and large current (which can be understood as the current value falling within the first voltage threshold range), a hysteresis range is formed to avoid frequently adjusting the current magnification at a single critical value (such as the aforementioned upper limit value or lower limit value) of the voltage value corresponding to the real-time current signal, ensuring the stability of the current magnification, and further ensuring the stability of the magnification adjustment of the current sampling circuit.

[0013] A current detector comprises an MCU, an adjustable amplifier unit, an ADC unit, and a current-sensing resistor; the current-sensing resistor, the adjustable amplifier unit, and the ADC unit are sequentially connected to form the current sampling circuit; the current-sensing resistor is connected to a load interface, the current-sensing resistor is connected to the adjustable amplifier unit, the current-sensing resistor is used to receive an analog signal to be sampled flowing into the load interface and generate a sampling voltage signal, and then transmit the generated sampling voltage signal to the adjustable amplifier unit; the adjustable amplifier unit is used to amplify the sampling voltage signal, and then transmit the amplified sampling voltage signal to the ADC unit; the ADC unit is connected to the MCU; the ADC unit is used to control the amplified sampling voltage signal to be converted into a voltage value corresponding to a real-time current signal, and then transmit the voltage value corresponding to the real-time current signal to the MCU; the adjustable amplifier unit, the ADC unit and the MCU are sequentially connected to form a closed-loop feedback circuit; the MCU is used to adjust an adapted amplification factor based on the voltage value corresponding to the real-time current signal, and then trigger the adjustable amplifier unit to amplify the sampling voltage signal according to the adapted amplification factor, and then update the conversion result of the amplified sampling voltage signal to the voltage value corresponding to the real-time current signal through the ADC unit.

[0014] In summary, in the current detector, the current sensing resistor Rsense, the adjustable amplifier unit and the ADC unit are connected in sequence to form a current sampling circuit, and the adjustable amplifier unit, the ADC unit and the MCU are connected in sequence to form a closed-loop feedback circuit. There is no need to set multiple groups of mutually parallel sensing resistors in hardware to configure multiple groups of current sampling ranges for selection, nor is there a need to set multiple mutually parallel amplifier resistors in hardware to configure multiple multiples for circuit amplification. Instead, the voltage value corresponding to the real-time current signal is adjusted to a corresponding amplification factor, so that the current detector forms a fast and reasonable selection amplification circuit, and supports the adjustable amplifier unit to automatically and efficiently adjust a variety of amplification factors, so that the corresponding current sampling range can be taken into account by adjusting the amplification factor in a large current detection environment, and the current sampling accuracy can be improved by adjusting the amplification factor when the current is small, thereby improving the sampling accuracy and detection speed of different current segments.

[0015] Furthermore, the method for MCU to adjust the amplification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal includes: when the voltage value corresponding to the real-time current signal currently converted by the ADC unit increases, the MCU adjusts the current amplification factor down to adjust the corresponding amplification factor; when the voltage value corresponding to the real-time current signal currently converted by the ADC unit decreases, the MCU adjusts the current amplification factor up to adjust the corresponding amplification factor. Thus, within the full range, a smaller amplification factor can be adjusted for larger current detection; a larger amplification factor can be adjusted for smaller current detection; the accuracy of current detection is guaranteed without exceeding the range.

[0016] Further, the adjustable amplification unit includes an operational amplifier, a feedback resistor, a variable resistor, and an inverter; the feedback resistor is connected between the negative input terminal and the output terminal of the operational amplifier, the first end of the variable resistor is connected to the negative input terminal of the operational amplifier, the second end of the variable resistor is connected to the first end of the current detection resistor, the adjustment terminal of the variable resistor is connected to the MCU, the second end of the current detection resistor is grounded, and the second end of the current detection resistor is also connected to the positive input terminal of the operational amplifier to form an inverting proportional amplifier; the inverting proportional amplifier is configured to amplify the sampled voltage signal and output an amplified signal from the output terminal of the operational amplifier to amplify the to-be-sampled analog signal; the variable resistor is configured to automatically adjust the resistance value range under the control of a resistance adjustment signal sent by the MCU to form the adapted amplification multiple, making it adapted to the current flowing through the current detection resistor or the voltage value corresponding to the real-time current signal before adjustment; wherein, both the feedback resistor and the variable resistor are operational amplifier resistors used for calculating the amplification multiple in the current sampling circuit; the input terminal of the inverter is connected to the output terminal of the operational amplifier, and the output terminal of the inverter is connected to the conversion input terminal of the ADC unit. The inverter is configured to perform inverting processing on the amplified signal output by the operational amplifier to obtain the sampled voltage signal after amplification processing; wherein, the MCU sets the ratio between the resistance value of the feedback resistor and the resistance value of the variable resistor as the amplification multiple of the adjustable amplification unit.

[0017] Compared with the prior art, multiple groups of resistors connected in parallel are not connected to the periphery of the operational amplifier (for example, multiple groups of inductive resistors connected in parallel are set to configure multiple selectable current sampling ranges, or multiple operational amplifier resistors connected in parallel are set to configure multiple amplification multiples for the circuit). Accordingly, the current judgment thresholds required can be reduced, which can be understood as reducing the setting of multiple amplification circuits (one amplification circuit corresponds to one configured amplification multiple), facilitating the reduction of the circuit scale and saving the circuit area required for current detection.

[0018] Further, whenever the ADC unit converts the voltage value corresponding to the real-time current signal, the MCU controls to compare the voltage value corresponding to the currently converted real-time current signal with the corresponding voltage threshold. When the voltage value corresponding to the real-time current signal currently converted by the ADC unit is greater than the first voltage threshold, the MCU generates a corresponding resistance adjustment signal and transmits it to the adjustable resistor. The adjustable resistor selects a corresponding resistance value gear based on the resistance adjustment signal, so that the adjusted magnification is equal to the first magnification, where the corresponding voltage threshold is the first voltage threshold. When the voltage value corresponding to the real-time current signal currently converted by the ADC unit is less than the second voltage threshold, the MCU generates a corresponding resistance adjustment signal and transmits it to the adjustable resistor. The adjustable resistor selects a corresponding resistance value gear based on the resistance adjustment signal, so that the adjusted magnification is equal to the second magnification, where the corresponding voltage threshold is the second voltage threshold. When the voltage value corresponding to the real-time current signal currently converted by the ADC unit is within the hysteresis sampling value range, the MCU generates a corresponding resistance adjustment signal and transmits it to the adjustable resistor. The adjustable resistor controls the selected resistance value gear not to change based on the resistance adjustment signal, so that the magnification of the adjustable amplification unit remains unchanged. Wherein, the upper limit value of the hysteresis sampling value range is the first voltage threshold, and the lower limit value of the hysteresis sampling value range is the second voltage threshold. Wherein, the first voltage threshold is greater than the second voltage threshold, and the first magnification is less than the second magnification.

[0019] In summary, the smaller the magnification adjusted by the current detector, the wider the current range that can be sampled (current detection range). When the voltage value corresponding to the real-time current signal is greater than the first voltage threshold, the adjusted corresponding magnification is equal to the first magnification, and the formed wider current detection range does not exceed the current sampling range. The smaller the magnification adjusted by the current detector, the narrower the current range that can be sampled. When the voltage value corresponding to the real-time current signal is less than the second voltage threshold, the adjusted corresponding magnification is equal to the second magnification, improving the sampling accuracy. Therefore, the magnification required for the current detector to sample the current can be adjusted according to the change of the voltage value corresponding to the real-time current signal, so that both the current sampling range (for example, not exceeding the established current sampling range) can be taken into account, and higher current sampling accuracy can be obtained when the current is small.

[0020] Further, the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the no-load state is less than the second voltage threshold, and the initial value of the amplification factor set in the current sampling circuit is set to the third amplification factor; wherein, the third amplification factor is greater than the second amplification factor; the no-load state is an electrical state where the load interface is not connected to a load. Thus, in combination with the judgment of the first voltage threshold and the second voltage threshold, the adjustable amplification unit can control the amplification factor to switch between the second amplification factor and the first amplification factor starting from the third amplification factor, which not only ensures the current sampling accuracy but also does not exceed the current sampling range of the ADC unit. Brief Description of the Drawings

[0021] Figure 1 is a schematic flowchart of a current sampling method based on amplification factor adjustment disclosed in an embodiment of the present application.

[0022] Figure 2 is a schematic circuit framework diagram of a current detector disclosed in another embodiment of the present application. Embodiments

[0023] The following description and the drawings fully illustrate specific embodiments of the present invention so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process, and other changes. The examples only represent possible variations. Unless explicitly required, individual components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or substituted for parts and features of other embodiments. The scope of the embodiments disclosed in this application includes the entire scope of the claims and all available equivalents of the claims. These embodiments may be represented individually or collectively by the term "this application or this embodiment" for convenience only, and if in fact more than one inventive technical solution is disclosed, it is not intended to automatically limit the scope of the application to any single invention or inventive concept.

[0024] When the current detection device collects the actual current, it will output an analog signal. Since the amplitude of this analog signal is very small (the current amplitude is in the order of uV and uA), one or even multiple amplifier circuits are often required to amplify it so that it can be resolved by the analog-to-digital signal converter (ADC), and then the MCU can obtain a relatively accurate reading. Generally speaking, the smaller the amplification factor, the less likely it is for the same voltage signal to cause the ADC to reach the full scale (current sampling range), and the wider the current range that can be sampled can be configured, but the sampling accuracy is lower; on the contrary, the larger the amplification factor, the more likely it is for the same voltage signal to cause the ADC to reach the full scale (current sampling range), and the narrower the current range that can be sampled can be configured, but the sampling accuracy is higher. Therefore, if only one amplification factor is used, it is impossible to balance the accuracy of detecting large and small currents. Specifically, the current sampling accuracy is relatively high in the small current section or when judging no-load, but large currents cannot be measured, or large currents can be accurately measured, but the sampling accuracy of small currents is reduced instead. Therefore, the configuration method with a fixed amplification factor cannot balance the current sampling range and the sampling accuracy requirements under the corresponding current conditions, including the inability to achieve: both the current sampling range can be balanced and a relatively high current sampling accuracy can be obtained at small currents.

[0025] The prior art generally uses multiple amplifier circuits with different amplification factors (i.e., multiple amplification branches connected to the same conversion unit) to amplify the same detected analog signal respectively and selects the amplified analog signal of each amplifier circuit as the conversion analog signal. This will introduce too many amplifier circuits due to the increase in the types of amplification factors, increasing the overall circuit area resources. There is also a method of using multiple groups of amplification resistors in combination with analog switches (constituted by MOS transistors) to implement the selection of multiple current range gears. However, in order to configure multiple current sampling ranges, the number of amplification resistors and analog switches will be increased, resulting in an increase in the hardware device cost of current detection. Furthermore, in a corresponding scale circuit system, corresponding address selection signals (equivalent to address coding information) need to be designed specifically for each amplifier circuit or each analog switch, increasing the number of signals that need to be configured and the complexity of current and voltage detection control. Moreover, each amplifier circuit or each amplification resistor introduced in the prior art only represents one amplification factor, which means that the number of available amplification factors in a circuit detector is fixed, so the compatibility of the sampling accuracy for different currents is limited, and the flexibility of amplification factor adjustment is also limited.

[0026] Some or all of the processes of the current sampling method based on amplification factor adjustment disclosed in this application can be in the form of software and / or hardware, and can be executed by the current detector of this application or its equivalent device. Without affecting the full disclosure and implementability of this application, the following description of this application will focus on the step content rather than the hardware.

[0027] As an embodiment, this embodiment discloses a current sampling method based on magnification adjustment. The execution subject of the current sampling method is a processor, a single-chip microcomputer, or other controllers capable of performing current sampling and detection operations. Refer to Figure 1 It can be seen that the current sampling method includes: In step 1, the input real-time current signal is converted into a sampled voltage signal through a current sampling circuit, and then the sampled voltage signal is amplified according to the current magnification. Then, the current sampling circuit is controlled to convert the amplified sampled voltage signal into the voltage value corresponding to the real-time current signal, and then step 2 is executed. Schematically, generally, the real-time current signal flowing through the current-sensing resistor (for example, a current of 1 A) is first converted into a sampled voltage signal (1 A * 5 mΩ = 5 mV), and 5 mV is the voltage value of the sampled voltage signal. Since 5 mV is too small and the error generated by directly detecting it by the ADC is too large, it is necessary to first amplify 5 mV through an amplifier. If the current magnification of the amplifier is 40 times, then based on 5 mV * 40 = 0.2 V, it can be obtained that the voltage value corresponding to the real-time current signal is 0.2 V.

[0028] It should be noted that the current sampling circuit includes an amplification circuit. The amplification circuit is a circuit that amplifies analog signals and includes an operational amplifier. It can amplify the analog signal by a specified multiple according to the specifications of electronic components, the design of the circuit, etc., and can represent the voltage ratio of the output signal of the amplification circuit to its input signal. The amplification circuit is connected to a current-sensing device, and the current-sensing device is a current-sensing resistor provided inside the current sampling circuit. The amplification circuit is used to obtain the sampled voltage signal output by the current-sensing device and amplify it.

[0029] The current sampling circuit disclosed in this embodiment does not have multiple groups of resistors connected in parallel inside, nor does it have multiple operational amplifiers. However, it is necessary to adjust the magnification by changing the resistance value of the operational amplifier resistors arranged outside the operational amplifier. The operational amplifier resistors arranged outside the operational amplifier include multiple resistors connected in series. Specifically, the current sampling circuit disclosed in this application includes an operational amplifier to form an amplification circuit, and the current magnification can be configured as the circuit amplification coefficient of the operational amplifier. Compared with the prior art, the outside of this operational amplifier is not connected to multiple groups of resistors connected in parallel (for example, setting multiple groups of inductive resistors connected in parallel to configure multiple selectable current sampling ranges, or setting multiple amplification resistors connected in parallel to configure multiple circuit amplification multiples). Correspondingly, the required current judgment threshold can be reduced, which can be understood as reducing the setting of multiple amplification circuits (one amplification circuit corresponds to one configured magnification), which is beneficial to reducing the circuit scale and saving the circuit area required for current detection.

[0030] In step 2, the amplification factor of the current sampling circuit is adjusted based on the voltage value corresponding to the real-time current signal, and then the adjusted amplification factor is updated as the current amplification factor to realize the update of the current amplification factor. Then, step 1 is executed and the voltage value corresponding to the real-time current signal converted in the latest executed step 1 is set as the currently sampled current value. When performing step 1, the same sampling voltage signal is amplified using the current amplification factor updated in the latest executed step 2. Then, the voltage value corresponding to the real-time current signal converted from the amplified sampling voltage signal in the current sampling circuit represents the current detection value detected in this embodiment. When the actual current value of the real-time current signal changes, while keeping the same amplification factor and the same current detection resistor, the voltage value corresponding to the real-time current signal changes accordingly. Therefore, by repeatedly executing step 1 and step 2, the amplification factor set in the current sampling circuit is prompted to change adaptively following the change of the real-time current signal. Thus, the amplification factors that can be configured by the current sampling circuit are not just several fixed ones. Moreover, within the same current sampling range or the same current sampling range, multiple amplification factors can be configured to achieve the use of multiple current sampling precisions on the premise that the voltage value corresponding to the real-time current signal does not exceed the current sampling range (the full scale of the ADC). This includes adjusting a larger amplification factor to use a higher current sampling precision when sampling a small current and ensuring that the amplified signal does not exceed the sampling range, and also includes switching to a smaller amplification factor to use a smaller current sampling precision when sampling a large current and ensuring that the amplified signal does not exceed the sampling range.

[0031] Generally, a current less than 1 A or 1.2 A is defined as a small current. Therefore, 1 A or 1.2 A is the small current judgment threshold. It is also possible to define a current greater than 1 A or 1.5 A as a large current. Therefore, 1 A or 1.5 A is the large current judgment threshold. Moreover, the current flowing through the current detection resistor in the no-load state belongs to a small current.

[0032] The current sampling circuit is used to amplify the sampling voltage signal converted from the input real-time current signal according to the currently adjusted current amplification factor. Here, the amplification uses a calculation formula related to the amplification information such as the current amplification factor. The calculation formula can be selected in real time according to the adjusted amplification factor and is related to the resistance value of the operational amplifier resistors set inside the current sampling circuit. In this embodiment, to change the amplification factor, the resistance value of the operational amplifier resistors set inside the current sampling circuit is adjustable. Here, the operational amplifier resistors in the current sampling circuit are used to calculate the current amplification factor and are preferably represented by a selected resistance value position of a sliding resistor, making it possible for the controller to control the current sampling circuit to adjust an appropriate amplification factor, thereby replacing the existing technology of setting multiple operational amplifiers and / or multiple groups of amplification resistors.

[0033] In summary, based on the current sampling circuit, by performing the aforementioned steps 1 and 2, the amplification factor of the current sampling circuit can vary with the voltage value corresponding to the real-time current signal, and can adjust the corresponding amplification factor within different voltage ranges. There is no need to set multiple groups of inductive resistors connected in parallel on the hardware to configure multiple available current sampling ranges, nor is it necessary to set multiple amplification resistors connected in parallel on the hardware to configure multiple amplification factors for circuit amplification. It can flexibly and effectively configure the reasonable amplification factor of the current sampling circuit in real time to be compatible with the current sampling accuracy, and can also make the hardware design part of current detection simpler.

[0034] Furthermore, on the basis of saving circuit area and reducing circuit device costs, when detecting large currents, the current sampling circuit can automatically adjust to a smaller amplification factor so that the voltage value corresponding to the amplified and converted real-time current signal can ensure the breadth of current detection without over-range problems; when detecting small currents, the current sampling circuit can automatically adjust to a larger amplification factor, which can improve the accuracy of small current detection, etc., improve the sampling accuracy in the small current segment and be compatible with the sampling range (detection breadth) in the large current segment, and is applicable to occasions where the current changes rapidly and has a large change range.

[0035] Based on the above embodiment, in the step 2, the method for adjusting the amplification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal includes: When the voltage value corresponding to the currently converted real-time current signal becomes larger, the current amplification factor is adjusted downward to adjust an appropriate amplification factor, which may be to continuously adjust the current amplification factor downward several times. At this time, the voltage value corresponding to the currently converted real-time current signal may be greater than a voltage threshold. Specifically, if the controller outside the current sampling circuit detects that the voltage value corresponding to the real-time current signal becomes larger, preferably falling within the first voltage threshold range, it controls the current sampling circuit to adjust the current amplification factor downward to an amplification factor. Among them, when the current value of the input real-time current signal becomes larger, the voltage value corresponding to the currently converted real-time current signal becomes larger; therefore, the increase in the voltage value corresponding to the currently converted real-time current signal can reflect the increase in the current value of the real-time current signal. When the current value of the input real-time current signal becomes larger, the current amplification factor is adjusted downward.

[0036] When the voltage value corresponding to the currently converted real-time current signal becomes smaller, increase the current magnification factor to adjust to a suitable magnification factor. It can be to continuously decrease the current magnification factor multiple times. At this time, the voltage value corresponding to the currently converted real-time current signal may be less than the two voltage thresholds. Specifically, if the controller outside the current sampling circuit detects that the voltage value corresponding to the real-time current signal becomes smaller, preferably falling within the second voltage threshold range, then control the current sampling circuit to increase the current magnification factor to another magnification factor. Among them, when the current value of the input real-time current signal becomes smaller, the voltage value corresponding to the currently converted real-time current signal becomes smaller; therefore, the decrease in the voltage value corresponding to the currently converted real-time current signal can reflect the decrease in the current value of the real-time current signal. When the current value of the input real-time current signal becomes smaller, increase the current magnification factor.

[0037] Thus, within the full-scale current sampling range, when sampling a larger current, a smaller magnification factor can be adjusted; when sampling a smaller current, a larger magnification factor can be adjusted; this can not only ensure the accuracy of current sampling but also not exceed the current sampling range.

[0038] In some embodiments, regarding the relationship between the voltage value corresponding to the real-time current signal and the magnification factor of the current sampling circuit, if it is detected that the voltage value corresponding to the real-time current signal becomes larger and meets the corresponding voltage threshold range, generally control the current sampling circuit to decrease the current magnification factor to become the suitable magnification factor; if it is detected that the voltage value corresponding to the real-time current signal becomes smaller and meets the corresponding voltage threshold range, generally control the current sampling circuit to increase the current magnification factor. Therefore, the magnification factor required for sampling the current can be switched accordingly following the change in the voltage value corresponding to the real-time current signal, so that both the current sampling range (for example, not exceeding the established current sampling range) can be taken into account and a higher current sampling accuracy can be obtained when the current is small.

[0039] As an example, in step 2, whenever the current sampling circuit converts the voltage value corresponding to the real-time current signal through step 1, determine whether the voltage value corresponding to the currently converted real-time current signal is within the corresponding voltage threshold range, including determining whether the voltage value corresponding to the currently converted real-time current signal becomes larger or smaller, each corresponding to a voltage threshold range.

[0040] When the voltage value corresponding to the currently converted real-time current signal is within the first voltage threshold range, adjust the current magnification to the first magnification so that the voltage value corresponding to the real-time current signal does not exceed the pre-configured sampling range; wherein, the first magnification becomes the magnification adapted to the voltage value corresponding to the currently detected real-time current signal, the corresponding voltage threshold range is the first voltage threshold range, and the current sampling range includes the first voltage threshold range. If the controller outside the current sampling circuit detects that the voltage value corresponding to the real-time current signal increases and falls within the first voltage threshold range, the current sampling circuit adjusts the current magnification down to the first magnification. In the current sampling circuit, when the current in the path where the current detecting resistor is located is large and the requirement for current sampling accuracy is not high, the current magnification can be switched to a lower magnification, which can be switching the initial magnification to the first magnification, so as to allow a wider current detection range and not exceed the pre-configured current sampling range. During the process of implementing the adjustment operation using the circuit, the current sampling circuit can adjust the resistor inside it used to calculate the current magnification to make the current magnification become the first magnification, then the current sampling circuit can use the first magnification for the analog signal to be sampled, wherein the resistor used to calculate the current magnification is connected to the operational amplifier inside the current sampling circuit.

[0041] When the voltage value corresponding to the currently converted real-time current signal is within the second voltage threshold range, adjust the current magnification to the second magnification to improve the current sampling accuracy of the current sampling circuit, wherein, the second magnification becomes the magnification adapted to the voltage value corresponding to the currently detected real-time current signal, and the corresponding voltage threshold range is the second voltage threshold range. It should be noted that the lower limit value of the first voltage threshold range is greater than the upper limit value of the second voltage threshold range, so that any current value within the first voltage threshold range is greater than any current value within the second voltage threshold range, and the first magnification is less than the second magnification. Preferably, the current sampling range also includes the second voltage threshold range. If the controller outside the current sampling circuit detects that the voltage value corresponding to the real-time current signal decreases and falls within the second voltage threshold range, the current sampling circuit adjusts the current magnification up to the second magnification.

[0042] It should be noted that the relationship between the voltage value corresponding to the real-time current signal and the corresponding voltage threshold range indicates whether the voltage value corresponding to the real-time current signal falls within the corresponding voltage threshold range; when the voltage value corresponding to the real-time current signal is too large or too small, the voltage threshold range required to judge the voltage value corresponding to the real-time current signal is different. Accordingly, the current sampling circuit may adjust different magnifications, and the boundary values of the voltage threshold ranges before and after the change do not coincide, that is, the upper and lower limit values of the voltage threshold range are not equal to each other.

[0043] In the current sampling circuit, the current in the path where the current detection resistor is located is small. For example, when the threshold current is collected under no-load conditions and high-precision current sampling accuracy is required (meeting the ADC sampling accuracy requirements), the current amplification factor is switched to a larger amplification factor. During the process of using the circuit to perform the adjustment operation, the current sampling circuit can adjust the resistor inside it used to calculate the current amplification factor, so that the current amplification factor becomes the second amplification factor, which can be switched from the first amplification factor to the second amplification factor. Then, the current sampling circuit can use the second amplification factor to amplify the analog signal to be sampled. Among them, the resistor used to calculate the current amplification factor is connected to the operational amplifier inside the current sampling circuit.

[0044] In this embodiment, for the case where the amplitude range of the voltage signal collected by the current detection resistor inside the current sampling circuit is relatively wide, different amplification factors are required to achieve signal conditioning; the smaller the current amplification factor, the wider the current range that can be sampled (current detection range). When the voltage value corresponding to the real-time current signal is within the first voltage threshold range, the current amplification factor is adjusted to the first amplification factor, and the formed wider detection range does not exceed the sampling range; the larger the current amplification factor, the narrower the current range that can be sampled. When the voltage value corresponding to the real-time current signal is within the second voltage threshold range, the current amplification factor is adjusted to the second amplification factor to improve the sampling accuracy. The amplification factor required for sampling the current can change with the voltage value corresponding to the real-time current signal, so that both the current sampling range (for example, not exceeding the established current sampling range) can be taken into account, and higher current sampling accuracy can be obtained when the current is small.

[0045] As an embodiment, when the initial value of the current amplification factor is set to the third amplification factor, if the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the initial state is within the second voltage threshold range, the current amplification factor is adjusted to the second amplification factor or remains the third amplification factor to improve the current sampling accuracy of the current sampling circuit; when the initial value of the amplification factor set inside the current sampling circuit is the third amplification factor, if the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the initial state is within the first voltage threshold range, the current amplification factor is adjusted to the first amplification factor so that the voltage value corresponding to the real-time current signal does not exceed the pre-configured sampling range; among them, the third amplification factor is greater than the second amplification factor, the first amplification factor is less than the second amplification factor, and the lower limit value of the first voltage threshold range is greater than the upper limit value of the second voltage threshold range. Thus, based on the judgment of the first voltage threshold range and the second voltage threshold range, the current amplification factor can be controlled to switch between the second amplification factor and the first amplification factor starting from the third amplification factor, which not only ensures the current sampling accuracy but also does not exceed the sampling range.

[0046] Preferably, the third magnification is set to 160, and the initial state is the no-load state of the current sampling circuit, that is, the working state in which the current detection resistor of the current sampling circuit does not introduce an external load current. Then, the current in the path where the current detection resistor is located is extremely small, which is reflected as an extremely small voltage value corresponding to the real-time current signal. To meet the sampling accuracy requirements of the ADC, the third magnification needs to be set relatively large, for example, greater than the aforementioned second magnification.

[0047] As an embodiment, in step 2, the method for adjusting the magnification of the current sampling circuit based on the voltage value corresponding to the real-time current signal further includes: setting the voltage threshold range defined by the lower limit value of the first voltage threshold range and the upper limit value of the second voltage threshold range as the hysteresis sampling value range; when the voltage value corresponding to the currently converted real-time current signal is within the hysteresis sampling value range, controlling the current magnification to remain unchanged; specifically, if it is further detected that the voltage value corresponding to the currently converted real-time current signal is less than the lower limit value of the first voltage threshold range, controlling the current magnification to maintain the first magnification unchanged until the voltage value corresponding to the currently converted real-time current signal enters the second voltage threshold range; if it is further detected that the voltage value corresponding to the currently converted real-time current signal is greater than the upper limit value of the second voltage threshold range, controlling the current magnification to maintain the second magnification unchanged until the voltage value corresponding to the currently converted real-time current signal enters the first voltage threshold range. Thus, during the switching process between small current (which can be understood as the current value falling within the second voltage threshold range) and large current (which can be understood as the current value falling within the first voltage threshold range), a hysteresis range is formed to avoid frequently adjusting the current magnification at a single critical value (such as the aforementioned upper limit value or lower limit value) of the voltage value corresponding to the real-time current signal, ensuring the stability of the current magnification and further ensuring the stability of the magnification adjustment of the current sampling circuit.

[0048] Preferably, taking the current sampling circuit as an example, the resistance value of the current detecting resistor is 5 mΩ, the current magnification factor is 80 times, and the large current judgment threshold is 1.5 A (that is, a current greater than 1.5 A is recorded as a large current). The lower limit value of the first voltage threshold range is equal to 1.5 A * 5 mΩ * 80 = 0.6 V, and the first voltage threshold range is set to be greater than 0.6 V; the first magnification factor is 40; Similarly, taking the current sampling circuit as an example, the resistance value of the current detecting resistor is 5 mΩ, the current magnification factor is 80 times, and the small current judgment threshold is 1.2 A (that is, a current less than 1.2 A is recorded as a small current). The upper limit value of the second voltage threshold range is equal to 1.2 A * 5 mΩ * 80 = 0.48 V, and the second voltage threshold range is set to be less than 0.48 V; the second magnification factor is 80; When necessary, the second magnification factor can be set to be equal to the third magnification factor 160; The hysteresis sampling value range is set to be greater than or equal to 0.48 V and less than or equal to 0.6 V. For example, a current less than 1.2 A is defined as a small current, and a current greater than 1.5 A is defined as a large current. If the voltage value corresponding to the real-time current signal is 0.5 V, then by setting the hysteresis sampling value range, frequent adjustment of the current magnification factor can be prevented. Specifically, when it is detected that the voltage value corresponding to the real-time current signal decreases to less than 0.48 V, the current magnification factor will be switched to 80, but when the voltage value corresponding to the real-time current signal suddenly increases to 0.49 V, 0.5 V, 0.55 V, the current magnification factor will not be switched to 40, but the current magnification factor will only be switched to 40 after the voltage value corresponding to the real-time current signal increases to greater than 0.6 V. Thus, the specific numerical range of the hysteresis sampling value range is set with the lower limit value of the first voltage threshold range and the upper limit value of the second voltage threshold range as two adjacent thresholds, preventing the current sampling circuit from frequently adjusting the current magnification factor at a single critical value.

[0049] The present application also discloses a current detector. Refer to Figure 2, the current detector includes an MCU, an adjustable amplification unit, an ADC unit, and a current detection resistor Rsense. Among them, the current detection resistor Rsense, the adjustable amplification unit, and the ADC unit are connected in sequence to form the current sampling circuit disclosed in the foregoing embodiment. In this embodiment, the current detection resistor Rsense is connected to the load interface, the current detection resistor Rsense is connected to the adjustable amplification unit. The current detection resistor Rsense is used to receive the real-time current signal flowing into the load interface and generate a sampling voltage signal, that is, the real-time current signal flows through the current detection resistor Rsense and forms a sampling voltage signal at both ends of the current detection resistor Rsense, and then transmits the generated sampling voltage signal to the adjustable amplification unit. The ADC unit is connected to the adjustable amplification unit. The adjustable amplification unit is used to amplify and process the sampling voltage signal to obtain the voltage value to be detected, and then transmit the voltage value to be detected to the ADC unit; the ADC unit is connected to the MCU. The ADC unit is used to control the conversion of the voltage value to be detected into the voltage value corresponding to the real-time current signal, and then transmit the voltage value corresponding to the real-time current signal to the MCU, and then transmit the voltage value corresponding to the real-time current signal to the MCU. Specifically, the adjustable amplification unit generally amplifies the amplitude value of the analog signal to be sampled according to the current amplification factor, and the current amplification factor can be pre-configured. In this embodiment, the voltage value corresponding to the real-time current signal is the voltage value of the digital signal encoded and mapped by the amplified sampling voltage signal, which is equivalent to the analog signal being converted into a digital signal by the ADC to sample and obtain a voltage value with higher accuracy, so as to realize using the voltage value to represent the load current to be detected by the current sampling circuit, and the load current flows through the current detection resistor Rsense, and the load current is the real-time current signal. The current detection resistor Rsense is generally very small (the reason for using a very small current detection resistor is to reduce the power consumption on the path), so the voltage drop across the current detection resistor Rsense will be very small, such as a few millivolts. It is not feasible to directly send such a small voltage to the ADC unit to collect the voltage, and the error of the collected result is very large. Therefore, it is necessary to amplify the collected small voltage. The circuit structure supporting the amplification process includes a proportional amplifier, and the ratio is determined by the resistance value of the operational amplifier resistor.

[0050] It should be noted that the adjustable amplification unit is a circuit that amplifies analog signals. It can amplify analog signals by a specified multiple according to the specifications of electronic components, the design of the circuit, etc. It can represent the voltage ratio of the output signal of the adjustable amplification unit to its input signal, that is, the circuit amplification factor. The adjustable amplification unit is connected to the current detection resistor Rsense. The adjustable amplification unit is used to obtain the analog signal to be sampled output by the current detection resistor Rsense and amplify it, where the analog signal to be sampled includes a current signal.

[0051] The adjustable amplification unit, the ADC unit, and the MCU are connected in sequence to form a closed-loop feedback circuit; the MCU is used to adjust the corresponding amplification factor based on the voltage value corresponding to the real-time current signal, and then trigger the adjustable amplification unit to amplify the sampled voltage signal according to the corresponding amplification factor. The result of converting the amplified sampled voltage signal by the ADC unit is updated to the voltage value corresponding to the real-time current signal. Then, the voltage value corresponding to the real-time current signal is the voltage value currently sampled by the MCU. Since the same sampled voltage signal is amplified according to the corresponding amplification factor, the adjustable amplification unit, the ADC unit, and the MCU are connected in sequence to form a closed-loop feedback circuit.

[0052] In this embodiment, the MCU is used to control the adjustable amplification unit to adjust the corresponding amplification factor according to the magnitude change relationship of the voltage value corresponding to the real-time current signal, including adjusting the operational amplifier resistors in the adjustable amplification unit for calculating the amplification factor based on the magnitude relationship between the voltage value corresponding to the real-time current signal and the corresponding voltage threshold, so as to adjust the corresponding amplification factor and be compatible with the current sampling accuracy and the current sampling range (equivalent to the current sampling range). It should be noted that the relationship between the voltage value corresponding to the real-time current signal and the corresponding voltage threshold indicates whether the voltage value corresponding to the real-time current signal is greater than or less than the corresponding voltage threshold; when the voltage value corresponding to the real-time current signal is too large or too small, the voltage threshold required to judge the voltage value corresponding to the real-time current signal is different. Accordingly, the adjustable amplification unit may adjust different amplification factors under the control of the MCU. Generally, a current less than 1A is defined as a small current, and a current greater than 1A is defined as a large current. Moreover, the current flowing through the current sensing resistor Rsense in the no-load state belongs to a small current. In some embodiments, based on the relationship between the voltage value corresponding to the real-time current signal and the corresponding voltage threshold, if it is detected that the voltage value corresponding to the real-time current signal is greater than a corresponding voltage threshold, which is equivalent to the voltage value corresponding to the real-time current signal falling within a corresponding voltage threshold range, the MCU adjusts the amplification factor smaller through the adjustable amplification unit to become the corresponding amplification factor; if it is detected that the voltage value corresponding to the real-time current signal is less than another corresponding voltage threshold, which is equivalent to the voltage value corresponding to the real-time current signal falling within another corresponding voltage threshold range, the MCU adjusts the amplification factor larger through the adjustable amplification unit to become the corresponding amplification factor.

[0053] Therefore, the amplification factor required for the current detector to sample the current can change correspondingly with the change of the voltage value corresponding to the real-time current signal, so that both the current sampling range of the current detector (for example, not exceeding the established sampling range) can be taken into account, and a higher current sampling accuracy can be obtained when the current is small.

[0054] The adjustable amplification unit is used to amplify the sampled voltage signal according to the amplification factor adjusted in real time. The amplification here uses a calculation formula related to the amplification factor. The calculation formula can be selected in real time according to the adapted amplification factor and is related to the resistance set inside the adjustable amplification unit. In this embodiment, in order to change the amplification factor, the resistance set inside the adjustable amplification unit for calculating the current amplification factor supports automatic adjustment. The resistance used to calculate the current amplification factor can be represented by a resistance value gear in the adjustable resistor in this embodiment. The multiple resistance value gears that can be adjusted in the adjustable resistor or the multiple resistance value gears that can be selected in the adjustable amplification unit can sequentially amplify the same sampled voltage signal, so that the MCU controls the adjustable amplification unit to adjust the adapted amplification factor by adjusting the resistance value gear of the adjustable resistor, and there is no need to set multiple operational amplifiers and / or multiple groups of operational amplifier resistors in the adjustable amplification unit.

[0055] In summary, in the current detector, the current sensing resistor Rsense, the adjustable amplifier unit and the ADC unit are connected in sequence to form a current sampling circuit, and the adjustable amplifier unit, the ADC unit and the MCU are connected in sequence to form a closed-loop feedback circuit. There is no need to set multiple groups of mutually parallel sensing resistors in hardware to configure multiple groups of current sampling ranges for selection, nor is there a need to set multiple mutually parallel amplifier resistors in hardware to configure multiple multiples for circuit amplification. Instead, the voltage value corresponding to the real-time current signal is adjusted to a corresponding amplification factor, so that the current detector forms a fast and reasonable selection amplification circuit, and supports the adjustable amplifier unit to automatically and efficiently adjust a variety of amplification factors, so that the corresponding current sampling range can be taken into account by adjusting the amplification factor in a large current detection environment, and the current sampling accuracy can be improved by adjusting the amplification factor when the current is small, thereby improving the sampling accuracy and detection speed of different current segments.

[0056] Specifically, the method for the MCU to adjust the amplification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal includes: when the voltage value corresponding to the real-time current signal currently converted by the ADC unit becomes larger, the MCU reduces the current amplification factor to adjust to a suitable amplification factor; specifically, when the MCU detects that the voltage value corresponding to the real-time current signal becomes larger, the MCU controls the adjustable amplification unit to increase the resistance value gear to form a suitable amplification factor, which means that the amplification factor of the adjustable amplification unit is reduced to a suitable amplification factor. When the voltage value corresponding to the real-time current signal currently converted by the ADC unit becomes smaller, the MCU increases the current amplification factor to adjust to a suitable amplification factor. Specifically, when the MCU detects that the voltage value corresponding to the real-time current signal becomes smaller, it controls the adjustable amplification unit to reduce the resistance value gear to form a suitable amplification factor, which means that the amplification factor of the adjustable amplification unit is increased to a suitable amplification factor. Thus, within the full range, when detecting a larger current, a smaller amplification factor can be adjusted; when detecting a smaller current, a larger amplification factor can be adjusted; this not only ensures the accuracy of current detection but also does not exceed the range.

[0057] As an embodiment, as Figure 2 shown, the adjustable amplification unit includes an operational amplifier, a feedback resistor R2, a variable resistor R1, and an inverter; the feedback resistor R2 is connected between the negative input terminal - of the operational amplifier and the output terminal of the operational amplifier, the first end of the variable resistor R1 is connected to the negative input terminal - of the operational amplifier, and the second end of the variable resistor R1 is connected to the first end of the current sensing resistor Rsense; the adjustment terminal of the variable resistor is connected to the MCU, and the adjustment terminal of the variable resistor changes the resistance value gear of the variable resistor under the control of the resistance adjustment signal output by the selection control signal output terminal of the MCU; the second end of the current sensing resistor Rsense is grounded, and the second end of the current sensing resistor Rsense is also connected to the positive input terminal + of the operational amplifier to form an inverting proportional amplifier, specifically, the operational amplifier, the feedback resistor R2, and the variable resistor R1 are connected to form an inverting proportional amplifier. The variable resistor R1 is used to receive the resistance adjustment signal sent by the MCU through its adjustment terminal and adjust the resistance value gear based on the resistance adjustment signal to obtain the suitable amplification factor, making it suitable for the voltage value corresponding to the real-time current signal flowing through the current sensing resistor or the real-time current signal before adjustment. If the resistance adjustment signal feedback shows that the voltage value corresponding to the real-time current signal is greater than a corresponding voltage threshold, the resistance value gear of the variable resistor R1 is adjusted so that the amplification factor of the adjustable amplification unit forms an amplification factor suitable for the corresponding voltage threshold; if the resistance adjustment signal feedback shows that the voltage value corresponding to the real-time current signal is less than another corresponding voltage threshold, the resistance value of the variable resistor R1 is adjusted so that the amplification factor of the adjustable amplification unit forms an amplification factor suitable for the other corresponding voltage threshold.

[0058] In this embodiment, both the feedback resistor R2 and the adjustable resistor R1 are operational amplifier resistors in the adjustable amplification unit for calculating the amplification factor, and can play a role in amplifying the same sampled voltage signal by selecting the amplification factor corresponding to the resistance value of the adjustable resistor R1 based on the voltage value corresponding to the real-time current signal. The MCU sets the ratio between the resistance value of the feedback resistor R2 and the resistance value of the adjustable resistor R1 as the amplification factor of the adjustable amplification unit, that is, the ratio between the operational amplifier resistors of the inverting proportional amplifier formed by internal connection in the adjustable amplification unit.

[0059] The input end of the inverter is connected to the output end of the operational amplifier, and the output end of the inverter is connected to the conversion input end of the ADC unit. The inverter is used to invert the amplified signal output by the operational amplifier to obtain the sampled voltage signal after amplification processing. Since the operational amplifier, the feedback resistor R2, and the adjustable resistor R1 are connected to form an inverting proportional amplifier, an inverter still needs to be connected to the output end of the operational amplifier to obtain an analog amplified voltage signal with the same phase as the analog signal to be sampled, that is, the sampled voltage signal after amplification processing, and the corresponding voltage value is the voltage value to be detected.

[0060] Therefore, multiple groups of resistors connected in parallel with each other are not provided inside the current sampling circuit disclosed in this embodiment, nor are multiple operational amplifiers provided. The current sampling circuit disclosed in this embodiment includes one operational amplifier to form an amplification circuit, which is actually a proportional amplifier, and the ratio is determined by the resistance values of the operational amplifier resistors (feedback resistor and adjustable resistor). The ratio of the conventional operational amplifier is fixed in the sampling and detection scenarios of the prior art, while the current detector disclosed in this embodiment automatically adjusts the amplification factor according to the magnitude change of the voltage value corresponding to the real-time current signal, serving as the circuit amplification factor of the operational amplifier.

[0061] Compared with the prior art, multiple groups of resistors connected in parallel with each other are not connected to the periphery of the operational amplifier (for example, multiple groups of inductive resistors connected in parallel are set to configure multiple available current sampling ranges, or multiple operational amplifier resistors connected in parallel are set to configure multiple circuit amplification factors), and correspondingly, the current judgment thresholds required can be reduced. It can be understood as reducing the setting of multiple amplification circuits (one amplification circuit corresponds to one configured amplification factor), which is beneficial to reducing the circuit scale and saving the circuit area required for current detection.

[0062] Preferably, the adjustable resistor may include a plurality of resistors connected in series to form a slide rheostat for changing the resistance value range of the adjustable resistor by short - circuiting at least one resistor. The number of resistors to be short - circuited each time the resistance value range is adjusted is not limited. Therefore, within the adjustable amplification unit, the amplification factor is changed by changing the resistance value connected to the periphery of the operational amplifier. Compared with the prior art, multiple groups of resistors connected in parallel are not connected to the periphery of the operational amplifier (for example, multiple groups of inductive resistors connected in parallel are set to configure multiple selectable current detection ranges, or multiple operational amplifier resistors connected in parallel are set to configure multiple circuit amplification factors).

[0063] As an embodiment, whenever the ADC unit converts the voltage value corresponding to the real - time current signal, the MCU controls to compare the currently converted voltage value corresponding to the real - time current signal with the corresponding voltage threshold. Whenever the voltage value corresponding to the real - time current signal currently converted by the ADC unit is greater than the first voltage threshold, the MCU generates a corresponding resistance adjustment signal and transmits it to the adjustable resistor. The adjustable resistor selects a corresponding resistance value range based on the resistance adjustment signal, and the adjustable amplification unit adjusts the corresponding amplification factor to be equal to the first amplification factor, where the corresponding voltage threshold is the first voltage threshold. It should be noted that no matter whether the voltage value corresponding to the currently converted real - time current signal becomes larger and greater than the first voltage threshold, the MCU selects the corresponding resistance value range in the adjustable resistor and connects it to the adjustable amplification unit to configure the first amplification factor. Thus, a larger amplification factor such as 160 times can be used when the current is small, which can effectively improve the current sampling accuracy. When the voltage value corresponding to the real - time current signal currently converted by the ADC unit is less than the second voltage threshold, the MCU generates a corresponding resistance adjustment signal and transmits it to the adjustable resistor. The adjustable resistor selects a corresponding resistance value range based on the resistance adjustment signal, and the adjustable amplification unit adjusts the corresponding amplification factor to be equal to the second amplification factor to reduce the sampling error, where the corresponding voltage threshold is the second voltage threshold. It should be noted that when the voltage value corresponding to the currently converted real - time current signal becomes smaller and less than the second voltage threshold, the MCU selects the corresponding resistance value range in the adjustable resistor and connects it to the adjustable amplification unit to configure the second amplification factor. Among them, the first voltage threshold is greater than the second voltage threshold, and the first amplification factor is less than the second amplification factor. Therefore, a slightly smaller amplification factor such as 40 times can be used when the current is large, which can ensure that the sampled current does not exceed the acquisition range of the ADC.

[0064] In some embodiments, the current in the path where the current sensing resistor Rsense is located is small. For example, when the threshold current is collected under no-load conditions and high-precision requirements for current sampling accuracy (meeting the ADC sampling accuracy requirements) exist, the amplification factor is switched to a larger amplification factor. The MCU can adjust the resistance value range of the adjustable resistor to adjust the amplification factor to a second amplification factor, which can be switched from the first amplification factor to the second amplification factor. Then, the adjustable amplification unit can amplify the sampled voltage signal using the second amplification factor.

[0065] When the voltage value corresponding to the real-time current signal currently converted by the ADC unit is within the hysteresis sampling value range, the MCU generates a corresponding resistance adjustment signal and transmits it to the adjustable resistor. The adjustable resistor controls the selected resistance value range not to change based on the resistance adjustment signal, so that the amplification factor of the adjustable amplification unit remains unchanged; among them, the upper limit value of the hysteresis sampling value range is the first voltage threshold, and the lower limit value of the hysteresis sampling value range is the second voltage threshold, that is, the voltage threshold range defined by the lower limit value of the first voltage threshold range and the upper limit value of the second voltage threshold range is set as the hysteresis sampling value range. Specifically, if it is detected that the voltage value corresponding to the real-time current signal currently converted is less than the second voltage threshold, it can be recorded that the voltage value corresponding to the real-time current signal falls into a voltage threshold range, and then the amplification factor is controlled to remain unchanged at the second amplification factor until the voltage value corresponding to the real-time current signal currently converted is greater than the first voltage threshold; if it is detected that the voltage value corresponding to the real-time current signal currently converted is greater than the first voltage threshold, it can be recorded that the voltage value corresponding to the real-time current signal falls into a voltage threshold range, and then the amplification factor is controlled to remain unchanged at the first amplification factor until the voltage value corresponding to the real-time current signal currently converted is less than the second voltage threshold. Thus, during the switching process between small current (which can be understood as a current value less than the second voltage threshold) and large current (which can be understood as a current value greater than the first voltage threshold), a hysteresis range is formed to avoid frequent adjustment of the amplification factor at a single critical value (such as the aforementioned first voltage threshold or second voltage threshold), and the amplification factor is controlled to change stably when the voltage value corresponding to the real-time current signal changes to the corresponding voltage threshold range.

[0066] Although the foregoing embodiments take two amplification factors (the first amplification factor and the second amplification factor) as examples, this is not a limitation to the present application. Those skilled in the art of the present technology can appropriately apply the present application to configure more amplification factors according to the disclosure of the present application.

[0067] In summary, the smaller the amplification factor adjusted by the current detector, the wider the current range that can be sampled (current detection range). When the voltage value corresponding to the real-time current signal is greater than the first voltage threshold, the adjusted amplification factor equal to the first amplification factor is formed, and the wider current detection range does not exceed the current sampling range; the smaller the amplification factor adjusted by the current detector, the narrower the current range that can be sampled. When the voltage value corresponding to the real-time current signal is less than the second voltage threshold, the adjusted amplification factor equal to the second amplification factor is formed to improve the sampling accuracy. Therefore, the amplification factor required for the current detector to sample current can be adjusted according to the voltage value corresponding to the real-time current signal, so as to balance the current sampling range (for example, not exceeding the established sampling range) and obtain a higher current sampling accuracy at a smaller current.

[0068] Preferably, taking the resistance value of the current detection resistor as 5 mΩ, the current amplification factor as 80 times, and the large current judgment threshold as 1.5 A (that is, a current greater than 1.5 A is recorded as a large current) as an example, the first voltage threshold is equal to 1.5 A * 5 mΩ * 80 = 0.6 V, and the first amplification factor is 40; similarly, taking the resistance value of the current detection resistor as 5 mΩ, the current amplification factor as 80 times, and the small current judgment threshold as 1.2 A (that is, a current less than 1.2 A is recorded as a small current) as an example, the second voltage threshold is equal to 1.2 A * 5 mΩ * 80 = 0.48 V, and the second amplification factor is 80; if necessary, the second amplification factor can be set to be equal to the third amplification factor 160; the hysteresis sampling value range is set to be greater than or equal to 0.48 V and less than or equal to 0.6 V. For example, if a current less than 1.2 A is defined as a small current and a current greater than 1.5 A is defined as a large current, and the voltage value corresponding to the real-time current signal is 0.5 V, then setting the hysteresis sampling value range can prevent frequent adjustment of the current amplification factor. Thus, the specific numerical range of the hysteresis current value is set with the two adjacent thresholds of the first voltage threshold and the second voltage threshold to prevent the current sampling circuit from frequently adjusting the amplification factor at a single critical value. In addition, using a larger amplification factor such as 160 times at a small current can effectively improve the sampling accuracy and reduce the sampling error. Using a slightly smaller amplification factor such as 40 times at a large current can ensure that the sampled current does not exceed the ADC's sampling range. Therefore, within the full range, when detecting a larger current, a smaller amplification factor can be adjusted; when detecting a smaller current, a larger amplification factor can be adjusted; both ensuring the accuracy of current detection and not exceeding the range.

[0069] As an embodiment, the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the no-load state is less than the second voltage threshold, and the initial value of the amplification factor set in the current sampling circuit is set to the third amplification factor; wherein, the third amplification factor is greater than the second amplification factor; the no-load state is an electrical state where the load interface is not connected to a load. In the no-load state, the current detector's current sensing resistor Rsense is in a working state where no external load current is introduced, so the current in the path where the current sensing resistor Rsense is located is extremely small, which is reflected as an extremely small voltage value corresponding to the real-time current signal. To meet the sampling accuracy requirements of the ADC, the third amplification factor needs to be set relatively large, for example, greater than the aforementioned second amplification factor, and the third amplification factor is preferably 160.

[0070] If the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the no-load state is less than the second voltage threshold, the amplification factor is adjusted from the third amplification factor to the second amplification factor or remains the third amplification factor unchanged to improve the current sampling accuracy of the current sampling circuit. If the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the no-load state is greater than the first voltage threshold, the amplification factor is adjusted from the third amplification factor to the first amplification factor so that the voltage value corresponding to the real-time current signal does not exceed the pre-configured sampling range; wherein, the third amplification factor is greater than the second amplification factor, the first amplification factor is less than the second amplification factor, and the first voltage threshold is greater than the second voltage threshold. Thus, by combining the judgments of the first voltage threshold and the second voltage threshold, the adjustable amplification unit can control the amplification factor to switch between the second amplification factor and the first amplification factor starting from the third amplification factor, which not only ensures the current sampling accuracy but also does not exceed the sampling range of the ADC unit.

[0071] Generally, the voltage value corresponding to the real-time current signal converted by the current detector after power-on is less than the second voltage threshold, and the amplification factor of the adjustable amplification unit is set to the third amplification factor. In the no-load state, after the adjustable amplification unit amplifies the sampled voltage signal according to the third amplification factor, the voltage value corresponding to the real-time current signal converted by the amplified sampled voltage signal through the ADC unit is within the second voltage threshold range, and then the MCU can choose to increase the current amplification factor to the second amplification factor or keep it at the third amplification factor; thus meeting the requirements for higher current sampling accuracy in the application scenario of the current sampling circuit detecting the no-load threshold, which is beneficial to sampling a current value with higher accuracy by adjusting the current amplification factor in the no-load state.

[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that it is still possible to modify the specific implementation manners of the present invention or perform equivalent replacements for some technical features; without departing from the spirit of the technical solutions of the present invention, they should all be covered within the scope of the technical solutions claimed by the present invention.

Claims

1. A current sampling method based on magnification adjustment, characterized in that, Including: Step 1: Convert the input real-time current signal into a sampled voltage signal through a current sampling circuit, then amplify the sampled voltage signal according to the current magnification factor, and then control the current sampling circuit to convert the amplified sampled voltage signal into the voltage value corresponding to the real-time current signal; Then execute Step 2; Step 2: Adjust the magnification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal, then update the adjusted magnification factor to the current magnification factor, then execute Step 1, and set the voltage value corresponding to the real-time current signal converted in the latest executed Step 1 as the currently sampled current information; Wherein, an operational amplifier is provided inside the current sampling circuit to configure the current magnification factor.

2. The current sampling method according to claim 2, wherein In Step 2, the method for adjusting the magnification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal includes: When the voltage value corresponding to the currently converted real-time current signal becomes larger, reduce the current magnification factor to adjust an appropriate magnification factor; When the voltage value corresponding to the currently converted real-time current signal becomes smaller, increase the current magnification factor to adjust an appropriate magnification factor.

3. The current sampling method according to claim 2, wherein In Step 2, whenever the current sampling circuit converts the voltage value corresponding to the real-time current signal through Step 1, determine whether the voltage value corresponding to the currently converted real-time current signal is within the corresponding voltage threshold range; When the voltage value corresponding to the currently converted real-time current signal is within the first voltage threshold range, adjust the current magnification factor to the first magnification factor so that the voltage value corresponding to the real-time current signal does not exceed the pre-configured sampling range; wherein, the first magnification factor becomes the appropriate magnification factor under the currently detected real-time current signal, and the corresponding voltage threshold range is the first voltage threshold range; When the voltage value corresponding to the currently converted real-time current signal is within the second voltage threshold range, adjust the current magnification factor to the second magnification factor to improve the current sampling accuracy of the current sampling circuit, wherein, the second magnification factor becomes the appropriate magnification factor under the currently detected real-time current signal, and the corresponding voltage threshold range is the second voltage threshold range; Wherein, the lower limit value of the first voltage threshold range is greater than the upper limit value of the second voltage threshold range, and the first magnification factor is less than the second magnification factor; When the current sampling circuit adjusts the resistor inside it used to calculate the current magnification factor, the current magnification factor changes, wherein, the resistor used to calculate the current magnification factor is connected to the operational amplifier inside the current sampling circuit.

4. The current sampling method according to claim 3, wherein When the initial value of the current magnification factor is set to the third magnification factor, if the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the initial state is within the second voltage threshold range, then adjust the current magnification factor to the second magnification factor; When the initial value of the current magnification factor provided inside the current sampling circuit is set to the third magnification factor, if the voltage value corresponding to the real-time current signal converted by the current sampling circuit in the initial state is within the first voltage threshold range, then adjust the current magnification factor to the first magnification factor; Among them, the third magnification factor is greater than the second magnification factor.

5. The current sampling method according to claim 4, wherein In the said step 2, the method for adjusting the magnification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal further includes: Setting the voltage threshold range defined by the lower limit value of the first voltage threshold range and the upper limit value of the second voltage threshold range as the hysteresis sampling value range; When the voltage value corresponding to the currently converted real-time current signal is within the hysteresis sampling value range, controlling the currently set magnification factor to remain unchanged.

6. A current detector, characterized in that, The current detector includes an MCU, an adjustable amplification unit, an ADC unit, and a current detecting resistor; the current detecting resistor, the adjustable amplification unit, and the ADC unit are sequentially connected to form the current sampling circuit described in claim 1; The current detecting resistor is connected to the load interface, the current detecting resistor is connected to the adjustable amplification unit, and the current detecting resistor is used to receive the real-time current signal flowing in from the load interface and generate a sampling voltage signal, and then transmit the generated sampling voltage signal to the adjustable amplification unit; The adjustable amplification unit is used to amplify the sampling voltage signal to obtain a voltage value to be detected, and then transmit the voltage value to be detected to the ADC unit; The ADC unit is connected to the MCU; the ADC unit is used to control the voltage value to be detected to be converted into the voltage value corresponding to the real-time current signal, and then transmit the voltage value corresponding to the real-time current signal to the MCU; The adjustable amplification unit, the ADC unit, and the MCU are sequentially connected to form a closed-loop feedback circuit; the MCU is used to adjust the appropriate magnification factor based on the voltage value corresponding to the real-time current signal, and then trigger the adjustable amplification unit to amplify the sampling voltage signal according to the appropriate magnification factor, and then update the result of the amplified sampling voltage signal converted by the ADC unit to the voltage value corresponding to the real-time current signal, and set the updated voltage value corresponding to the real-time current signal as the currently sampled current information.

7. The current detector according to claim 6, wherein The method for the MCU to adjust the magnification factor of the current sampling circuit based on the voltage value corresponding to the real-time current signal includes: When the voltage value corresponding to the real-time current signal currently converted by the ADC unit becomes larger, the MCU reduces the currently set magnification factor to adjust the appropriate magnification factor; When the voltage value corresponding to the real-time current signal currently converted by the ADC unit becomes smaller, the MCU increases the currently set magnification factor to adjust the appropriate magnification factor.

8. The current detector according to claim 7, wherein, The adjustable amplification unit includes an operational amplifier, a feedback resistor, a variable resistor, and an inverter; The feedback resistor is connected between the negative input terminal and the output terminal of the operational amplifier. The first end of the variable resistor is connected to the negative input terminal of the operational amplifier, the second end of the variable resistor is connected to the first end of the current detecting resistor, the adjusting end of the variable resistor is connected to the MCU, the second end of the current detecting resistor is grounded, and the second end of the current detecting resistor is also connected to the positive input terminal of the operational amplifier to form an inverting proportional amplifier; The inverting proportional amplifier is used to amplify the sampling voltage signal and output an amplified signal from the output terminal of the operational amplifier; A variable resistor is used to automatically adjust the resistance value level under the control of a resistance adjustment signal sent by an MCU, so as to form the corresponding amplification factor, making it match the voltage value corresponding to the real-time current signal flowing through the current detection resistor or the real-time current signal before adjustment; among them, both the feedback resistor and the variable resistor are operational amplifier resistors used for calculating the amplification factor within the current sampling circuit. The input end of the inverter is connected to the output end of the operational amplifier, and the output end of the inverter is connected to the conversion input end of the ADC unit. The inverter is used to perform an inverting process on the amplified signal output by the operational amplifier to obtain the voltage value to be detected. Among them, the MCU sets the ratio between the resistance value of the feedback resistor and the resistance value of the variable resistor as the amplification factor of the adjustable amplification unit.

9. The current detector according to claim 8, wherein The variable resistor includes a plurality of resistors connected in series, and is used to change the resistance value level of the variable resistor by short-circuiting at least one resistor.

10. The current detector according to claim 8, characterized in that, Whenever the ADC unit converts the voltage value corresponding to the real-time current signal, the MCU controls to compare the currently converted voltage value corresponding to the real-time current signal with the corresponding voltage threshold. When the voltage value corresponding to the real-time current signal currently converted by the ADC unit is greater than the first voltage threshold, the MCU generates a corresponding resistance adjustment signal and transmits it to the variable resistor. The variable resistor selects a corresponding resistance value level based on the resistance adjustment signal, so that the adjusted amplification factor is equal to the first amplification factor. Among them, the corresponding amplification factor is the first amplification factor, and the corresponding voltage threshold is the first voltage threshold. When the voltage value corresponding to the real-time current signal currently converted by the ADC unit is less than the second voltage threshold, the MCU generates a corresponding resistance adjustment signal and transmits it to the variable resistor. The variable resistor selects a corresponding resistance value level based on the resistance adjustment signal, so that the adjusted amplification factor is equal to the second amplification factor. Among them, the corresponding amplification factor is the second amplification factor, and the corresponding voltage threshold is the second voltage threshold. When the voltage value corresponding to the real-time current signal currently converted by the ADC unit is within the hysteresis sampling value range, the MCU generates a corresponding resistance adjustment signal and transmits it to the variable resistor. The variable resistor controls the selected resistance value level not to change based on the resistance adjustment signal, so that the amplification factor of the adjustable amplification unit remains unchanged; among them, the upper limit value of the hysteresis sampling value range is the first voltage threshold, and the lower limit value of the hysteresis sampling value range is the second voltage threshold. Among them, the first voltage threshold is greater than the second voltage threshold, and the first amplification factor is less than the second amplification factor.

11. The current detector according to claim 10, wherein, The voltage value corresponding to the real-time current signal converted by the current sampling circuit in the no-load state is less than the second voltage threshold, and moreover, the initial value of the amplification factor set within the current sampling circuit is set as the third amplification factor. Among them, the third amplification factor is greater than the second amplification factor; the no-load state is an electrical state where the load interface is not connected to a load.