Current sampling circuit and device, current sampling method and storage medium
By introducing a comparison module and an amplification gain switching module into the current sampling circuit, the comparison of voltage signals and reference voltages and the switching of amplification ratios is achieved, which solves the problem of insufficient accuracy of the existing current sampling circuit and significantly improves the accuracy and speed of current sampling.
Patent Information
- Application Number
- CN202510325292.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-06-13
AI Technical Summary
The existing current sampling circuits are insufficient in accuracy, making it difficult to accurately sample the changing current.
A current sampling circuit is proposed, including a current acquisition module, a comparison module and an amplification gain switching module. By comparing the voltage signal with the preset reference voltage, outputting the range control signal, the amplification gain switching module switches the amplification factor in response to the range control signal.
The amplification factor is directly switched through the hardware logic circuit, which shortens the response time, significantly improves the switching speed of the current range, reduces the defect of range switching lags behind current changes, and improves the accuracy of current sampling.
Smart Images

Figure CN120142744A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of current measurement, and particularly to a current sampling circuit and device, a current sampling method, and a storage medium. Background Art
[0002] Current sampling is a technology for measuring current and converting it into an electrical signal. Current sampling is widely used in scenarios with high precision requirements such as battery testing and grid load detection. However, the current sampling accuracy is insufficient at present and it is difficult to meet the demand for accurate current measurement. The input current can be sampled by a current sampling circuit, but the accuracy of the current sampling circuit is relatively low at present. For example, during current sampling, the magnitude of the current often changes, and it is difficult for the current sampling circuit to accurately sample the changing current.
[0003] Therefore, how to improve the accuracy of current sampling has become an urgent technical problem to be solved. Summary of the Invention
[0004] The main purpose of the embodiments of this application is to propose a current sampling circuit and device, a current sampling method, and a storage medium, aiming to improve the accuracy of current sampling.
[0005] To achieve the above purpose, a first aspect of the embodiments of this application proposes a current sampling circuit, which includes:
[0006] A current acquisition module, a comparison module, and an amplification gain switching module; wherein, the comparison module includes a comparator;
[0007] The current acquisition module is electrically connected to the comparator and the amplification gain switching module; the comparator is electrically connected to the amplification gain switching module;
[0008] The current acquisition module is used to obtain a current signal and convert the current signal into a voltage signal; the comparator is used to compare the voltage signal with a preset reference voltage and output a range control signal according to the comparison result; the amplification gain switching module is used to switch the amplification multiple in response to the range control signal; the amplification gain switching module is also used to amplify the voltage signal according to the amplification multiple to calculate the current value corresponding to the voltage signal.
[0009] In some embodiments, the comparison module includes a first comparator, a second comparator, and a third comparator;
[0010] The current acquisition module is electrically connected to the input terminal of the first comparator, the input terminal of the second comparator, and the input terminal of the third comparator;
[0011] The output terminal of the first comparator, the output terminal of the second comparator, and the output terminal of the third comparator are electrically connected to the amplification gain switching module.
[0012] In some embodiments, the current sampling circuit further includes: a first voltage output module, a second voltage output module, and a third voltage output module;
[0013] The positive input terminal of the first comparator is electrically connected to the first voltage output module; the positive input terminal of the second comparator is electrically connected to the second voltage output module; the positive input terminal of the third comparator is electrically connected to the third voltage output module;
[0014] The current acquisition module is electrically connected to the negative input terminal of the first comparator, the negative input terminal of the second comparator, and the negative input terminal of the third comparator;
[0015] The first voltage output module is used to output a first reference voltage; the second voltage output module is used to output a second reference voltage; the third voltage output module is used to output a third reference voltage;
[0016] The first comparator is used to compare the voltage signal and the first reference voltage and output a first level signal; the second comparator is used to compare the voltage signal and the second reference voltage and output a second level signal; the third comparator is used to compare the voltage signal and the third reference voltage and output a third level signal.
[0017] In some embodiments, the amplification gain switching module includes a programmable gain amplifier;
[0018] The programmable gain amplifier is electrically connected to the output terminal of the first comparator, the output terminal of the second comparator, and the output terminal of the third comparator;
[0019] The programmable gain amplifier is used to switch the amplification multiple in response to the combination of the first level signal, the second level signal, and the third level signal.
[0020] In some embodiments, the current sampling circuit further includes: a voltage amplification module;
[0021] The voltage amplification module is electrically connected between the current acquisition module and the comparator;
[0022] The voltage amplification module is used to amplify the voltage signal output by the current acquisition module.
[0023] In some embodiments, the current sampling circuit further includes: an analog-to-digital conversion module;
[0024] The analog-to-digital conversion module is electrically connected to the amplification gain switching module;
[0025] The analog-to-digital conversion module is used to convert the voltage analog signal output by the amplification gain switching module into a voltage digital signal to calculate the current value corresponding to the voltage digital signal.
[0026] To achieve the above object, a second aspect of the embodiments of the present application proposes a current sampling device, and the current sampling device includes the current sampling circuit described in the first aspect above.
[0027] To achieve the above object, a third aspect of the embodiments of the present application proposes a current sampling method, and the method is applied to the current sampling circuit described in the first aspect above. The method includes:
[0028] Obtain an initial current signal through a current acquisition module, and perform signal conversion on the initial current signal to obtain an initial voltage signal;
[0029] Compare the initial voltage signal with a target reference voltage of the comparison module through the comparison module to obtain a range control signal;
[0030] In response to the range control signal, update the amplification multiple of the amplification gain switching module to obtain a target amplification multiple;
[0031] Amplify the initial voltage signal by the target amplification multiple through the amplification gain switching module to obtain a target voltage signal;
[0032] Calculate the current value of the target voltage signal to obtain a target current value.
[0033] In some embodiments, the comparison module includes a first comparator and a second comparator;
[0034] The step of comparing the initial voltage signal with a target reference voltage of the comparison module through the comparison module to obtain a range control signal includes:
[0035] Compare the initial voltage signal with a first reference voltage of the first comparator through the first comparator to obtain a first level signal;
[0036] Compare the initial voltage signal with a second reference voltage of the second comparator through the second comparator to obtain a second level signal; wherein, the first reference voltage is different from the second reference voltage;
[0037] Determine the combination of the first level signal and the second level signal as the range control signal.
[0038] To achieve the above object, a fourth aspect of the embodiments of the present application provides a computer-readable storage medium storing a computer program, which when executed by a processor implements the current sampling method described in the first aspect above.
[0039] The current sampling circuit, device, current sampling method, and storage medium proposed in the present application obtain a current signal through a current acquisition module and convert the current signal into a voltage signal to determine the amplification factor of the current. Then, a comparison module compares the voltage signal with a preset reference voltage, and outputs a range control signal according to the comparison result, so that the amplification gain switching module switches the amplification factor in response to the range control signal. It can be seen that when switching the amplification factor, this current sampling circuit does not rely on a software algorithm, but directly generates a range control signal by means of voltage comparison through a hardware logic circuit (including a comparator and an amplification gain switching module, etc.), and switches the current range (equivalent to switching the amplification factor) based on the range control signal, without software processing, shortening the response time, significantly improving the switching speed of the current range, and reducing the defect that the range switching lags behind the current change. Through the amplification gain switching module, the voltage signal is amplified according to the switched amplification factor. In this way, the current value corresponding to the voltage signal can be accurately measured, enabling accurate measurement of different magnitudes of current, thereby improving the accuracy of current sampling. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a block diagram of the current sampling circuit provided by an embodiment of the present application;
[0041] Figure 2 is a circuit schematic diagram of the current sampling circuit provided by an embodiment of the present application;
[0042] Figure 3 is a circuit schematic diagram of the comparison module provided by an embodiment of the present application;
[0043] Figure 4 is a block diagram of the current sampling circuit provided by another embodiment of the present application;
[0044] Figure 5 is a block diagram of the current sampling circuit provided by another embodiment of the present application;
[0045] Figure 6 is a flowchart of the current sampling method provided by an embodiment of the present application;
[0046] Figure 7 is Figure 1 a flowchart of step 102 in
[0047] Figure 8 is a flowchart of an application example provided by an embodiment of the present application.
[0048] Reference numerals: current acquisition module 10; comparison module 20; amplification gain switching module 30; voltage amplification module 40; analog-to-digital conversion module 50; comparator 21;
[0049] Shunt resistor R1; instrumentation amplifier IA1; first comparator COMP1; second comparator COMP2; third comparator COMP3; programmable gain amplifier PGA1; analog-to-digital converter ADC1. Specific embodiments
[0050] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0051] It should be noted that although functional module division is performed in the device schematic diagram and the logical sequence is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from the module division in the device or the sequence in the flowchart. Terms such as "first" and "second" in the specification, claims and the above-mentioned drawings are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence.
[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0053] First, several terms involved in this application are analyzed:
[0054] Central Processing Unit (CPU): It is the core component of a computer system, the computing core and control core of a computer. The central processing unit is responsible for interpreting and executing instructions, processing data and controlling the operations of other hardware devices.
[0055] Microcontroller Unit (MCU): It is a microcomputer system chip used to perform specific control tasks. The microcontroller unit integrates electronic components such as a central processing unit (CPU), memory (ROM / RAM), timer and input / output interfaces (such as GPIO, ADC, UART, etc.). The microcontroller unit directly manages and controls peripheral hardware by running embedded programs. For example, the microcontroller unit can control battery testing in power supplies, sensor data processing in automotive electronics, temperature control systems in smart homes, or logical operations of industrial automation devices.
[0056] Programmable Gain Amplifier (PGA): An analog integrated circuit used to amplify signals. The amplification gain of a programmable gain amplifier can be adjusted according to an external control signal.
[0057] Current sampling: Refers to the process of obtaining the current signal in a circuit in real time through a sensor or measurement circuit. For example, a shunt resistor, current transformer, or Hall effect sensor can be used to convert the current into a voltage or digital signal for detecting, controlling, or protecting electronic devices. Current sampling can be applied in fields such as intelligent electric vehicles, battery management, or overcurrent protection of industrial motors.
[0058] Current range: Refers to the range of current that a measuring instrument or sensor can accurately measure. For example, a digital multimeter can be set to different current ranges such as 0 - 10A (amperes) or 0 - 100A. Selecting an appropriate current range in circuit testing can not only capture small current changes but also avoid equipment damage or measurement errors caused by over-range.
[0059] The current sampling circuit, device, current sampling method, and storage medium provided by the embodiments of this application are specifically described through the following embodiments. First, the current sampling circuit in the embodiments of this application is described.
[0060] Figure 1 It is an optional module block diagram of the current sampling circuit provided by the embodiments of this application. The current sampling circuit includes:
[0061] A current acquisition module 10, a comparison module 20, and an amplification gain switching module 30; among them, the comparison module 20 includes a comparator 21;
[0062] The current acquisition module 10 is electrically connected to the comparator 21 and the amplification gain switching module 30; the comparator 21 is electrically connected to the amplification gain switching module 30;
[0063] The current acquisition module 10 is used to obtain a current signal and convert the current signal into a voltage signal; the comparator 21 is used to compare the voltage signal with a preset reference voltage and output a range control signal according to the comparison result; the amplification gain switching module 30 is used to switch the amplification multiple in response to the range control signal; the amplification gain switching module 30 is also used to amplify the voltage signal according to the amplification multiple to calculate the current value corresponding to the voltage signal.
[0064] The beneficial effects of the embodiments of the present application include but are not limited to: obtaining a current signal through the current acquisition module 10, and converting the current signal into a voltage signal for determining the amplification factor of the current. Then, the comparison module 20 compares the voltage signal with a preset reference voltage, and outputs a range control signal according to the comparison result, so that the amplification gain switching module 30 switches the amplification factor in response to the range control signal. It can be seen that when switching the amplification factor, this current sampling circuit does not rely on software algorithms, but directly generates a range control signal by means of voltage comparison through a hardware logic circuit (including a comparator 21 and an amplification gain switching module 30, etc.), and switches the current range (equivalent to switching the amplification factor) based on the range control signal, without software processing, shortening the response time, significantly improving the switching speed of the current range, and reducing the defect that the range switching lags behind the current change. Through the amplification gain switching module 30, the voltage signal is amplified according to the switched amplification factor. In this way, the current value corresponding to the voltage signal can be accurately measured, so that currents of different magnitudes can be accurately measured, thereby improving the accuracy of current sampling.
[0065] In some embodiments, the current acquisition module 10 refers to a circuit module for obtaining current. Specifically, the current acquisition module 10 may include a shunt, an ammeter, a current sensor, etc. For example, a current signal can be acquired through a shunt and converted into a voltage signal. In addition, the current acquisition module 10 may also include other types of electronic components for acquiring current, which are not limited thereto.
[0066] In some embodiments, the comparison module 20 refers to a circuit module for comparing the magnitudes of at least two voltages. Specifically, the comparison module 20 includes at least one comparator 21. Among them, the comparator 21 is used to compare the magnitudes of two voltage signals and output a level signal according to the comparison result, and the level signal can be a high level or a low level.
[0067] In some embodiments, the amplification gain switching module 30 is a circuit module for amplifying a voltage signal, and the amplification factor of the amplification gain switching module 30 can be switched. For example, the amplification gain switching module 30 may include a programmable gain amplifier (PGA). The amplification gain switching module 30 may also include other electronic components for amplifying voltage, which are not limited thereto.
[0068] In some embodiments, it should be noted that the current sampling circuit currently available is difficult to accurately sample a changing current. For example, in the scenario of battery testing, the charging and discharging current of the battery can be measured through a current sampling circuit, that is, current sampling is performed. During the current sampling process, the magnitude of the current often changes. To ensure the accuracy of the current sampling data, it is necessary to switch the current sampling circuit to a suitable range based on the magnitude of the current to ensure measurement accuracy.
[0069] However, the current current sampling circuit's range switching will lag behind the current change. For example, the current current sampling circuit usually executes a software algorithm in a controller (such as a CPU, MCU, etc.) to switch the current range. This requires the controller to first collect and determine the current current size, and then switch the amplification gain (equivalent to switching the current range). The execution of the software algorithm takes a long time and responds slowly to current changes, resulting in a long range switching delay, which can range from a few milliseconds to hundreds of milliseconds. Therefore, it is easy for the current to be greater than or less than the current range, but the range of the current sampling circuit is still stuck in the current range. This will affect the accuracy of the current data output by the current sampling circuit, and even cause the output of erroneous current data, thereby affecting the relevant battery test results. For another example, assuming that the controller switches the amplification gain during the current sampling process, the current data sampled during the switching time of the amplification gain will be abnormal data. This part of the abnormal data needs to be filtered out, but this will cause the current sampling data to be missing during the switching time, which greatly affects the accuracy of the current sampling.
[0070] Considering the problem of low current sampling accuracy mentioned above, the current sampling circuit proposed in the embodiment of the present application quickly compares the voltage through the comparison module 20 to output the range control signal, and the amplification gain switching module 30 switches the amplification factor in time in response to the range control signal output by the comparison module 20. In other words, the current sampling circuit of the embodiment of the present application switches the current range in the form of a logic circuit rather than a software algorithm, and can adjust the amplification gain (i.e., the amplification factor) of the current sampling circuit in real time as the current changes, so as to achieve seamless switching between different current ranges and avoid the range switching lagging behind the current change as much as possible. The high speed, dynamic follow-up, low delay (nanosecond level) and other characteristics of the comparator enable the switching of the amplification factor to be completed quickly, so that no abnormal data will be generated. Specifically, the switching delay of the amplification factor of the current sampling circuit of the embodiment of the present application can be less than 5 nanoseconds (ns). The embodiment of the present application can improve the efficiency and speed of current range switching, thereby improving the accuracy of current sampling.
[0071] See also Figure 2 and Figure 3 , in some embodiments, the comparison module 20 includes a first comparator COMP1, a second comparator COMP2, and a third comparator COMP3;
[0072] The current acquisition module 10 is electrically connected to the input end of the first comparator COMP1, the input end of the second comparator COMP2, and the input end of the third comparator COMP3;
[0073] An output terminal of the first comparator COMP1 , an output terminal of the second comparator COMP2 , and an output terminal of the third comparator COMP3 are electrically connected to the amplification gain switching module 30 .
[0074] The advantage of this embodiment is that the comparison module 20 is composed of the first comparator COMP1, the second comparator COMP2 and the third comparator COMP3. Furthermore, the voltage signal is compared with a preset reference voltage by the first comparator COMP1, the second comparator COMP2 and the third comparator COMP3, so as to switch the amplification factor according to the comparison result, and the amplification factor of the amplification gain switching module 30 can be switched in time when the current changes, improving the switching speed of the current range and thus improving the accuracy of current measurement.
[0075] It should be noted that in Figure 2 and Figure 3 , the arrow is used to indicate the current direction, which is also equivalent to indicating the transmission direction of the voltage signal.
[0076] In some embodiments, the comparison module 20 may include multiple comparators. In this embodiment of the application, 3 comparators are taken as an example for description. As Figure 3 shown, the comparison module 20 includes the first comparator COMP1, the second comparator COMP2 and the third comparator COMP3. The negative input terminals of the above 3 comparators are all connected to the same point, such as the output terminal of the instrumentation amplifier I A1. Among them, the instrumentation amplifier IA1 is used to amplify the voltage signal across the shunt resistor R1 (that is, the current acquisition module 10) so that the voltage signal meets the input voltage magnitude requirement of the comparator. And the positive input terminals of different comparators are respectively used to obtain different reference voltages. The comparator can compare the reference voltage at the positive input terminal and the voltage at the negative input terminal, and thus output a level signal. For example, in Figure 3 , U0 represents the voltage output after the instrumentation amplifier IA1 amplifies the voltage obtained by the shunt resistor R1. The reference voltage at the positive input terminal of the first comparator COMP1 is the first reference voltage Ucomp_1. The first comparator COMP1 compares the first reference voltage Ucomp_1 and the voltage U0, and outputs the first level signal PGA_IO1. The reference voltage at the positive input terminal of the second comparator COMP2 is the second reference voltage Ucomp_2. The second comparator COMP2 compares the second reference voltage Ucomp_2 and the voltage U0, and outputs the second level signal PGA_IO2. The reference voltage at the positive input terminal of the third comparator COMP3 is the third reference voltage Ucomp_3. The third comparator COMP3 compares the third reference voltage Ucomp_3 and the voltage U0, and outputs the third level signal PGA_IO3.
[0077] It should be noted that for the nth comparator (such as the first comparator COMP1, the second comparator COMP2, or the third comparator COMP3), if the input voltage signal U0 is greater than the reference voltage Ucomp_n of the comparator, the level signal PGA_IOn output by the comparator is at a low level (value 0). If the input voltage signal U0 is less than the reference voltage Ucomp_n of the comparator, the level signal PGA_IOn output by the comparator is at a high level (value 1). In some embodiments, if the reference voltage Ucomp_n at the positive input terminal of the comparator is equal to the voltage U0 at the negative input terminal, the level signal output by the comparator is at a high level. In another embodiment, if the reference voltage Ucomp_n at the positive input terminal of the comparator is equal to the voltage U0 at the negative input terminal, the comparator may also output a low level, and the embodiments of the present application do not limit this.
[0078] In some embodiments, the range control signal output by the comparison module 20 is equivalent to the combination of the first level signal PGA_IO1 output by the first comparator COMP1, the second level signal PGA_IO2 output by the second comparator COMP2, and the third level signal PGA_IO3 output by the third comparator COMP3. For example, assume that the first reference voltage Ucomp_1, the second reference voltage Ucomp_2, and the third reference voltage Ucomp_3 increase in sequence. The first level signal PGA_IO1, the second level signal PGA_IO2, and the third level signal PGA_IO3 have 4 combinations, that is, the range control signal has 4 values, which are specifically shown as follows:
[0079] (1) Combination 1: PGA_IO1 = 1, PGA_IO2 = 1, and PGA_IO3 = 1;
[0080] (2) Combination 2: PGA_IO1 = 0, PGA_IO2 = 1, and PGA_IO3 = 1;
[0081] (3) Combination 3: PGA_IO1 = 0, PGA_IO2 = 0, and PGA_IO3 = 1;
[0082] (4) Combination 4: PGA_IO1 = 0, PGA_IO2 = 0, and PGA_IO3 = 0.
[0083] It should be noted that 1 represents a high level and 0 represents a low level. Among them, a high level indicates that the voltage signal U0 is less than the reference voltage Ucomp_n, and a low level indicates that the voltage signal U0 is greater than or equal to the reference voltage Ucomp_n. Moreover, each combination of level signals corresponds to a current range, that is, corresponds to an amplification factor.
[0084] Similar to the above example, combination 1 indicates that the voltage signal U0 is less than the first reference voltage Ucomp_1, which is equivalent to U0 < Ucomp_1, U0 < Ucomp_2, and U0 < Ucomp_3. At this time, the amplification gain switching module 30 is in the first amplification factor, and the current sampling circuit enters the first range. For example, the first range can be 0 - 10 amperes (A), and the current amplification factor corresponding to the first range (i.e., the amplification factor of the amplification gain switching module 30) can be 4 times.
[0085] Combination 2 indicates that the voltage signal U0 is greater than or equal to the first reference voltage Ucomp_1 and less than the second reference voltage Ucomp_2. It is equivalent to U0 ≥ Ucomp_1, U0 < Ucomp_2, and U0 < Ucomp_3. At this time, the amplification gain switching module 30 is in the second amplification factor, and the current sampling circuit enters the second range. For example, the second range can be 10 - 20 A, and the current amplification factor corresponding to the second range can be 3 times.
[0086] Combination 3 indicates that the voltage signal U0 is greater than or equal to the second reference voltage Ucomp_2 and less than the third reference voltage Ucomp_3. It is equivalent to U0 ≥ Ucomp_1, U0 ≥ Ucomp_2, and U0 < Ucomp_3. For example, the third range can be 20 - 30 A, and the current amplification factor corresponding to the third range can be 2 times.
[0087] Combination 4 indicates that the voltage signal U0 is greater than or equal to the third reference voltage Ucomp_3. It is equivalent to U0 ≥ Ucomp_1, U0 ≥ Ucomp_2, and U0 ≥ Ucomp_3. For example, the fourth range can be 30 - 40 A, and the current amplification factor corresponding to the fourth range can be 1 time.
[0088] In some embodiments, the value of the reference voltage depends on the maximum current threshold of the pre-set current range. For example, the calculation formula for the reference voltage of the nth comparator is as shown in the following formula:
[0089] Ucomp_n = Imax_n × Rs × G i a, formula (1);
[0090] In the formula, Ucomp_n represents the reference voltage of the nth comparator; Imax_n represents the maximum current threshold of the nth current range; Rs represents the resistance value of the shunt resistor R1; G i a represents the gain multiple of the instrumentation amplifier IA1.
[0091] In some embodiments, the current sampling circuit further includes: a first voltage output module, a second voltage output module, and a third voltage output module (not shown in the figure);
[0092] The positive input terminal of the first comparator COMP1 is electrically connected to the first voltage output module; the positive input terminal of the second comparator COMP2 is electrically connected to the second voltage output module; the positive input terminal of the third comparator COMP3 is electrically connected to the third voltage output module;
[0093] The current acquisition module 10 is electrically connected to the negative input terminal of the first comparator COMP1, the negative input terminal of the second comparator COMP2, and the negative input terminal of the third comparator COMP3;
[0094] The first voltage output module is used to output a first reference voltage; the second voltage output module is used to output a second reference voltage; the third voltage output module is used to output a third reference voltage;
[0095] The first comparator COMP1 is used to compare the voltage signal with the first reference voltage and output a first level signal; the second comparator COMP2 is used to compare the voltage signal with the second reference voltage and output a second level signal; the third comparator COMP3 is used to compare the voltage signal with the third reference voltage and output a third level signal.
[0096] The advantage of this embodiment is that, through the first voltage output module, a first reference voltage is output to the positive input terminal of the first comparator COMP1, so that the first comparator COMP1 compares the first reference voltage with the first reference voltage and outputs a first level signal; the second voltage output module outputs a second reference voltage, so that the second comparator COMP2 compares the voltage signal with the second reference voltage and outputs a second level signal; the third voltage output module is used to output a third reference voltage, so that the third comparator COMP3 compares the voltage signal with the third reference voltage and outputs a third level signal. In this way, the voltage range to which the voltage signal belongs can be quickly determined by the above three comparators, and thus the amplification factor can be quickly switched according to the voltage range to which the voltage signal belongs.
[0097] Please refer to Figure 2 , in some embodiments, the amplification gain switching module 30 includes a programmable gain amplifier PGA1;
[0098] The programmable gain amplifier PGA1 is electrically connected to the output terminal of the first comparator COMP1, the output terminal of the second comparator COMP2, and the output terminal of the third comparator COMP3;
[0099] The programmable gain amplifier PGA1 is used to switch the amplification factor in response to the combination of the first level signal, the second level signal, and the third level signal.
[0100] The advantage of this embodiment is that after the first comparator COMP1, the second comparator COMP2, and the third comparator COMP3 timely output level signals (including the first level signal, the second level signal, and the third level signal) in response to current changes, the programmable gain amplifier PGA1 switches the amplification factor in response to the combination of the first level signal, the second level signal, and the third level signal, so that the current range can be switched more quickly, reducing the defect that the range switching lags behind the current change, thereby improving the accuracy of current sampling.
[0101] In some embodiments, as Figure 2 shown, the two voltage input terminals of the programmable gain amplifier PGA1 are respectively electrically connected to both ends of the shunt resistor R1, and the programmable gain amplifier PGA1 can obtain the voltage across the shunt resistor R1. Moreover, the control range input terminal of the programmable gain amplifier PGA1 has 3 pins, including pin B0, pin B1, and pin B2. Among them, pin B0 is used to connect to the first comparator COMP1, pin B1 is used to connect to the second comparator COMP2, and pin B2 is used to connect to the third comparator COMP3. The combination of the first level signal output by the first comparator COMP1, the second level signal output by the second comparator COMP2, and the third level signal output by the third comparator COMP3 is equivalent to the range control signal described above. The programmable gain amplifier PGA1 can switch the amplification factor of the programmable gain amplifier PGA1 in response to the range control signal.
[0102] Please refer to Figure 4 , in some embodiments, the current sampling circuit further includes: a voltage amplification module 40;
[0103] The voltage amplification module 40 is electrically connected between the current acquisition module 10 and the comparator;
[0104] The voltage amplification module 40 is used to amplify the voltage signal output by the current acquisition module 10.
[0105] The advantage of this embodiment is that through the voltage amplification module 40, the voltage signal collected by the current acquisition module 10 is amplified, so that the voltage magnitude of the voltage signal adapts to the input voltage requirement of the comparator, facilitating the comparator to compare the voltage signal with the reference voltage, and then quickly switching the amplification factor according to the comparison result to improve the accuracy of current sampling.
[0106] It should be noted that the voltage value of the voltage signal output by the current acquisition module 10 is relatively small. For example, the voltage signal output by the current acquisition module 10 can be 1.25 volts (V), 2.5V, 3V, etc., and usually does not meet the input voltage requirement of the comparator. Therefore, in the embodiments of the present application, the voltage signal output by the current acquisition module 10 is amplified by the voltage amplification module 40 to facilitate the subsequent comparison of the voltage signal by the comparator.
[0107] In some embodiments, as Figure 2 shown, the voltage amplification module 40 may include an instrumentation amplifier IA1. Two input terminals of the instrumentation amplifier IA1 are electrically connected to two ends of the shunt resistor R1 respectively, and the instrumentation amplifier IA1 is used to amplify the voltage across the shunt resistor R1.
[0108] Please refer to Figure 5 , in some embodiments, the current sampling circuit further includes: an analog-to-digital conversion module 50;
[0109] The analog-to-digital conversion module 50 is electrically connected to the amplification gain switching module 30;
[0110] The analog-to-digital conversion module 50 is used to convert the voltage analog signal output by the amplification gain switching module 30 into a voltage digital signal, so as to calculate the current value corresponding to the voltage digital signal.
[0111] The advantage of this embodiment is that the voltage analog signal output by the amplification gain switching module 30 is converted into a voltage digital signal by the analog-to-digital conversion module 50, so that the current value can be calculated according to the voltage digital signal subsequently, realizing accurate current sampling and improving the accuracy of current sampling.
[0112] In some embodiments, the analog-to-digital conversion module 50 refers to a circuit module for converting an analog signal into a digital signal. Specifically, the analog-to-digital conversion module 50 may include an analog-to-digital converter (ADC). As Figure 2 shown, the analog-to-digital conversion module 50 includes an analog-to-digital converter ADC1.
[0113] An embodiment of the present application further provides a current sampling device (not shown in the figure), and the current sampling device includes the above-mentioned current sampling circuit.
[0114] The specific implementation manner of this current sampling device is basically the same as that of the above-mentioned specific embodiment of the current sampling circuit, and will not be elaborated here.
[0115] Figure 6 is an optional flowchart of the current sampling method provided by an embodiment of the present application, and the current sampling method is applied to the above-mentioned current sampling circuit. Figure 6 The method in may include but is not limited to steps 101 to 105.
[0116] Step 101, obtaining an initial current signal through the current acquisition module 10, and performing signal conversion on the initial current signal to obtain an initial voltage signal;
[0117] Step 102: Compare the initial voltage signal with the target reference voltage of the comparison module 20 by the comparison module 20 to obtain a range control signal;
[0118] Step 103: In response to the range control signal, update the amplification factor of the amplification gain switching module 30 to obtain a target amplification factor;
[0119] Step 104: Amplify the initial voltage signal according to the target amplification factor by the amplification gain switching module 30 to obtain a target voltage signal;
[0120] Step 105: Calculate the current value of the target voltage signal to obtain a target current value.
[0121] The beneficial effects of the embodiments of the present application include but are not limited to: obtaining a current signal through the current acquisition module 10 and converting the current signal into a voltage signal for determining the amplification factor of the current. Then, compare the initial voltage signal with the target reference voltage of the comparison module 20 by the comparison module 20 to obtain a range control signal, and the amplification gain switching module 30 updates the amplification factor in response to the range control signal. It can be seen that when switching the amplification factor, the current sampling circuit does not rely on software algorithms, but directly generates a range control signal by means of voltage comparison through a hardware logic circuit (including a comparator and the amplification gain switching module 30, etc.) and switches the current range (equivalent to switching the amplification factor) based on the range control signal, without software processing, shortening the response time, significantly improving the switching speed of the current range, and reducing the defect that the range switching lags behind the current change. Amplify the initial voltage signal according to the updated amplification factor (i.e., the target amplification factor) by the amplification gain switching module 30 to obtain a target voltage signal, and then calculate the current value corresponding to the target voltage signal to obtain a target current value. In this way, the current value corresponding to the voltage signal can be accurately measured, enabling accurate measurement of currents of different magnitudes, thereby improving the accuracy of current sampling.
[0122] It should be noted that for the specific structure and function of the current sampling circuit applied to the current sampling method, reference may be made to the specific embodiments of the above current sampling circuit, which will not be elaborated here.
[0123] In step 101 of some embodiments, the initial current signal refers to the current signal acquired by the current acquisition module 10. The initial voltage signal is the voltage signal obtained after voltage conversion of the initial current signal. Specifically, the signal types of both the initial current signal and the initial voltage signal are analog signals.
[0124] In step 102 of some embodiments, the target reference voltage refers to the voltage at the positive input terminal of the comparator in the comparison module 20. Each comparator has a corresponding target reference voltage. It should be noted that any two of the multiple target reference voltages are different, so that the voltage range to which the initial voltage signal belongs can be quickly determined, and then the current range can be switched based on this. For example, the comparison module 20 includes a first comparator COMP1, a second comparator COMP2, and a third comparator COMP3. Among them, the target reference voltage corresponding to the first comparator COMP1 is the first reference voltage, the target reference voltage corresponding to the second comparator COMP2 is the second reference voltage, the target reference voltage corresponding to the third comparator COMP3 is the third reference voltage, and the first reference voltage, the second reference voltage, and the third reference voltage are all different.
[0125] In step 103 of some embodiments, the target amplification factor refers to the updated amplification factor of the amplification gain switching module 30.
[0126] In step 104 of some embodiments, the target voltage signal is K times the initial voltage signal, where K is the target amplification factor.
[0127] In step 105 of some embodiments, the current value can be calculated based on the target amplification factor, the resistance value of the current acquisition module 10, and the target voltage signal. When calculating the current value, a preset current calculation formula, such as Ohm's law, can be used. Other formulas can also be used for current value calculation, and the embodiments of the present application do not limit this.
[0128] Please refer to Figure 7 , in some embodiments, the comparison module 20 includes a first comparator COMP1 and a second comparator COMP2;
[0129] Step 102 may include but is not limited to steps 201 to 203:
[0130] Step 201, compare the initial voltage signal with the first reference voltage of the first comparator COMP1 through the first comparator COMP1 to obtain a first level signal;
[0131] Step 202, compare the initial voltage signal with the second reference voltage of the second comparator COMP2 through the second comparator COMP2 to obtain a second level signal; where the first reference voltage is different from the second reference voltage;
[0132] Step 203, determine the combination of the first level signal and the second level signal as the range control signal.
[0133] The advantage of this embodiment is that, through the first comparator COMP1 of the comparison module 20, the initial voltage signal is compared with the first reference voltage of the first comparator COMP1 to obtain a first level signal; through the second comparator COMP2, the initial voltage signal is compared with the second reference voltage of the second comparator COMP2 to obtain a second level signal, so that the voltage range to which the initial voltage signal belongs can be determined. Then, the combination of the first level signal and the second level signal is determined as the range control signal, so that the voltage range to which the initial voltage signal belongs can be accurately represented by the range control signal, and then the current range can be switched more accurately according to the range control signal, improving the accuracy of current sampling.
[0134] It should be noted that, regarding the functions of the first level signal and the second level signal, reference may be made to the specific embodiments of the above current sampling circuit, which will not be elaborated here.
[0135] In an application example, as Figure 8 shown, the current sampling method may specifically include the following steps: The shunt resistor R1 acquires a current signal and converts it into a voltage signal; the instrumentation amplifier IA1 amplifies the voltage signal; the comparator compares the voltage signal of the instrumentation amplifier IA1 with a preset reference voltage and outputs a level signal; the PGA (programmable gain amplifier) switches the amplification gain according to the level signal to achieve range switching of the circuit.
[0136] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above current sampling circuit is implemented.
[0137] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory may include a high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely provided with respect to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0138] It should be noted that the non-company software tools or components appearing in the embodiments of the present application are only introduced by way of example and do not represent actual use.
[0139] The embodiments described in the embodiments of the present application are to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation to the technical solutions provided by the embodiments of the present application. Those skilled in the art will know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0140] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation to the embodiments of the present application, and may include more or fewer steps than those shown in the figures, or combine certain steps, or different steps.
[0141] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0142] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, and their appropriate combinations.
[0143] The terms "first", "second", "third", "fourth", etc. (if any) in the description of the present application and the above drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products, or devices.
[0144] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects and indicates that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Here, A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one (one)" or a similar expression below refers to any combination of these items, including any combination of single item (one) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0145] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the above division of units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.
[0146] The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] In addition, in each embodiment of this application, the functional units can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0148] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes: various media that can store programs such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs.
[0149] The preferred embodiments of the embodiments of this application have been described above with reference to the accompanying drawings, and thus do not limit the scope of the rights of the embodiments of this application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of this application shall be within the scope of the rights of the embodiments of this application.
Claims
1. A current sampling circuit, characterized in that: The current sampling circuit comprises: A current acquisition module, a comparison module and an amplification gain switching module; wherein the comparison module includes a comparator; The current acquisition module is electrically connected to the comparator and the amplification gain switching module; the comparator is electrically connected to the amplification gain switching module; The current acquisition module is used to acquire the current signal and convert the current signal into a voltage signal; the comparator is used to compare the voltage signal with a preset reference voltage and output a range control signal according to the comparison result; the amplification gain switching module is used to switch the amplification factor in response to the range control signal; the amplification gain switching module is also used to amplify the voltage signal according to the amplification factor to calculate the current value corresponding to the voltage signal.
2. The current sampling circuit according to claim 1, characterized in that: The comparison module includes a first comparator, a second comparator and a third comparator; The current acquisition module is electrically connected to the input end of the first comparator, the input end of the second comparator, and the input end of the third comparator; The output end of the first comparator, the output end of the second comparator, and the output end of the third comparator are electrically connected to the amplification gain switching module.
3. The current sampling circuit according to claim 2, characterized in that: The current sampling circuit also includes: a first voltage output module, a second voltage output module, and a third voltage output module; The non-inverting input terminal of the first comparator is electrically connected to the first voltage output module; the non-inverting input terminal of the second comparator is electrically connected to the second voltage output module; the non-inverting input terminal of the third comparator is electrically connected to the third voltage output module; The current acquisition module is electrically connected to the negative phase input terminal of the first comparator, the negative phase input terminal of the second comparator, and the negative phase input terminal of the third comparator; The first voltage output module is used to output a first reference voltage; the second voltage output module is used to output a second reference voltage; the third voltage output module is used to output a third reference voltage; The first comparator is used to compare the voltage signal with the first reference voltage and output a first level signal; the second comparator is used to compare the voltage signal with the second reference voltage and output a second level signal; the third comparator is used to compare the voltage signal with the third reference voltage and output a third level signal.
4. The current sampling circuit according to claim 3, characterized in that: The amplification gain switching module includes a programmable gain amplifier; The programmable gain amplifier is electrically connected to the output end of the first comparator, the output end of the second comparator, and the output end of the third comparator; The programmable gain amplifier is used to switch the amplification factor in response to a combination of the first level signal, the second level signal and the third level signal.
5. The current sampling circuit according to any one of claims 1 to 4, characterized in that: The current sampling circuit also includes: a voltage amplification module; The voltage amplification module is electrically connected between the current acquisition module and the comparator; The voltage amplification module is used to amplify the voltage signal output by the current acquisition module.
6. The current sampling circuit according to any one of claims 1 to 4, characterized in that: The current sampling circuit also includes: an analog-to-digital conversion module; The analog-to-digital conversion module is electrically connected to the amplification gain switching module; The analog-to-digital conversion module is used to convert the voltage analog signal output by the amplification gain switching module into a voltage digital signal to calculate the current value corresponding to the voltage digital signal.
7. A current sampling device, characterized in that: The current sampling device comprises the current sampling circuit according to any one of claims 1 to 6.
8. A current sampling method, characterized in that: The method is applied to the current sampling circuit according to any one of claims 1 to 6, and the method comprises: Acquire an initial current signal through a current acquisition module, and perform signal conversion on the initial current signal to obtain an initial voltage signal; By means of a comparison module, the initial voltage signal is compared with a target reference voltage of the comparison module to obtain a range control signal; In response to the range control signal, the amplification factor of the amplification gain switching module is updated to obtain a target amplification factor; The initial voltage signal is amplified by the amplification gain switching module according to the target amplification factor to obtain a target voltage signal; A current value calculation is performed on the target voltage signal to obtain a target current value.
9. The current sampling method according to claim 8, characterized in that: The comparison module includes a first comparator and a second comparator; The comparison module compares the initial voltage signal with the target reference voltage of the comparison module to obtain a range control signal, including: By using the first comparator, the initial voltage signal is compared with a first reference voltage of the first comparator to obtain a first level signal; By using the second comparator, the initial voltage signal is compared with a second reference voltage of the second comparator to obtain a second level signal; wherein the first reference voltage is different from the second reference voltage; A combination of the first level signal and the second level signal is determined as the range control signal.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the current sampling method according to any one of claims 8 to 9 is implemented.
Citation Information
Patent Citations
Automatic range switching photoelectric signal amplification system, method and device
CN115561501A
Gain control circuit, method and vehicle
CN118677388A
Inductive current measuring circuit capable of automatically switching measuring range and current measuring method
CN119310332A
Current detection circuit
JP1999274930A