Sensor analog signal collection method, device and medium
By employing multi-phase excitation and orthogonal four-channel signal processing, combined with differential operations and phase compensation algorithms, the signal-to-noise ratio degradation problem of Hall sensors under strong electromagnetic interference environments was solved, achieving high-precision and stable signal measurement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-26
- Publication Date
- 2026-03-31
AI Technical Summary
Traditional Hall sensor measurement systems suffer from reduced signal-to-noise ratios in environments with strong electromagnetic interference, lack adaptive phase compensation capabilities, and struggle to guarantee long-term stability and high-precision measurements.
Employing multi-phase excitation current and orthogonal four-channel signal processing, M different phase excitation currents are provided through a constant current excitation source. Combined with signal conditioning circuits and a multi-channel AD sampling module, signal filtering, superposition, amplification, and differential operations are performed. Accurate signal reconstruction and interference suppression are achieved using fast Fourier transform and phase compensation algorithms.
It effectively eliminates common-mode interference and bias error, improves signal processing accuracy and anti-interference capability, and realizes stable measurement and high-precision signal recognition in complex electromagnetic environments.
Smart Images

Figure CN121027939B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of sensor acquisition technology, specifically to methods, equipment, and media for acquiring analog signals from sensors. Background Technology
[0002] Hall effect sensors, as magnetic field measurement devices based on the Hall effect, are widely used in motor control, position detection, current measurement, and other fields. Traditional Hall effect sensor measurement systems typically use a single excitation current to drive the Hall element, and then amplify and filter the Hall voltage signal through an analog signal conditioning circuit before finally converting it into a digital signal via an ADC for further processing. While this measurement method can achieve good accuracy under ideal conditions, it is susceptible to factors such as temperature drift, device nonlinearity, and electromagnetic interference in practical applications, leading to increased measurement errors.
[0003] However, existing technologies suffer from the following problems: First, single-phase excitation methods cannot effectively suppress common-mode interference and bias errors in the system, especially in environments with strong electromagnetic interference, where the signal-to-noise ratio decreases. Second, traditional analog signal processing methods lack adaptive compensation capabilities when facing device parameter drift and nonlinear errors, making it difficult to guarantee long-term stability. Third, existing phase correction methods mostly rely on fixed compensation parameters, which cannot be dynamically adjusted according to actual working conditions, limiting further improvements in measurement accuracy. These technical deficiencies severely affect the application performance of Hall sensors in high-precision measurement applications. Summary of the Invention
[0004] In view of the above-mentioned problems, the present invention is proposed.
[0005] Therefore, the technical problem solved by this invention is: how to effectively suppress common-mode interference and bias error, and have adaptive phase compensation capability, thereby improving the measurement accuracy and system stability of the sensor.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a sensor analog signal acquisition method, applied in a Hall sensor measurement circuit, wherein the Hall sensor measurement circuit includes a Hall sensor, a constant current excitation source, a signal conditioning circuit, and a multi-channel AD sampling module, comprising the following steps: providing an excitation current with M different phases to the Hall sensor through the constant current excitation source; the Hall sensor generating a Hall voltage signal under the action of the magnetic field to be measured and the excitation current; the signal conditioning circuit generating a reference voltage signal with the same frequency as the excitation current according to the phase information of the excitation current; the signal conditioning circuit filtering the Hall voltage signal to obtain a filtered Hall voltage signal; superimposing the filtered Hall voltage signal with the reference voltage signal to obtain a composite signal; amplifying the composite signal through an amplifier to obtain an amplified composite signal; and the multi-channel AD sampling module converting the amplified composite signal into a digital signal and calculating the amplitude value of the Hall voltage signal.
[0007] In a preferred embodiment of the sensor analog signal acquisition method of the present invention, the multi-channel AD sampling module includes a first acquisition channel, a second acquisition channel, a third acquisition channel, and a fourth acquisition channel; the digital signal is converted into four orthogonal signals, wherein the phase of the first signal is 0°, the phase of the second signal is 90°, the phase of the third signal is 180°, and the phase of the fourth signal is 270°; the first acquisition channel, the second acquisition channel, the third acquisition channel, and the fourth acquisition channel correspond one-to-one with the first signal, the second signal, the third signal, and the fourth signal, respectively.
[0008] The beneficial effects of this preferred technical solution are as follows: by converting the digital signal into four orthogonal signals with phases of 0°, 90°, 180°, and 270°, and corresponding to four independent acquisition channels, it is possible to achieve orthogonal demodulation of the signal and complete preservation of phase information. This design improves the accuracy of signal processing and anti-interference capability.
[0009] In a preferred embodiment of the sensor analog signal acquisition method of the present invention, the step of calculating the amplitude value of the Hall voltage signal includes: obtaining first differential data through differential operation based on the sampling data of the first acquisition channel and the third acquisition channel; obtaining second differential data through differential operation based on the sampling data of the second acquisition channel and the fourth acquisition channel; calculating the sum of squares of the first differential data and the second differential data; performing a square root operation on the sum of squares to obtain a composite amplitude value; performing phase compensation on the composite amplitude value based on the phase information of the excitation current, and outputting the phase-compensated composite amplitude value as the amplitude value of the Hall voltage signal.
[0010] The beneficial effects of this preferred technical solution are as follows: by combining the symmetrical channel differential operation with the vector synthesis method of square root, common-mode interference and system bias error are effectively eliminated. The differential operation of the first and third acquisition channels and the differential operation of the second and fourth acquisition channels can eliminate in-phase interference components, while the square root operation realizes the vector synthesis of orthogonal components and obtains accurate signal amplitude values.
[0011] As a preferred embodiment of the sensor analog signal acquisition method of the present invention, the calculation step of the first differential data includes: performing a differential operation on the sampled data of the first acquisition channel and the sampled data of the third acquisition channel to obtain the first intermediate data; performing amplitude normalization processing on the first intermediate data to obtain the first normalized data; extracting the amplitude value of the first signal through fast Fourier transform, and multiplying the first normalized data with the amplitude value of the first signal to obtain the first differential data;
[0012] The calculation steps for the second differential data include: performing a differential operation on the sampled data of the second acquisition channel and the sampled data of the fourth acquisition channel to obtain the second intermediate data; performing amplitude normalization processing on the second intermediate data to obtain the second normalized data; extracting the amplitude value of the second signal through a fast Fourier transform; and multiplying the second normalized data by the amplitude value of the second signal to obtain the second differential data.
[0013] The beneficial effects of this preferred technical solution are: it can accurately extract the amplitude information of specific frequency components, effectively suppress harmonic interference and noise effects, and achieve accurate signal reconstruction by multiplying the normalized data with the amplitude value extracted by FFT, thereby improving the signal recognition capability in complex electromagnetic environments.
[0014] In a preferred embodiment of the sensor analog signal acquisition method of the present invention, the phase compensation includes: calculating the actual average value of the first differential data over N consecutive sampling points, where N is less than M; determining the phase compensation angle based on the average value; and performing phase correction on the synthesized amplitude value according to the phase compensation angle.
[0015] In a preferred embodiment of the sensor analog signal acquisition method of the present invention, the step of determining the phase compensation angle includes: pre-setting a standard reference value; calculating the difference between the actual average value of the first differential data and the standard reference value, and using the difference as a deviation; establishing a phase compensation angle lookup table, wherein the lookup table is segmented according to the magnitude of the deviation; when the deviation is in a first interval, the phase compensation angle is 0-15°; when the deviation is in a second interval, the phase compensation angle is 16-30°; and calculating the phase compensation angle value in the first interval or the second interval using an interpolation algorithm.
[0016] The beneficial effects of this preferred technical solution are as follows: by calculating the actual average value of N consecutive sampling points and comparing it with the standard reference value, the phase deviation of the system can be detected in real time. The segmented mapping lookup table design combined with the interpolation algorithm realizes fast and accurate determination of the phase compensation angle, effectively eliminating phase errors caused by factors such as temperature drift and device aging.
[0017] In a preferred embodiment of the sensor analog signal acquisition method of the present invention, the step of phase correction of the synthesized amplitude value includes: using the phase compensation angle value obtained through the lookup table as the initial compensation angle; using the initial compensation angle to perform phase correction on the synthesized amplitude value to obtain the corrected synthesized amplitude value; calculating the error between the corrected synthesized amplitude value and the theoretical expected value; when the error is greater than a preset accuracy threshold, updating the initial compensation angle according to the gradient descent method; using the updated compensation angle to perform phase correction on the synthesized amplitude value again; until the error converges to within the preset accuracy threshold, outputting the final corrected synthesized amplitude value as the amplitude value of the Hall voltage signal.
[0018] In a preferred embodiment of the sensor analog signal acquisition method of the present invention, M is an integer not less than 4, and the phase interval of the M excitation currents with different phases is 360° / M.
[0019] The present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the sensor analog signal acquisition method.
[0020] The present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the steps of the sensor analog signal acquisition method.
[0021] The beneficial effects of this invention are:
[0022] By combining multi-phase excitation current with orthogonal four-channel signal processing, a signal quality improvement that traditional single excitation methods cannot achieve is realized. M excitation currents with different phases provide the Hall sensor with omnidirectional magnetic field excitation, while the 0°, 90°, 180°, and 270° phase distribution of the four orthogonal signals lays the foundation for complete signal reconstruction. This synergistic cooperation between excitation and acquisition enables the system to capture richer signal information.
[0023] The symmetrical differential operation of the first and third acquisition channels, as well as the second and fourth acquisition channels, effectively eliminates common-mode interference, while the vector synthesis of square roots and square roots further extracts the essential features of the signal. This combination of dual processing mechanisms not only eliminates bias errors that are difficult to suppress using traditional methods, but also achieves stable measurement in environments with strong electromagnetic interference, solving the problem of signal-to-noise ratio degradation under complex operating conditions in existing technologies.
[0024] By accurately extracting the amplitude values of specific frequency components using Fast Fourier Transform and combining this with normalization to eliminate the influence of amplitude variations, this combination of frequency domain and time domain processing produces unexpected results: the system can not only accurately identify useful signals, but also effectively suppress harmonic interference of various frequencies, achieving a qualitative improvement in signal purity.
[0025] The pre-defined lookup table provides rapid response capabilities, while the gradient descent algorithm ensures high-precision convergence at the end. This strategy, combining coarse and fine tuning, enables the system to adapt quickly to environmental changes while maintaining long-term measurement stability, completely solving the technical problem that traditional fixed compensation parameters cannot adapt to dynamic operating conditions. Attached Figure Description
[0026] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a general flowchart of a sensor analog signal acquisition method provided in one embodiment of the present invention.
[0028] Figure 2 This is a structural diagram of a sensor analog signal acquisition method provided in one embodiment of the present invention. Detailed Implementation
[0029] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0030] Example 1, referring to Figures 1-2 This is one embodiment of the present invention, which provides a sensor analog signal acquisition method applied in a Hall sensor measurement circuit. The Hall sensor measurement circuit includes a Hall sensor, a constant current excitation source, a signal conditioning circuit, and a multi-channel AD sampling module, and includes the following steps S1 to S6:
[0031] S1. The constant current excitation source provides the Hall sensor with an excitation current having M different phases;
[0032] Furthermore, M is an integer not less than 4, and the phase interval of the M excitation currents with different phases is 360° / M.
[0033] In this embodiment, the constant current excitation source uses a digital signal generator combined with a current control circuit to achieve multi-phase excitation. Specifically, M is set to 8, that is, eight different phase excitation currents are provided to the Hall sensor, with a phase interval of 360° / 8 = 45°, namely 0°, 45°, 90°, 135°, 180°, 225°, 270°, and 315°.
[0034] The constant current excitation source internally includes a digital signal generator and a constant current control module. The digital signal generator produces a reference sine wave signal with a frequency of 1kHz, which is then used by a phase modulator to generate the eight different phase sine wave voltage signals mentioned above. The constant current control module uses a voltage-controlled constant current source circuit composed of operational amplifiers and MOSFETs to convert the voltage signals of each phase into constant amplitude excitation currents for the corresponding phases. The amplitude of each excitation current is set to 1mA, and it is applied sequentially to the excitation terminals of the Hall sensor using a time-division multiplexing method.
[0035] In terms of timing control, a 125μs time window is used to sequentially switch the excitation current of each phase, meaning the excitation duration of each phase is 125μs, and a complete 8-phase excitation cycle takes 1ms. This time-division multiplexing excitation method not only ensures the independence of the excitation current of each phase but also provides a timing reference for subsequent signal synchronous acquisition and processing. Through this multi-phase excitation strategy, the Hall sensor can generate corresponding Hall voltage signals under different phase excitations, laying the foundation for system measurement.
[0036] S2. The Hall sensor generates a Hall voltage signal under the action of the magnetic field to be measured and the excitation current;
[0037] In this embodiment, the Hall sensor uses a linear Hall element made of GaAs material with a Hall coefficient of 85 cm³ / C. When eight different phase excitation currents (0°, 45°, 90°, 135°, 180°, 225°, 270°, 315°) supplied by a constant current excitation source flow sequentially through the Hall sensor, a corresponding Hall voltage signal is generated at the output terminal of the Hall sensor under the action of the measured magnetic field B = 50 mT. Since the Hall voltage VH = RH × I × B / d (where RH is the Hall coefficient, I is the excitation current, B is the magnetic induction intensity, and d is the thickness of the Hall element), different phase excitation currents will generate corresponding phase Hall voltage signals. Under a 1 mA excitation current, the amplitude of the Hall voltage signal is approximately 4.2 mV, and the frequency of each phase Hall voltage signal is the same as the frequency of the excitation current, which is 1 kHz.
[0038] S3. The signal conditioning circuit generates a reference voltage signal with the same frequency as the excitation current based on the phase information of the excitation current.
[0039] The reference signal generation module in the signal conditioning circuit receives a phase synchronization signal from the constant current excitation source and acquires the phase information of the current excitation current in real time. The reference signal generation module uses digital phase-locked loop (DPLL) technology to generate a reference voltage signal with the same frequency and phase as the excitation current, based on the phase information of the excitation current. Specifically, when the phase of the excitation current is θ, the reference voltage signal V... ref =A ref ×sin(2πft+θ), where A ref The reference voltage amplitude is set to 2V, f is the frequency of 1kHz, and t is the time variable. The reference signal generation module also includes 8 independent reference signal outputs, each corresponding to an excitation current of 8 different phases, ensuring that the reference voltage signal and the Hall voltage signal are strictly synchronized.
[0040] S4. The signal conditioning circuit filters the Hall voltage signal to obtain a filtered Hall voltage signal.
[0041] The filtering module in the signal conditioning circuit employs a fourth-order Butterworth low-pass filter with a cutoff frequency set to 3kHz to filter out high-frequency noise and interference in the Hall voltage signal. The filter uses a Sallen-Key topology constructed from operational amplifiers OP07, exhibiting a flat passband and a steep roll-off characteristic. After filtering, high-frequency interference components in the Hall voltage signal are effectively suppressed, improving signal purity. Simultaneously, the filter also includes a power frequency notch filter with a center frequency of 50Hz to suppress power frequency interference. The filtered Hall voltage signal retains its original amplitude and phase information, while the noise level is reduced to less than one-tenth of its original value.
[0042] S5. The filtered Hall voltage signal is superimposed with the reference voltage signal to obtain a composite signal, and the composite signal is amplified by an amplifier to obtain an amplified composite signal.
[0043] The signal superposition module employs a precision adder circuit to superimpose the filtered Hall voltage signal with a reference voltage signal of the corresponding phase. The adder is implemented using an AD620 instrumentation amplifier, which features high input impedance and low noise characteristics. The resulting composite signal V is obtained after superposition. comp =VH+V ref This composite signal contains valid information about the Hall voltage signal and a phase reference for the reference voltage signal. The composite signal is then amplified by a programmable gain amplifier (PGA206) with a gain set to 100. The amplifier features low noise, low offset, and high linearity, ensuring that no additional distortion is introduced during amplification. The amplified composite signal reaches an amplitude of 420mV (Hall voltage component) plus 200V (reference voltage component), providing a suitable signal amplitude range for subsequent AD sampling.
[0044] S6. The multi-channel AD sampling module converts the amplified composite signal into a digital signal and calculates the amplitude value of the Hall voltage signal.
[0045] It should also be noted that the multi-channel AD sampling module includes a first acquisition channel, a second acquisition channel, a third acquisition channel, and a fourth acquisition channel; the digital signal is converted into four orthogonal signals, wherein the phase of the first signal is 0°, the phase of the second signal is 90°, the phase of the third signal is 180°, and the phase of the fourth signal is 270°; the first acquisition channel, the second acquisition channel, the third acquisition channel, and the fourth acquisition channel correspond one-to-one with the first signal, the second signal, the third signal, and the fourth signal, respectively.
[0046] In this embodiment of the application, the step of calculating the amplitude value of the Hall voltage signal includes A1 to A5:
[0047] A1. Based on the sampling data from the first acquisition channel and the third acquisition channel, the first differential data is obtained through differential operation;
[0048] The calculation steps for the first difference data include A1.1 to A1.3:
[0049] A1.1 Perform a difference operation between the sampled data from the first acquisition channel and the sampled data from the third acquisition channel to obtain the first intermediate data;
[0050] The first acquisition channel acquires a digital signal sequence with a phase of 0°, with a data length of 1024 sampling points, denoted as Ch1[n], where n = 0, 1, 2, ..., 1023. The third acquisition channel acquires a digital signal sequence Ch3[n] with a phase of 180°. Differential operation is performed by the arithmetic logic unit inside the DSP: the first intermediate data Diff1[n] = Ch1[n] - Ch3[n]. Since the 0° and 180° signals differ in phase by 180°, differential operation can effectively eliminate the common-mode components in the two signals, retaining the useful differential-mode signal components. After differential operation, the amplitude of the first intermediate data is approximately twice the amplitude of the original signal.
[0051] A1.2. Perform amplitude normalization on the first intermediate data to obtain the first normalized data;
[0052] Amplitude normalization is achieved by calculating the effective value (RMS) of the first intermediate data. The DSP first calculates the sum of squares of the first intermediate data Diff1[n] sequence: Then calculate the root mean square value. The normalization factor is set as the ratio of the target amplitude to the first effective value RMS1, and the target amplitude is set to 1000 (the numerical value corresponding to the full scale).
[0053] The first normalized data Norm1[n] = Diff1[n] × (1000 / RMS1) makes the amplitude of the normalized data uniform within the preset range, eliminating the influence of signal amplitude changes under different measurement conditions on subsequent processing.
[0054] A1.3 Extract the amplitude value of the first signal through Fast Fourier Transform, and multiply the first normalized data with the amplitude value of the first signal to obtain the first differential data;
[0055] The DSP's built-in FFT accelerator performs a 1024-point Fast Fourier Transform on the first normalized data. Since the signal frequency is 1kHz and the sampling frequency is 100kSPS, the amplitude of the 10th frequency point (corresponding to 1kHz) in the FFT result is the amplitude value Amp1 of the first signal. The extraction process is achieved by calculating the magnitudes of the real and imaginary parts at this frequency point. Where Real is the real part and Imag is the imaginary part. The first difference data is obtained by point-by-point multiplication: FinalDiff1[n] = Norm1[n] × Amp1. This step rescales the normalized data to the true signal amplitude, resulting in the first difference data after differential processing and amplitude correction.
[0056] A2. Based on the sampling data from the second acquisition channel and the fourth acquisition channel, the second differential data is obtained through differential operation;
[0057] The calculation steps for the second difference data include A2.1 to A2.3:
[0058] A2.1 Perform a difference operation between the sampled data from the second acquisition channel and the sampled data from the fourth acquisition channel to obtain the second intermediate data;
[0059] A2.2 Perform amplitude normalization on the second intermediate data to obtain the second normalized data;
[0060] A2.3 Extract the amplitude value of the second signal through Fast Fourier Transform, and multiply the second normalized data with the amplitude value of the second signal to obtain the second differential data.
[0061] The calculation process for the second differential data is similar to that for the first differential data. The second and fourth acquisition channels correspond to 90° and 270° phase signals, respectively. The second intermediate data is Diff2[n] = Ch2[n] - Ch4[n], where Ch2[n] and Ch4[n] are the data from the second and fourth acquisition channels, respectively. Normalization is performed to calculate the second channel's effective value RMS2, resulting in the second normalized data Norm2[n] = Diff2[n] × (1000 / RMS2). An FFT transform extracts the second channel's signal amplitude value Amp2, ultimately yielding the second differential data FinalDiff2[n] = Norm2[n] × Amp2. Due to the orthogonality of the 90° and 270° signals, the second differential data differs from the first differential data by 90° in phase, providing orthogonal components for subsequent vector synthesis.
[0062] A3. Calculate the sum of squares of the first difference data and the second difference data;
[0063] The sum of squares is calculated by simultaneously squaring and accumulating the two data streams using the parallel processing unit of the DSP. For each sample point n, the sum of squares is calculated as: SquareSum[n] = (FinalDiff1[n]) 2 +(FinalDiff2[n]) 2This operation completes the first step of vector synthesis of two orthogonal components, laying the foundation for obtaining the final synthesized amplitude value. The entire A3 step takes approximately 50 μs to execute, providing sufficient computational speed for real-time signal processing.
[0064] A4. Perform a square root operation on the sum of squares to obtain the composite amplitude value;
[0065] The square root operation of the sum of squares SquareSum[n] is performed using the DSP's built-in floating-point unit. For each sampling point n, the synthesized amplitude value is calculated: This operation achieves vector synthesis of two orthogonal components, and the resulting synthesized amplitude value reflects the true amplitude of the Hall voltage signal. Since the first differential data FinalDiff1[n] and the second differential data FinalDiff2[n] represent differential components of 0°-180° and 90°-270° respectively, the vector synthesis result eliminates phase dependence and obtains pure amplitude information independent of phase. After square root operation, the numerical range of the synthesized amplitude value is approximately 800-1200, providing a stable input reference for subsequent phase compensation processing.
[0066] A5. Perform phase compensation on the synthesized amplitude value based on the phase information of the excitation current, and output the phase-compensated synthesized amplitude value as the amplitude value of the Hall voltage signal.
[0067] The step of performing phase compensation on the synthesized amplitude value includes A5.1 to A5.3:
[0068] A5.1 Calculate the actual average value of the first difference data over N consecutive sampling points, where N is less than M;
[0069] The selection of N consecutive sampling points is based on the sliding window method, where N is set to 6 (less than M = 8). The DSP sequentially selects 6 consecutive sampling points from FinalDiff1[n] to FinalDiff1[n+5] according to the timing sequence to calculate the average value. The formula for calculating the actual average value is:
[0070]
[0071] Where i = 0, 1, 2, 3, 4, 5. Six sampling points were chosen because they satisfy the constraint that N is less than M, and also allow for sufficient statistical samples to be obtained within a single excitation phase period. The sliding window moves two sampling points at a time to ensure the continuity and real-time nature of the average value calculation. The calculated actual average value AvgDiff1 is 847, representing the steady-state characteristics of the first differential data under the current excitation phase.
[0072] A5.2 Determine the phase compensation angle based on the average value;
[0073] The steps for determining the phase compensation angle include A5.21 to A5.26:
[0074] A5.21. Pre-set standard reference values;
[0075] The standard reference value is determined during the system calibration phase. Under a standard environment of 25°C and no external electromagnetic interference, the system is calibrated using a standard magnetic field source with an accuracy of ±0.1mT. The theoretical average value of the first differential data is recorded for eight different excitation phases, and this average value is taken as the standard reference value RefValue = 820. This value is stored in the DSP's EEPROM as a fixed benchmark for phase compensation calculations. The standard reference value takes into account the linear characteristics of the Hall sensor and the gain characteristics of the signal conditioning circuit, and is recalibrated every 1000 hours of operation.
[0076] A5.22. Calculate the difference between the actual average value of the first difference data and the standard reference value, and use the difference as the deviation.
[0077] The deviation is calculated using the DSP's arithmetic logic unit: Deviation = AvgDiff1 - RefValue = 847 - 820 = 27. The sign of the deviation indicates the direction of the phase shift: a positive value indicates that the actual measured value leads the standard value, corresponding to a positive phase shift; a negative value indicates that the actual measured value lags the standard value, corresponding to a negative phase shift. The absolute value of the deviation, |Deviation| = 27, directly reflects the current phase deviation of the system, providing quantized input for subsequent lookup table mapping.
[0078] A5.23. Establish a phase compensation angle lookup table, wherein the lookup table is segmented and mapped according to the magnitude of the deviation;
[0079] The phase compensation angle lookup table adopts an 8-segment linear mapping structure and is stored in the DSP's lookup table storage area. The table is divided according to the absolute value of the deviation: interval 1 (|deviation| 0-20) corresponds to a compensation angle of 0-15°; interval 2 (|deviation| 20-40) corresponds to a compensation angle of 16-30°; interval 3 (|deviation| 40-60) corresponds to a compensation angle of 31-45°; interval 4 (|deviation| 60-80) corresponds to a compensation angle of 46-60°; and so on. A linear relationship is used within each interval to ensure the continuity of the compensation angle. The lookup table is established based on regression analysis of a large amount of experimental data to ensure the consistency of the compensation effect under different operating conditions.
[0080] A5.24. When the deviation is within the first interval, the phase compensation angle is 0-15°;
[0081] A5.25. When the deviation is in the second interval, the phase compensation angle is 16-30°.
[0082] When the absolute value of the deviation, |Deviation| = 27, is in interval 2 (20-40), the corresponding phase compensation angle range is 16-30°. Since the deviation, |Deviation| = 27 > 0, it is determined to be positive compensation.
[0083] A5.26. Calculate the phase compensation angle value in the first interval or the second interval using an interpolation algorithm.
[0084] The interpolation algorithm uses linear interpolation to calculate the accurate phase compensation angle value within interval 2. The interpolation formula is:
[0085]
[0086] Since the original deviation is positive, the final phase compensation angle is +20.25°, indicating a positive phase correction to the synthesized amplitude value. Linear interpolation ensures a smooth change in the compensation angle with the deviation, avoiding compensation discontinuities caused by piecewise jumps.
[0087] A5.3. Perform phase correction on the synthesized amplitude value according to the phase compensation angle.
[0088] The step of phase correction for the synthesized amplitude value includes A5.31 to A5.36:
[0089] A5.31. The phase compensation angle value obtained through the lookup table is used as the initial compensation angle;
[0090] The phase compensation angle PhaseComp = +20.25°, obtained through lookup table and interpolation algorithm, is set as the initial compensation angle θ0. The DSP stores this value in the phase compensation register as the starting value for the iterative optimization algorithm. The initial compensation angle θ0 = +20.25° provides an initial value close to the optimal solution, reducing the number of iterations of the subsequent gradient descent algorithm and improving the system's response speed.
[0091] A5.32. Use the initial compensation angle to perform phase correction on the synthesized amplitude value to obtain the corrected synthesized amplitude value;
[0092] Phase correction of the synthesized amplitude value is performed using an initial compensation angle, employing a mathematical method involving complex rotation. The synthesized amplitude value CompAmp[n] is first converted to complex form: Z = CompAmp[n] + j × ImagComp[n], where ImagComp[n] is the imaginary component, generated from the real component through a Hilbert transform. The phase correction is then performed using complex multiplication to obtain the corrected complex number: Zcorrected =Z×e jθ = Z×(cos(θ)+j sin(θ)). The corrected composite amplitude value is: Where Z is a complex number, J(θ) is the cost function, j is the imaginary unit, and Real corrected To correct the real part, Imag corrected This is the corrected imaginary part.
[0093] In this embodiment, the original synthesized amplitude value is 1000. After a +20.25° phase correction, CorrectedAmp[n] = 1035 is obtained.
[0094] A5.33. Calculate the error between the corrected synthesized amplitude value and the theoretical expected value;
[0095] The theoretical expected value, ExpectedAmp, is calculated using a system theoretical model. Based on the Hall effect formula VH = RH × I × B / d, and given the excitation current I = 1 mA, magnetic flux density B = 50 mT, and Hall coefficient RH = 85 cm⁻¹,... 3 Under the condition of / C, the theoretical expected value ExpectedAmp = 1050 is calculated. The error is calculated using the relative error formula: Error = |CorrectedAmp[n] - ExpectedAmp| / ExpectedAmp × 100% = |1035 - 1050| / 1050 × 100% = 1.43%. This error value reflects the degree of deviation between the correction result and the theoretical value under the current compensation angle.
[0096] A5.34. When the error is greater than the preset accuracy threshold, the initial compensation angle is updated according to the gradient descent method.
[0097] The preset accuracy threshold is set to ε. threshold =0.5%, used to determine whether the compensation accuracy meets the requirements. The current error Error = 1.43% > εthreshold, triggering the gradient descent optimization algorithm. The gradient descent method uses the cost function J(θ) = (CorrectedAmp(θ) - ExpectedAmp). 2 The gradient is calculated using numerical differentiation:
[0098]
[0099] The differential step size Δθ = 0.1°. The gradient value is then calculated. The learning rate is set to α = 0.1. The angle update formula is:
[0100] A5.35. Re-correct the phase of the synthesized amplitude value using the updated compensation angle;
[0101] Phase correction is performed again using the updated compensation angle θ1 = 20.335°. The correction process is the same as step A5.32, but a new compensation angle is used:
[0102]
[0103] The new corrected synthesis amplitude value CorrectedAmp1[n] = 1042 is obtained. The error is recalculated: Error1 = |1042 - 1050| / 1050 × 100% = 0.76%. Since Error1 = 0.76% > εthreshold = 0.5%, the next iteration continues.
[0104] A5.36. Until the error converges to within the preset accuracy threshold, output the final corrected synthesized amplitude value as the amplitude value of the Hall voltage signal.
[0105] The iterative process continues until the error converges. The second iteration calculates the gradient. The updated angle θ2 = 20.335° - 0.1 × (-0.42) = 20.377° yields CorrectedAmp2[n] = 1047, with an error of Error2 = 0.29%. Since Error2 = 0.29% < εthreshold = 0.5%, the convergence condition is met, and the iteration ends. The final output corrected synthesized amplitude value is CorrectedAmp2[n] = 1047, and the corresponding Hall voltage signal amplitude value is VH. final = 4.47mV. The entire iteration process took approximately 150μs, meeting real-time processing requirements. After the iteration converged, the final compensation angle θ was calculated. final =20.377° is stored as the initial value preset for the next cycle, and finally the amplitude value of the Hall voltage signal is output.
[0106] Example 2: This example provides an electronic device applicable to a sensor analog signal acquisition method, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the sensor analog signal acquisition method proposed in the above example.
[0107] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a sensor analog signal acquisition method as described in the above embodiments.
[0108] The storage medium proposed in this embodiment belongs to the same inventive concept as the sensor analog signal acquisition method proposed in the above embodiments. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0109] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0110] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A sensor analog signal acquisition method applied to a Hall sensor measurement circuit, the Hall sensor measurement circuit comprising a Hall sensor, a constant current excitation source, a signal conditioning circuit, and a multi-channel AD sampling module, characterized in that, The method comprises the following steps: Providing an excitation current with M different phases to the Hall sensor through the constant current excitation source; The Hall sensor generates a Hall voltage signal under the action of the magnetic field to be measured and the excitation current; The signal conditioning circuit generates a reference voltage signal with the same frequency as the excitation current according to the phase information of the excitation current; The signal conditioning circuit filters the Hall voltage signal to obtain a filtered Hall voltage signal; The filtered Hall voltage signal and the reference voltage signal are superimposed to obtain a composite signal, and the composite signal is amplified by an amplifier to obtain an amplified composite signal; The multi-channel AD sampling module converts the amplified composite signal into a digital signal and calculates the amplitude value of the Hall voltage signal; The multi-channel AD sampling module comprises a first acquisition channel, a second acquisition channel, a third acquisition channel and a fourth acquisition channel; The digital signal is converted into a quadrature four-channel signal, wherein the phase of the first channel signal is 0°, the phase of the second channel signal is 90°, the phase of the third channel signal is 180°, and the phase of the fourth channel signal is 270°; The first acquisition channel, the second acquisition channel, the third acquisition channel and the fourth acquisition channel correspond to the first channel signal, the second channel signal, the third channel signal and the fourth channel signal respectively; The amplitude value of the Hall voltage signal is calculated by: According to the sampling data of the first acquisition channel and the third acquisition channel, the first difference data is obtained by difference operation; According to the sampling data of the second acquisition channel and the fourth acquisition channel, the second difference data is obtained by difference operation; The square sum of the first difference data and the second difference data is calculated; The square root of the square sum is calculated to obtain the synthesized amplitude value; According to the phase information of the excitation current, the synthesized amplitude value is phase compensated, and the phase compensated synthesized amplitude value is output as the amplitude value of the Hall voltage signal.
2. The sensor analog signal acquisition method of claim 1, wherein, The calculation step of the first difference data comprises: The sampling data of the first acquisition channel and the sampling data of the third acquisition channel are subjected to difference operation to obtain first intermediate data; The first intermediate data is subjected to amplitude normalization processing to obtain first normalized data; The amplitude value of the first channel signal is extracted by fast Fourier transform, and the first normalized data is multiplied by the amplitude value of the first channel signal to obtain the first difference data; The calculation step of the second difference data comprises: The sampling data of the second acquisition channel and the sampling data of the fourth acquisition channel are subjected to difference operation to obtain second intermediate data; The second intermediate data is subjected to amplitude normalization processing to obtain second normalized data; The amplitude value of the second channel signal is extracted by fast Fourier transform, and the second normalized data is multiplied by the amplitude value of the second channel signal to obtain the second difference data.
3. The sensor analog signal acquisition method of claim 2, wherein, The phase compensation step of the synthesized amplitude value comprises: The actual average value of the first difference data at consecutive N sampling points is calculated, wherein N is less than M; According to the average value, the phase compensation angle is judged; The phase compensation angle is used to correct the phase of the combined amplitude value.
4. The sensor analog signal acquisition method of claim 3, wherein, The phase compensation angle is determined by the following steps: A standard reference value is set in advance; A difference between the actual average value of the first difference data and the standard reference value is calculated, and the difference is used as a deviation amount; A phase compensation angle lookup table is established, and the lookup table is segmented and mapped according to the size of the deviation amount; When the deviation amount is in a first interval, the phase compensation angle is 0-15°; When the deviation amount is in a second interval, the phase compensation angle is 16-30°; The phase compensation angle value is calculated in the first interval or the second interval by an interpolation algorithm.
5. The sensor analog signal acquisition method of claim 4, wherein, The phase compensation angle value obtained by the lookup table is used as an initial compensation angle, and the combined amplitude value is corrected in phase by using the initial compensation angle to obtain a corrected combined amplitude value. An error between the corrected combined amplitude value and a theoretical expected value is calculated. When the error is greater than a preset precision threshold, the initial compensation angle is updated according to a gradient descent method. The combined amplitude value is corrected in phase again by using the updated compensation angle. Until the error converges to within the preset precision threshold, the final corrected combined amplitude value is output as the amplitude value of the Hall voltage signal. The M is an integer not less than 4, and the phase interval of the M different phase excitation currents is 360° / M. The processor executes the computer program to implement the steps of the sensor analog signal acquisition method in any one of claims 1 to 6.
6. The sensor analog signal acquisition method of claim 5, wherein, The computer program is executed by the processor to implement the steps of the sensor analog signal acquisition method in any one of claims 1 to 6. 7.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. 8. A computer readable storage medium having stored thereon a computer program, characterized in that,
Citation Information
Patent Citations
Compensation circuit for measuring AC voltages that are subject to interference
DE1208401A
Method for Offset Compensation of a Sensor Signal of a Hall Sensor and Sensor Arrangement
US20180172779A1