Segmented current sampling system and method
By designing a segmented current sampling system, using multi-speed selection switch and amplifier circuit technology, the problem of Hall sensor output voltage exceeding the sampling range of the DSP chip is solved, and the sampling accuracy is improved.
Patent Information
- Application Number
- CN202411481167.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-07
AI Technical Summary
The Hall sensor output voltage exceeds the DSP chip sampling range and the narrow sensor output voltage range cause the problem of low sampling accuracy.
Design a segmented current sampling system, including DSP chip, Hall current sensor, multi-speed selection switch, voltage stabilization circuit, subtraction circuit and amplifier circuit. The adjustment resistance is controlled by the multi-speed selection switch, so that the voltage stabilization circuit outputs a stable reference voltage, the subtraction circuit adjusts the sensor output voltage within the DSP chip sampling range, and amplifies the voltage signal through the amplifier circuit to improve sampling accuracy.
By dividing the wide range of input current into several segments and using the DSP chip to control the multi-speed selection switch and amplifier circuit to amplify the signal, the problem that the Hall sensor output voltage exceeds the DSP chip's sampling range is solved, and the sampling accuracy is improved.
Smart Images

Figure CN119395344A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic circuits, and in particular to a segmented current sampling system and method. Background Art
[0002] In the process of localization of weapons and equipment, it is difficult to select some components and it is difficult to select a current sensor with a suitable range. When the range of the selected current sensor is large, and the actual normal working current range of the equipment is narrow, the traditional method of directly sampling the output voltage value of the current sensor through the ADC of the DSP chip is difficult to obtain a high sampling accuracy. At the same time, the output voltage range of some sensors exceeds the working voltage of the ADC sampling IO port of the DSP chip, and there is a risk of burning the DSP chip when directly connected to the microcontroller.
[0003] For example, when the measured current exceeds 60A, the output voltage exceeds the maximum value of 3.3V of the input voltage of the analog-to-digital conversion interface of the DSP chip; the input voltage range of the ADC sampling interface is only 2.5V-3.3V, and the narrow range of voltage input leads to low sampling accuracy. If no software or hardware processing is done, in order to avoid damaging the DSP chip, the Hall current sensor can only measure the input current of 0A-60A. Therefore, the Hall sensor in the prior art can only output a narrow voltage range to avoid burning the DSP chip, which in turn affects the input and output characteristics of the sensor and causes low sampling accuracy. Summary of the invention
[0004] The present invention provides a segmented current sampling system and method, which solves the problem of low sampling accuracy caused by the output voltage of a Hall sensor exceeding the sampling range of a DSP chip and the narrow output voltage range of the sensor.
[0005] The technical solutions to the above problems are as follows: A segmented current sampling system includes a DSP chip, a Hall current sensor, and also includes: an adjustment resistor; A multi-position selection switch, wherein the multi-position selection switch is electrically connected to the DSP chip and the adjustment resistor respectively; A voltage stabilizing circuit is connected to the output end of the multi-speed selection switch. The multi-speed selection switch selects to connect adjustment resistors with different resistance values according to the control signal of the DSP chip, so that the voltage stabilizing circuit outputs a stable reference voltage; A subtraction circuit, the subtraction circuit is connected to the Hall current sensor and the voltage stabilization circuit respectively; The amplifier circuit has an input end electrically connected to the subtraction circuit, and an output end of the amplifier circuit is connected to the DSP chip. The subtraction circuit sends the difference between the output voltage of the Hall current sensor and the output voltage of the voltage stabilizing circuit to the amplifier circuit. The amplifier circuit amplifies the difference and then connects it to the DSP chip. The DSP chip calculates the current current value according to the voltage signal provided by the amplifier circuit.
[0006] A segmented current sampling method, using a segmented current sampling system, includes the following steps: Step 1: Set the gear position of the multi-position selector switch; Step 2: Calculate the current value Cur=A*ADC_Value + B; ADC_Value is the current DSP chip analog-to-digital converter sampling value, A and B are the current gear coefficient A and coefficient B; Step 3: Determine whether Cur is less than DOWN, where DOWN is the current gear downward threshold. If the result of step 3 is yes, the DSP chip controls the gear in the multi-gear selection switch to be lowered and returns to step 2; if the result of step 3 is no, go to step 4; Step 4: Determine whether Cur is greater than UP, where UP is the current gear upward threshold; if the result of step 4 is yes, the DSP chip controls the gear in the multi-gear selection switch to rise and returns to step 2; if the result of step 4 is no, go to step 5; Step 5: The calculated current value Cur is the current real current value.
[0007] The present invention divides a wide range of input current into several sections, uses a DSP chip to control a multi-position selection switch to access different adjustment resistors, so that the voltage stabilization circuit outputs different voltage values, and then uses a subtraction circuit to adjust the sensor output voltage within the sampling range of the DSP chip. At the same time, an amplifier circuit is used to amplify the voltage signal by 6 times, so that the voltage signal input to the DSP chip has a voltage range as wide as possible on the basis of the normal working range of the chip, thereby improving the sampling accuracy. The present invention can determine the gear position of the input current and calculate the input current according to the current gear position. The present invention solves the problem of low sampling accuracy caused by the Hall sensor output voltage exceeding the sampling range of the DSP chip and the narrow sensor output voltage range.
[0008] Economic effect: By adopting the solution of the present invention, the algorithm can be quickly transplanted in multiple different projects, and can be quickly deployed after appropriate adjustments are made to the large current sampling problem, saving project development time. At the same time, the use of proven mature technology can greatly improve the reliability of new projects, shorten the development cycle, and reduce R&D investment. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1The block diagram of the segmented current sampling system.
[0010] Figure 2 This is a schematic diagram of the segmented current sampling system working in gear 1.
[0011] Figure 3 This is a schematic diagram of the segmented current sampling system working in gear 2.
[0012] Figure 4 This is a schematic diagram of the segmented current sampling system working in gear 3.
[0013] Figure 5 This is a schematic diagram of the segmented current sampling system working in gear 4.
[0014] Figure 6 This is a schematic diagram of the segmented current sampling system working in gear 5.
[0015] Figure 7 This is the flow chart of the segmented current sampling algorithm.
[0016] Figure 8 It is the input-output characteristic curve of the sensor.
[0017] Fig. 9 Schematic diagram of segmented current sampling. DETAILED DESCRIPTION
[0018] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0019] like Figure 1 A segmented current sampling system of the present invention includes a DSP chip 1, an adjustment resistor 2, a multi-speed selection switch 3, a Hall current sensor 4, a voltage stabilizing circuit 5, a subtraction circuit 6, and an amplifier circuit 7. The multi-speed selection switch 3 is electrically connected to the DSP chip 1 and the adjustment resistor 2 respectively. In this embodiment, the multi-speed selection switch 3 preferably adopts an 8-to-1 analog switch.
[0020] The voltage stabilizing circuit 5 is connected to the output end of the multi-position selection switch 3. The multi-position selection switch 3 selects adjustment resistors with different resistance values according to the control signal of the DSP chip 1, so that the voltage stabilizing circuit 5 outputs a stable reference voltage.
[0021] The subtraction circuit 6 is connected to the Hall current sensor 4 and the voltage stabilizing circuit 5 respectively; the measuring range of the Hall current sensor 4 is -150A-150A, and the corresponding output voltage range is 0.5V-4.5V (13.3mV / A, -150A corresponds to 0.5V; 0A corresponds to 2.5V; 150A corresponds to 4.5V), and the voltage stabilizing circuit 5 preferably adopts a 431 parallel voltage stabilizing circuit.
[0022] The input end of the amplifier circuit 7 is electrically connected to the subtraction circuit 6, and the output end of the amplifier circuit 7 is connected to the DSP chip 1. The subtraction circuit 6 sends the difference between the output voltage of the Hall current sensor 4 and the output voltage of the voltage stabilizing circuit 5 to the amplifier circuit 7. The amplifier circuit 7 amplifies the difference (6 times) and then connects to the DSP chip 1. The DSP chip 1 calculates the current current value according to the voltage signal provided by the amplifier circuit 7.
[0023] In actual engineering applications, it is often necessary to measure only the forward current of the circuit. The actual range used is 0A-150A, and the output voltage range of the corresponding Hall current sensor is between 2.5V-4.5V. Figure 8 and Fig. 9 As shown in the figure, the current sampling range of the Hall current sensor is divided into 5 sections: 0-35A, 30A-65A, 60-95A, 90-125A, 120A-150A. There are two problems with this usage scenario: When the measured current exceeds 60A, the output voltage exceeds the maximum input voltage of the DSP chip analog-to-digital conversion interface, 3.3V; The input voltage range of the ADC sampling interface is only 2.5V-3.3V. The narrow range of voltage input results in low sampling accuracy.
[0024] If no software or hardware processing is done, in order to avoid damaging the DSP chip, the Hall current sensor 4 can only measure the input current of 0A-60A, and the sampling accuracy will be low due to the influence of the sensor input and output characteristics. Therefore, the present invention aims to improve the current sampling accuracy based on the improved current sampling circuit system and ensure that the sampling system has good linearity. Based on the above-mentioned segmented current sampling system, the present invention provides a segmented current sampling method, such as Figure 7 As shown, the method comprises the following steps: Step 1: Set the gear position of the multi-gear selection switch 3; in the present invention, the highest gear used by default at the beginning is gear 5.
[0025] Step 2: Calculate the current value Cur=A*ADC_Value + B; ADC_Value is the current analog-to-digital converter sampling value of DSP chip 1, the output range of the 12-bit analog-to-digital converter is 0-4096, and A and B are the current gear coefficient A and coefficient B.
[0026] Step 3: Determine whether Cur is less than DOWN, where DOWN is the current gear downward threshold, see Table 1. If the result of step 3 is yes, the DSP chip 1 controls the gear in the multi-gear selection switch 3 to decrease and returns to step 2; if the result of step 3 is no, go to step 4.
[0027] Step 4: Determine whether Cur is greater than UP, where UP is the current gear upward threshold, see Table 1; if the result of step 4 is yes, the DSP chip 1 controls the gear in the multi-gear selection switch 3 to rise and returns to step 2; if the judgment result of step 4 is no, go to step 5.
[0028] Table 1: Segmented current sampling system coefficients and thresholds
[0029] Note: Due to differences in hardware, coefficients A and B can be obtained through hardware physical debugging and calibration. Step 5: The calculated current value Cur is the current real current value.
[0030] In this embodiment, after the gear position is lowered in step 3 and after the gear position is raised in step 4, the ADC data is acquired after a delay, and then the process returns to step 2.
[0031] Application examples: Combination Figure 2 - Figure 6 and Fig. 9 The application of the segmented current sampling system in practical engineering is further described. The input current range of the Hall current sensor 4 is 0-150A, and the output voltage range is 2.5V-4.5V. The current sampling range is divided into 5 segments: 0-35A, 30A-65A, 60-95A, 90-125A, 120A-150A. Figure 4 Taking the input current of 60A-95A as an example, the output voltage range of the Hall current sensor 4 is 3.3V-3.764V. It can be seen that the output voltage has exceeded the normal working voltage of the DSP chip, and there is a risk of burning when directly connected to the DSP chip 1. This segmented current sampling system controls the multi-speed selection switch 3 through the DSP chip 1 to connect different adjustment resistors from the adjustment resistor 2, so that the output voltage of the voltage stabilizing circuit 5 is 3.3V, and then the output voltage is adjusted to 0V-0.464V through the subtraction circuit 6, and it is amplified to 0V-2.784V by the amplifier circuit 7, which not only ensures that the voltage input to the DSP chip is within the normal working range, but also ensures that the input voltage range is as wide as possible, thereby improving the sampling accuracy.
[0032] The segmented current sampling system can control the size of the adjustment resistor 2 through the multi-position selection switch 3, so that the adjustment resistor 2 provides different stable voltage reference sources according to different positions. The subtraction circuit 6 in the segmented current sampling system can calculate the voltage difference between the Hall current sensor 4 and the voltage stabilizing circuit 5, and adjust the output voltage of the Hall current sensor 4 to within the input voltage range of the DSP chip. The amplifier circuit 7 in the segmented current sampling system can amplify the difference between the Hall current sensor 4 and the voltage stabilizing circuit 5, so that the current sampling accuracy is higher. The segmented current sampling algorithm can determine the gear position of the input current and calculate the input current according to the current gear position.
[0033] The amplifier circuit in the segmented current sampling system can amplify the difference between the Hall current sensor 4 and the voltage stabilizing circuit 5, so as to make the current sampling more accurate; the input current gear is automatically determined according to the input current size, and the input current is calculated according to the current gear.
[0034] Finally, it should be noted that the above-described implementation mode is only a preferred embodiment of the present invention to illustrate the technical solution of the present invention, and does not limit it, let alone limit the protection scope of the present invention; although the invention is described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents; and these modifications or replacements do not make the essence of the corresponding technical solution deviate from the protection scope of the claims.
Claims
1. A segmented current sampling system, comprising a DSP chip (1) and a Hall current sensor (4), characterized in that: Also includes: adjusting resistance (2); A multi-position selection switch (3), the multi-position selection switch (3) being electrically connected to the DSP chip (1) and the adjustment resistor (2) respectively; A voltage stabilizing circuit (5), the voltage stabilizing circuit (5) being connected to the output end of the multi-position selection switch (3), the multi-position selection switch (3) selecting to connect adjustment resistors of different resistance values according to a control signal of the DSP chip (1), so that the voltage stabilizing circuit (5) outputs a stable reference voltage; A subtraction circuit (6), the subtraction circuit (6) is connected to the Hall current sensor (4) and the voltage stabilization circuit (5) respectively; The amplifier circuit (7) has an input end electrically connected to the subtraction circuit (6), and an output end of the amplifier circuit (7) is connected to the DSP chip (1). The subtraction circuit (6) sends the difference between the output voltage of the Hall current sensor (4) and the output voltage of the voltage stabilizing circuit (5) to the amplifier circuit (7). The amplifier circuit (7) amplifies the difference and then connects it to the DSP chip (1). The DSP chip (1) calculates the current current value according to the voltage signal provided by the amplifier circuit (7).
2. A segmented current sampling system according to claim 1, characterized in that: The input current range of the Hall current sensor is 0-150A and the output voltage range is 2.5V-4.5V.
3. A segmented current sampling system according to claim 2, characterized in that: The current sampling range of the Hall current sensor is divided into 5 sections: 0-35A, 30A-65A, 60-95A, 90-125A, 120A-150A.
4. A segmented current sampling method, characterized in that: The segmented current sampling system according to any one of claims 1 to 3 comprises the following steps: Step 1: Set the gear position of the multi-position selector switch (3); Step 2: Calculate the current value Cur=A*ADC_Value + B; Where ADC_Value is the current analog-to-digital converter sampling value of the DSP chip (1), A and B are the current gear coefficient A and coefficient B; Step 3: Determine whether Cur is less than DOWN, where DOWN is the downward threshold of the current gear position. If the result of step 3 is yes, the DSP chip (1) controls the gear position of the multi-gear selection switch (3) to be lowered and returns to step 2; if the result of step 3 is no, proceed to step 4; Step 4: Determine whether Cur is greater than UP, where UP is the current gear upward threshold; if the result of step 4 is yes, the DSP chip (1) controls the gear in the multi-gear selection switch (3) to rise and returns to step 2; if the result of step 4 is no, go to step 5; Step 5: The calculated current value Cur is the current real current value.
5. A segmented current sampling method according to claim 4, characterized in that: In step (3) after the gear position is lowered and in step (4) after the gear position is raised, the ADC data is acquired after a delay and then returns to step (2).