Temperature drift compensation method, device and equipment for Hall current sensor
The temperature drift compensation system uses a temperature sensor and a microprocessor to calculate temperature drift error parameters and generate a counter-compensation signal to resolve errors caused by temperature changes in the Hall current sensor, thereby achieving accurate current measurement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-17
AI Technical Summary
The temperature drift phenomenon caused by changes in ambient temperature introduces a non-linear measurement error into Hall current sensors, which is not negligible and affects measurement accuracy.
The temperature drift compensation system uses a temperature sensor to acquire ambient temperature data. The microprocessor combines the temperature drift prediction model to calculate the temperature drift error parameters, generates a compensation signal that is equal in magnitude and opposite in direction to the error, and superimposes it through a differential amplifier circuit to cancel out the temperature drift error.
It effectively eliminates temperature drift interference, improves the detection accuracy of Hall current sensors, ensures that the output signal accurately reflects the true magnitude of the measured current, and meets the accuracy requirements of industrial control and power monitoring.
Smart Images

Figure CN121679449A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Hall sensor, and in particular to a temperature drift compensation method, device and equipment of Hall current sensor. BACKGROUND
[0002] In the field of direct current measurement, Hall current sensor has become the core device for current detection in industrial automation control, new energy storage system (such as charging pile, energy storage power station), power electronic equipment and other scenes due to its outstanding advantages of non-contact measurement, fast response speed, strong anti-electromagnetic interference ability, etc., and widely supports high-precision direct current measurement and control requirements.
[0003] However, the core sensitive element (Hall element) of the Hall current sensor and the semiconductor material used in the supporting signal processing circuit have strong sensitivity to environmental temperature changes in their electrical characteristics. In the actual operation process, when the environmental temperature fluctuates, the Hall coefficient of the Hall element, the overall sensitivity of the sensor and other key test parameters will change significantly with the temperature drift, simply referred to as "temperature drift". This temperature drift phenomenon will break the preset correspondence between the sensor output signal and the actual measured current value, and introduce a non-negligible non-linear measurement error. SUMMARY
[0004] The present application provides a temperature drift compensation method, device and equipment of Hall current sensor to solve the problem of inaccurate measurement of Hall current sensor caused by temperature drift.
[0005] In the first aspect, the present application provides a temperature drift compensation method of Hall current sensor, applied to a temperature drift compensation system, the temperature drift compensation system comprising a temperature sensor, a microprocessor, a temperature drift prediction model, a compensation signal generation module and a differential amplification circuit. The temperature drift compensation method comprises: obtaining the environmental temperature data of the Hall current sensor by using the temperature sensor; calculating the temperature drift error parameter corresponding to the current environmental temperature data based on the environmental temperature data and the temperature drift prediction model by the microprocessor; generating the corresponding compensation signal based on the temperature drift error parameter by the compensation signal generation module, the compensation signal being equal in size and opposite in direction to the temperature drift error represented by the temperature drift error parameter; and superimposing the compensation signal and the original sampling signal of the Hall current sensor by the differential amplification circuit to obtain the final current signal.
[0006] In one possible implementation, the temperature drift prediction model includes several prediction sub-models, each corresponding to a preset temperature range interval. The temperature range interval is divided according to the characteristics of temperature drift in different temperature segments. The microprocessor calculates the temperature drift error parameter corresponding to the current ambient temperature data based on the ambient temperature data and the temperature drift prediction model. This includes: determining the temperature range interval corresponding to the current ambient temperature based on the ambient temperature data and the preset temperature range interval; calculating the theoretical temperature drift error value based on the ambient temperature data and the prediction sub-model corresponding to the temperature range interval; calculating the real-time temperature drift error value based on the current original output voltage of the Hall current sensor and the theoretical output voltage corresponding to the current actual current; and calculating the temperature drift error parameter by weighted summation of the theoretical temperature drift error value and the real-time temperature drift error value.
[0007] In one possible implementation, the theoretical temperature drift error value and the real-time temperature drift error value are weighted and summed to calculate the temperature drift error parameter, including: calculating the rate of change of the ambient temperature based on the ambient temperature acquired in real time from the Hall current sensor; calculating the rate of change of the input current of the Hall current sensor based on the input current acquired in real time; if the rate of change of the ambient temperature is less than a preset temperature change rate threshold, and the rate of change of the input current of the Hall current sensor is less than a preset current change rate threshold, the weight of the theoretical temperature drift error value is a first preset theoretical weight, and the weight of the real-time temperature drift error value is a first preset real-time weight; if the rate of change of the ambient temperature is greater than or equal to the preset temperature change rate threshold, or the rate of change of the input current of the Hall current sensor is greater than or equal to the preset current change rate threshold, the weight of the theoretical temperature drift error value is a second preset theoretical weight, and the weight of the real-time temperature drift error value is a second preset real-time weight, wherein the first preset theoretical weight is greater than the second preset theoretical weight, and the first preset real-time weight is less than the second preset real-time weight.
[0008] In one possible implementation, the theoretical temperature drift error value is calculated based on the ambient temperature data and the prediction sub-model corresponding to the temperature range interval. This includes: if the ambient temperature data is within the interval boundary threshold range of the temperature range interval, calculating a first temperature drift error parameter based on the ambient temperature data and the prediction sub-model corresponding to the temperature range interval; calculating a second temperature drift error parameter based on the ambient temperature data and the adjacent prediction sub-models of the ambient temperature data; and obtaining the theoretical temperature drift error value by weighted summation of the first and second temperature drift error parameters.
[0009] In one possible implementation, the theoretical temperature drift error value is obtained by weighted summation of the first and second temperature drift error parameters, including: determining the index of the corresponding prediction sub-model based on ambient temperature data through hash table matching; the keys of the hash table are the upper and lower limits of the temperature range, and the values of the hash table include the index of the prediction sub-model, the pre-stored basic parameters, and the boundary weights of adjacent prediction sub-models; and calculating the theoretical temperature drift error value based on the first temperature drift error parameter, the second temperature drift error parameter, and the boundary weights of the two adjacent prediction sub-models.
[0010] In one possible implementation, the predictive sub-model types include linear predictive sub-models and quadratic predictive sub-models; the temperature drift compensation method further includes: the microprocessor periodically calculating the mean temperature drift deviation based on the actual temperature drift error and the temperature drift error predicted by the predictive sub-model; if the mean temperature drift deviation is greater than a preset deviation threshold, a dataset is constructed based on data samples corresponding to the temperature range; the data samples include data pairs of ambient temperature and actual temperature drift error; based on the type of predictive sub-model and the dataset, statistics are calculated; the statistics include the total number of samples, the sum of ambient temperatures, the sum of squares of ambient temperatures, the sum of cubes of ambient temperatures, and the fourth degree of ambient temperature. The formulas are as follows: sum of squares, sum of actual temperature drift errors, sum of the product of ambient temperature and actual temperature drift errors, and sum of the product of the square of ambient temperature and actual temperature drift errors; if the prediction sub-model is a linear prediction sub-model, the first coefficient is calculated based on statistics and the least squares formula; if the prediction sub-model is a quadratic prediction sub-model, the least squares equation system is constructed based on statistics, and the second coefficient is calculated by matrix inversion; a fitted value is generated based on the first or second coefficient, and the mean residual of the fitted value and the actual error is calculated; if the mean residual meets the preset conditions, the first or second coefficient is used as the coefficient of the prediction sub-model to update the prediction sub-model.
[0011] In one possible implementation, the temperature drift compensation method further includes: calculating the rate of change of ambient temperature based on the ambient temperature obtained in real time from the Hall current sensor; if the rate of change of ambient temperature is less than a preset rate of change threshold, sampling the ambient temperature at a first preset sampling frequency; if the rate of change of ambient temperature is greater than or equal to the preset rate of change threshold, sampling the ambient temperature at a second preset sampling frequency, wherein the first preset sampling frequency is lower than the second preset sampling frequency.
[0012] In one possible implementation, the compensation signal is superimposed on the original sampling signal of the Hall current sensor using a differential amplifier circuit to obtain the final current signal. This includes: performing differential operations on the compensation signal and the original sampling signal of the Hall current sensor using an operational amplifier and a symmetrical resistor network in the differential amplifier circuit to extract an initial effective signal without temperature drift; and adjusting the amplitude of the initial effective signal based on the feedback resistor of the differential amplifier circuit to obtain the final current signal.
[0013] Secondly, embodiments of the present invention provide a temperature drift compensation device for a Hall current sensor, comprising: a communication module for acquiring ambient temperature data of the Hall current sensor using a temperature sensor; a processing module for calculating a temperature drift error parameter corresponding to the current ambient temperature data based on the ambient temperature data and a temperature drift prediction model; a compensation signal generation module for generating a corresponding compensation signal based on the temperature drift error parameter, wherein the compensation signal and the temperature drift error characterized by the temperature drift error parameter are equal in magnitude and opposite in direction; and a differential amplifier circuit for superimposing the compensation signal with the original sampling signal of the Hall current sensor to obtain the final current signal.
[0014] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect or any possible implementation thereof.
[0015] In this embodiment of the invention, the ambient temperature data of the Hall current sensor is acquired in real time by a temperature sensor. A microprocessor, combined with a temperature drift prediction model, calculates a temperature drift error parameter that matches the current temperature. A compensation signal generation module uses this temperature drift error parameter as a reference to generate a compensation signal that is equal in magnitude but opposite in direction to the temperature drift error. This compensation signal is then superimposed on the original sampling signal of the Hall current sensor via a differential amplifier circuit. This specifically cancels out the temperature drift component in the original signal caused by temperature fluctuations, achieving the cancellation of the temperature drift error and the compensation signal. Ultimately, this eliminates temperature drift interference, reduces the deviation between the output current signal and the actual measured current, and improves the detection accuracy of the Hall current sensor. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the implementation of the temperature drift compensation method for the Hall current sensor provided in this embodiment of the invention. Figure 2 This is a schematic diagram of the temperature drift compensation device for the Hall current sensor provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0017] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0018] See Figure 1This document illustrates a flowchart of the implementation of a temperature drift compensation method for a Hall current sensor provided in an embodiment of the present invention. The temperature drift compensation method for a Hall current sensor is applied to a temperature drift compensation system. The temperature drift compensation system includes a temperature sensor, a microprocessor, a temperature drift prediction model, a compensation signal generation module, and a differential amplifier circuit. The temperature drift compensation method includes: Step 101: Use a temperature sensor to obtain the ambient temperature data from the Hall current sensor.
[0019] In some embodiments, a temperature sensor is an electronic component that converts physical changes in ambient temperature (such as thermal expansion and contraction, changes in resistance, changes in potential, etc.) into electrical signals (such as voltage and current) that can be recognized by a microprocessor. It is the core hardware for realizing temperature data acquisition. Common types include thermistors (NTC / PTC), thermocouples, platinum resistance thermometers (PT100), and digital temperature sensors. The appropriate type should be selected based on the operating temperature range of the Hall current sensor (e.g., -40℃ to 125℃ in industrial scenarios). As the temperature sensing unit of the temperature drift compensation system, the core function of the temperature sensor is to collect the temperature of the environment in which the Hall current sensor is located in real time. This provides the basic data for subsequent calculation of temperature drift error, because the temperature drift error (output deviation) of the Hall current sensor is directly related to the ambient temperature. Only by obtaining an accurate ambient temperature can the corresponding error parameters be calculated through the temperature drift prediction model, thereby generating an accurate compensation signal.
[0020] In some embodiments, the Hall current sensor operates based on the Hall effect and is used to measure DC, AC, or pulse current. Its core function is to convert the measured current into a corresponding output voltage (or current). However, due to the influence of ambient temperature, the output signal exhibits temperature drift; that is, even if the measured current remains constant, the output voltage will deviate when the temperature changes. This is the core issue that this invention needs to compensate for. The Hall current sensor is the object of compensation in the entire temperature drift compensation method. The ultimate goal of all steps in this invention (including temperature acquisition, error calculation, and compensation signal generation) is to correct the output deviation of the Hall current sensor caused by temperature changes, ensuring that its output signal accurately reflects the true magnitude of the measured current and meets the accuracy requirements for current measurement in industrial control, power monitoring, and other scenarios (such as BMS for new energy vehicles and power grid current monitoring).
[0021] In some embodiments, the ambient temperature data is the real-time temperature value of the environment where the Hall current sensor is located, collected by a temperature sensor, converted by a microprocessor, and stored as a digital signal (e.g., 25.3℃, -10.5℃). This is one of the core input parameters of the temperature drift prediction model. The temperature drift characteristic of the Hall current sensor is temperature-dependent; the magnitude and trend of the temperature drift error differ at different temperatures (e.g., the temperature drift error increases with increasing temperature at low temperatures and tends to level off at high temperatures). Only based on accurate ambient temperature data can the microprocessor locate the temperature drift pattern corresponding to the current temperature through the temperature drift prediction model, and then calculate the error parameters that need to be compensated.
[0022] As one possible implementation, this embodiment of the invention utilizes a temperature sensor to obtain the ambient temperature data from the Hall current sensor. This data serves as the starting point for the entire temperature drift compensation method and the basis for triggering the compensation logic. Its core function is to provide crucial temperature information for subsequent temperature drift error calculation and compensation signal generation.
[0023] Step 102: The microprocessor calculates the temperature drift error parameters corresponding to the current ambient temperature data based on the ambient temperature data and the temperature drift prediction model.
[0024] In some embodiments, the microprocessor is a core control unit (such as an MCU or DSP) with data processing, logical judgment, and instruction execution functions. It serves as the computational and control center of the temperature drift compensation system, capable of reading input data, calling preset models, executing computational logic, and outputting results. As the "brain" of the compensation system, the microprocessor's core function is to integrate data and models to calculate temperature drift errors. On one hand, it reads the collected ambient temperature data; on the other hand, it calls the pre-stored temperature drift prediction model. Through model algorithm calculations, it transforms the temperature data into corresponding temperature drift error parameters, providing a computational basis for subsequent compensation signal generation. Simultaneously, it can also coordinate the working timing of other modules in the system (such as the compensation signal generation module and the differential amplifier circuit).
[0025] In some embodiments, the temperature drift prediction model is a mathematical algorithm model (such as a combination of multiple prediction sub-models, linear / quadratic fitting models, etc.) built based on the temperature drift characteristics (correspondence between temperature and error) of the Hall current sensor. This model is pre-stored in the microprocessor and can output the corresponding theoretical temperature drift error law based on the input ambient temperature data. As an algorithmic template for calculating temperature drift error, the core function of the temperature drift prediction model is to establish the mapping relationship between ambient temperature and temperature drift error. Through algorithms fixed in the model (such as sub-model interval matching, least squares fitting formulas), discrete ambient temperature data is transformed into continuous, quantifiable temperature drift error laws, allowing the microprocessor to quickly calculate the error magnitude at the current temperature. This avoids the complex process of relying on real-time measurement of actual errors and improves the compensation response speed.
[0026] For example, during the development phase of the compensation system, temperature and actual temperature drift error data of Hall current sensors at different temperatures are collected experimentally. A model is constructed based on the data characteristics (such as temperature range differences), and the model coefficients (such as the a and b values in the parameters of a linear model) are calculated using methods such as least squares. The constructed model algorithm and coefficient parameters are written into the non-volatile memory (such as EEPROM or Flash) of the microprocessor for direct use by the microprocessor during the compensation process.
[0027] In some embodiments, the temperature drift error parameter is a quantitative parameter (e.g., +2.1mV, -1.5mV, where the positive and negative signs represent the direction of the deviation and the numerical value represents the magnitude of the deviation) calculated by the microprocessor using ambient temperature data and a temperature drift prediction model. This parameter characterizes the magnitude and direction of the Hall current sensor's output deviation at the current temperature. The temperature drift error parameter serves as the target for subsequent compensation actions. The compensation signal generation module needs to use this parameter as a reference to generate a compensation signal of equal magnitude but opposite direction. For example, if the temperature drift error parameter is +2.1mV (meaning the sensor output is 2.1mV higher than the true value), then the compensation signal should be -2.1mV. By superimposing these signals, the original temperature drift deviation is offset, ensuring the accuracy of the final output signal.
[0028] In some embodiments, the temperature drift prediction model includes several prediction sub-models, each prediction sub-model corresponding to a preset temperature range interval, and the temperature range interval is divided according to the characteristics of temperature drift in different temperature ranges.
[0029] As one possible implementation, step 102 can be specifically implemented as steps A11-A14.
[0030] A11: Based on ambient temperature data and preset temperature range intervals, determine the temperature range interval corresponding to the current ambient temperature.
[0031] A12: Based on ambient temperature data and the prediction sub-model corresponding to the temperature range, the theoretical temperature drift error value is calculated.
[0032] In some embodiments, the predictive sub-model is the smallest algorithmic unit of the temperature drift prediction model. Each sub-model corresponds to a specific temperature range and has built-in algorithms (such as linear fitting algorithms and quadratic fitting algorithms) and preset coefficients (such as a / b for linear models and a / b / c for quadratic models) adapted to the temperature drift characteristics of that range. As a tool for calculating errors across temperature ranges, the core function of the predictive sub-model is to accurately calculate the theoretical temperature drift error for the corresponding temperature range. When the ambient temperature falls within a certain range, the microprocessor directly calls the predictive sub-model for that range, substitutes the temperature data, and quickly outputs the theoretical error value, avoiding the problem of large errors caused by using mismatched models across ranges (e.g., nonlinear temperature drift in low-temperature ranges will produce significant deviations when calculated using linear sub-models). The predictive sub-model is a component of the temperature drift prediction model after decomposition, and its origin is consistent with the temperature drift prediction model. During the development phase, based on temperature drift experimental data from different temperature ranges, sub-models for each range are obtained through fitting algorithms such as least squares (determining the model type and calculating coefficients), and then bound to the range, stored in the microprocessor as part of the temperature drift prediction model.
[0033] In some embodiments, the preset temperature range is a pre-defined range of non-overlapping temperature intervals (e.g., -40℃ to -10℃, -10℃ to 40℃, 40℃ to 125℃) that covers the entire operating temperature range, based on the differences in temperature drift characteristics of different temperature segments of the Hall current sensor. Each interval uniquely corresponds to a prediction sub-model. The preset temperature range serves as the matching basis for sub-model invocation, and its core function is to determine the calculation tool corresponding to the current temperature. The microprocessor first determines which interval the ambient temperature falls into, and then invokes the prediction sub-model for that interval, ensuring a one-to-one correspondence between temperature and sub-model and avoiding confusion in sub-model invocation. At the same time, the interval division also provides a clear boundary definition for subsequent boundary temperature error processing (e.g., -10℃ is the boundary between two intervals). The preset temperature range is determined based on the temperature drift experimental data of the Hall current sensor. During the research and development phase, the temperature drift error of the sensor at different temperatures is tested experimentally, and the inflection point of the error change law is analyzed (such as the significant change in the error change rate at -10℃ and 40℃). The temperature range is divided with the inflection point as the boundary to ensure that the temperature drift characteristics in each range can be accurately fitted by a single sub-model. The division rules are stored in the microprocessor along with the temperature drift prediction model.
[0034] In some embodiments, the theoretical temperature drift error value is a quantified value representing the theoretically expected temperature drift deviation of the sensor at that temperature, calculated by the microprocessor using the prediction sub-model corresponding to the current temperature range and substituting ambient temperature data. Its magnitude and direction are jointly determined by the sub-model algorithm and the temperature data. As one of the fundamental terms in the calculation of temperature drift error parameters, the theoretical temperature drift error value serves as a core component, providing an error reference based on historical experimental patterns. This value reflects the typical temperature drift deviation of the sensor at that temperature (based on fitting of a large amount of experimental data), exhibiting high stability. It can be used as a benchmark term for subsequent weighted summation with the real-time temperature drift error value, balancing any potential instantaneous fluctuations in real-time error.
[0035] As one possible implementation, step A12 can be specifically implemented as steps B11-B13.
[0036] B11: If the ambient temperature data is within the threshold range of the temperature range interval, the first temperature drift error parameter is calculated based on the ambient temperature data and the prediction sub-model corresponding to the temperature range interval.
[0037] B12: The second temperature drift error parameter is calculated based on the ambient temperature data and the adjacent prediction sub-models that are close to the ambient temperature data.
[0038] B13: The theoretical temperature drift error value is obtained by weighted summation of the first and second temperature drift error parameters.
[0039] In some embodiments, the interval boundary threshold range is a transitional temperature range set at the boundary of a preset temperature range interval (such as the dividing temperature between two intervals, -10℃ and 40℃). For example, when -10℃ is used as the boundary, the interval boundary threshold range can be set to -12℃ to -8℃. The core is to cover the boundary temperature region that a single interval sub-model cannot accurately fit. The interval boundary threshold range serves as the criterion for triggering the boundary error processing logic. If the ambient temperature is within a certain interval (such as 25℃ within -10℃ to 40℃), the calculation can be performed directly using the interval sub-model. If the ambient temperature falls within the interval boundary threshold range (such as -11℃, which is between -12℃ and -8℃), it indicates that the temperature is in the transition zone between the two intervals. The error calculated by a single sub-model will have a deviation, and a special calculation logic of dual-model weighting needs to be triggered to avoid a jump in compensation accuracy at the boundary.
[0040] In some embodiments, the first temperature drift error parameter is the temperature drift error value calculated by the prediction sub-model corresponding to the target temperature range to which the current temperature belongs when the ambient temperature falls within the range boundary threshold. For example, if the temperature -11℃ belongs to the range of -40℃ to -10℃, the error value calculated by the sub-model of this range (such as -1.8mV) is the first temperature drift error parameter.
[0041] In some embodiments, an adjacent prediction sub-model is a prediction sub-model corresponding to another temperature range that is directly adjacent to the target temperature range to which the current temperature belongs. For example, if the current temperature is -11℃, it belongs to the range of -40℃ to -10℃, and its adjacent range is -10℃ to 40℃, then the sub-model corresponding to this range is the adjacent prediction sub-model.
[0042] In some embodiments, the first temperature drift error parameter is the temperature drift error value calculated by the adjacent prediction sub-model when the ambient temperature falls within the threshold range of the interval boundary. For example, when the temperature is -11℃, the error value calculated by the sub-model of its adjacent interval (-10℃~40℃) (such as -1.6mV) is the second temperature drift error parameter.
[0043] As one possible implementation, the embodiments of the present invention can solve the problems of low calculation accuracy and abrupt changes in compensation values of a single sub-model when the ambient temperature is at the boundary of two temperature ranges, and ensure smooth and continuous compensation accuracy across the entire temperature range.
[0044] As one possible implementation, step B13 can be implemented as steps C11-C12.
[0045] C11: Based on ambient temperature data, the index of the corresponding prediction sub-model is determined by matching a hash table. The keys of the hash table are the upper and lower limits of the temperature range, and the values of the hash table include the index of the prediction sub-model, the pre-stored basic parameters, and the boundary weights of adjacent prediction sub-models.
[0046] C12: The theoretical temperature drift error value is calculated based on the first temperature drift error parameter, the second temperature drift error parameter, and the boundary weights of the two adjacent prediction sub-models.
[0047] In some embodiments, a hash table is an efficient data structure for storing data based on key-value mapping. In this scenario, the key is the upper and lower limits of the temperature range (e.g., -40℃, -10℃, -10℃, 40℃), and the value is the core data set corresponding to that temperature range (containing the index of the prediction sub-model, pre-stored basic parameters, and boundary weights of adjacent prediction sub-models). Its core feature is that it allows for fast lookup of values via keys, with a query time complexity close to O(1) (i.e., it can directly locate the target without traversing all the data).
[0048] In some embodiments, the index of the predictive sub-model is a unique identifier code (such as integers 1, 2, 3) assigned to each predictive sub-model, used to quickly locate the sub-model ontology (including sub-model type: linear model / quadratic model, and sub-model coefficients: such as parameters a and b of a linear model) pre-stored in the microprocessor. For example, index 1 corresponds to a quadratic sub-model of -40℃ to -10℃, and index 2 corresponds to a linear sub-model of -10℃ to 40℃.
[0049] In some embodiments, the pre-stored basic parameters are basic coefficients or constants pre-stored for each temperature range to quickly calculate the sub-model error, rather than complete raw data. For example, the basic parameters of the linear prediction sub-model are coefficients a (slope) and b (intercept), and the basic parameters of the quadratic prediction sub-model are coefficients a, b, and c. They can be directly substituted into the formula without refitting each time the calculation is performed.
[0050] In some embodiments, the boundary weights of adjacent prediction sub-models are pre-set fixed coefficients (ranging from 0 to 1, and the sum of the boundary weights of the two adjacent sub-models is 1) used to perform a weighted summation of the first temperature drift error parameter and the second temperature drift error parameter at the boundary of the temperature range. For example, at the boundary between -40℃ to -10℃ and -10℃ to 40℃, the boundary weight of the current range (-40℃ to -10℃) is 0.3, and the boundary weight of the adjacent range (-10℃ to 40℃) is 0.7.
[0051] As one possible implementation, this embodiment of the invention can solve the problems of potentially long calculation time for boundary error and ambiguous parameter calling logic by using a mechanism of fast hash table lookup and direct calling of pre-stored parameters. This improves system real-time performance and implementation consistency while ensuring the accuracy of boundary compensation.
[0052] A13: Calculate the real-time temperature drift error value based on the current raw output voltage of the Hall current sensor and the theoretical output voltage corresponding to the current actual current.
[0053] A14: The temperature drift error parameter is calculated by weighted summation of the theoretical temperature drift error value and the real-time temperature drift error value.
[0054] In some embodiments, the real-time temperature drift error value is a quantitative value that characterizes the real-time temperature drift deviation of the sensor, calculated by comparing the current original output voltage of the Hall current sensor with the theoretical output voltage corresponding to the current actual current. It directly reflects the actual error of the sensor under its current operating state. As one of the adjustment items in the calculation of the temperature drift error parameter, the real-time temperature drift error value plays a crucial role in correcting the deviation between the theoretical error and the actual operating conditions. The theoretical temperature drift error value is based on historical experimental data and may deviate from the current actual state of the sensor (such as aging or transient electromagnetic interference). The real-time temperature drift error value can capture this real-time deviation and, by weighted summation with the theoretical value, make the final temperature drift error parameter closer to the current true state of the sensor.
[0055] For example, the microprocessor reads the current raw output voltage of the Hall current sensor in real time (the electrical signal directly output by the sensor, without compensation), and at the same time obtains the current actual current value (such as through a calibration circuit or an external reference device). Based on the inherent parameters of the Hall current sensor, such as sensitivity, it calculates the theoretical output voltage corresponding to the current actual current (theoretical voltage = sensitivity × actual current). The real-time temperature drift error value = current raw output voltage - theoretical output voltage corresponding to the current actual current.
[0056] As one possible implementation, step A14 can be specifically implemented as steps B21-B24.
[0057] B21: Calculate the rate of change of ambient temperature based on the ambient temperature obtained from the Hall current sensor in real time.
[0058] B22: Calculate the rate of change of the input current of the Hall current sensor based on the real-time acquired input current of the Hall current sensor.
[0059] B23: If the rate of change of ambient temperature is less than the preset temperature change rate threshold, and the rate of change of input current of Hall current sensor is less than the preset current change rate threshold, the weight of theoretical temperature drift error value is the first preset theoretical weight, and the weight of real-time temperature drift error value is the first preset real-time weight.
[0060] B24: If the rate of change of ambient temperature is greater than or equal to the preset temperature change rate threshold, or the rate of change of input current of Hall current sensor is greater than or equal to the preset current change rate threshold, the weight of theoretical temperature drift error value is the second preset theoretical weight, the weight of real-time temperature drift error value is the second preset real-time weight, the first preset theoretical weight is greater than the second preset theoretical weight, and the first preset real-time weight is less than the second preset real-time weight.
[0061] In some embodiments, the rate of change of ambient temperature is the amount of change in the ambient temperature where the Hall current sensor is located per unit time. The calculation formula is: Rate of change of ambient temperature = (Current ambient temperature - Ambient temperature at the previous moment) / Time interval, reflecting the speed of temperature change. The rate of change of ambient temperature is one of the core judgment indicators for dynamic weight adjustment, used to distinguish between steady-state and dynamic temperature conditions. If the rate of change is small (e.g., <0.5℃ / s), it indicates that the temperature is stable, and the theoretical temperature drift error value (based on historical steady-state data) is more reliable, so its weight needs to be increased. If the rate of change is large (e.g., ≥0.5℃ / s), it indicates that the temperature is changing rapidly, and the theoretical value may lag behind the actual temperature drift, so the weight of the real-time temperature drift error value needs to be increased to ensure that the error calculation fits the current dynamic scenario.
[0062] In some embodiments, the rate of change of input current is the change in input current measured by the Hall current sensor per unit time. The calculation formula is: Rate of change of input current = (Current input current - Previous input current) / Time interval, reflecting the speed of change of the measured current. The rate of change of input current serves as another core indicator for dynamic weight adjustment, distinguishing between steady-state and dynamic current conditions. If the rate of change is small (e.g., <0.1A / s), it indicates stable current, with sensor output deviation mainly originating from temperature, making the theoretical temperature drift error value more reliable. If the rate of change is large (e.g., ≥0.1A / s), it indicates rapid current change, potentially accompanied by sensor dynamic response deviation, requiring an increase in the weight of the real-time temperature drift error value to correct for additional deviations under dynamic conditions.
[0063] In some embodiments, the preset temperature change rate threshold is a pre-set critical value used to determine whether the ambient temperature is in a steady state, serving as a quantitative standard to distinguish between steady-state and dynamic temperatures. The preset temperature change rate threshold acts as a benchmark for judging the rate of change in ambient temperature. When the real-time ambient temperature change rate is less than this threshold, it is determined to be in a steady-state temperature condition, and a high theoretical weight and a low real-time weight are applied. When the change rate is greater than or equal to this threshold, it is determined to be in a dynamic temperature condition, and a low theoretical weight and a high real-time weight are applied. This ensures that the weight adjustment has clear triggering conditions and avoids subjective judgment bias.
[0064] In some embodiments, the preset current change rate threshold is a pre-set critical value used to determine whether the input current is in a steady state, serving as a quantitative standard to distinguish between steady-state and dynamic current. The preset current change rate threshold acts as a benchmark for judging the input current change rate. When the real-time input current change rate is less than this threshold, it is determined to be in a steady-state current condition, and the sensor output deviation is mainly due to temperature drift. When the change rate is greater than or equal to this threshold, it is determined to be in a dynamic current condition, requiring the real-time weight to be increased to correct the dynamic response deviation and ensure that the weight adjustment is adapted to the current operating conditions.
[0065] In some embodiments, the first preset theoretical weight and the second preset theoretical weight are pre-set coefficients (ranging from 0 to 1, such as 0.7 for the first preset theoretical weight and 0.3 for the second preset theoretical weight) used to allocate the proportion of theoretical temperature drift error values in the weighted summation. By adjusting the coefficients, the influence of theoretical values is adjusted. The first preset theoretical weight (e.g., 0.7) is used for bistable temperature and current conditions, where theoretical values are stable and reliable, and increasing its proportion can enhance the stability of error calculation. The second preset theoretical weight (e.g., 0.3) is used for dynamic temperature or current conditions, where theoretical values may lag, and reducing its proportion can reduce the interference of theoretical values on real-time deviations.
[0066] In some embodiments, the first preset real-time weight and the second preset real-time weight are pre-set coefficients (ranging from 0 to 1, such as 0.3 for the first preset real-time weight and 0.7 for the second preset real-time weight) used to allocate the proportion of real-time temperature drift error values in the weighted summation. The influence of the real-time value is adjusted by the coefficients: the first preset real-time weight (e.g., 0.3) is used for bistable conditions, where the real-time value is less likely to be affected by noise but does not need to dominate the calculation, and a low proportion can balance stability and accuracy; the second preset real-time weight (e.g., 0.7) is used for dynamic conditions, where the real-time value can capture the current deviation, and a high proportion can ensure that the error calculation fits the actual dynamic scenario.
[0067] As one possible implementation, embodiments of the present invention dynamically adjust the weights to ensure that the calculation of temperature drift error parameters can accurately adapt to different operating conditions of temperature and current, thus balancing the stability of error calculation with the adaptability to actual operating conditions.
[0068] As one possible implementation, this embodiment of the invention uses a weighted summation design to retain the stability of the theoretical value (as a benchmark) while using the real-time value to correct the current deviation (to adapt to actual working conditions). This ensures that the final temperature drift error parameter has both stability and accuracy, providing a reliable basis for the subsequent generation of accurate compensation signals. This is the core design to ensure the accuracy of the entire temperature drift compensation method.
[0069] As one possible implementation, the microprocessor in this embodiment of the invention calculates the temperature drift error parameter corresponding to the current ambient temperature data based on ambient temperature data and a temperature drift prediction model. It is the core computing hub and compensation logic bridge of the entire temperature drift compensation method, connecting data acquisition and compensation execution.
[0070] Step 103: The compensation signal generation module generates a corresponding compensation signal based on the temperature drift error parameter. The compensation signal is equal in magnitude and opposite in direction to the temperature drift error represented by the temperature drift error parameter.
[0071] In some embodiments, the compensation signal generation module is a hardware circuit unit that converts the temperature drift error parameters (digital signals) output by the microprocessor into analog electrical signals (such as voltage signals) that can be superimposed on the original sampling signals of the Hall current sensor. Common structures include digital-to-analog converters (DACs) and signal conditioning circuits (such as amplification and filtering circuits), serving as a hardware bridge connecting error calculation and signal superposition. As the signal conversion hub of the temperature drift compensation system, the core function of the compensation signal generation module is to convert abstract error parameters into executable compensation electrical signals. The temperature drift error parameters calculated by the microprocessor are digital quantities and cannot be directly superimposed on the original sampling signals (analog quantities). This module converts the digital error parameters into analog voltage signals through a DAC, and then optimizes the signal amplitude and reduces noise through conditioning circuits to generate a compensation signal that can accurately offset the temperature drift error, providing a suitable hardware signal for signal superposition in subsequent differential amplifier circuits.
[0072] In some embodiments, the compensation signal is an analog electrical signal (usually a voltage signal) output by the compensation signal generation module to compensate for the temperature drift error of the Hall current sensor. Its core characteristic is that it is equal in magnitude and opposite in direction to the temperature drift error characterized by the temperature drift error parameter. For example, if the temperature drift error parameter is +2.1mV (meaning the sensor output is 2.1mV higher than the true value), then the compensation signal is -2.1mV; if the error parameter is -1.5mV (the output is 1.5mV lower than the true value), then the compensation signal is +1.5mV. As the core execution carrier for temperature drift compensation, the compensation signal's core function is to compensate for the temperature drift error in the original sampling signal. The original sampling signal of the Hall current sensor contains the effective signal corresponding to the true current and the temperature drift error signal caused by temperature. By superimposing the compensation signal on the original sampling signal, the temperature drift error signal can be accurately cancelled out, ultimately retaining only the effective signal reflecting the true current, thus achieving temperature drift-free current measurement.
[0073] In some embodiments, the compensation signal generation module includes a digital-to-analog converter and an operational amplifier.
[0074] As one possible implementation, step 103 can be specifically implemented as steps A21-A23.
[0075] A21: The microprocessor determines the digital control quantity based on the temperature drift error parameter; the digital control quantity is proportional to the amplitude of the temperature drift error parameter but opposite in polarity.
[0076] A22: The digital-to-analog converter determines the analog voltage signal based on digital control quantities.
[0077] A23: The operational amplifier is based on the analog voltage signal. The compensation signal is determined by linear amplification and impedance matching. The compensation signal is equal in magnitude and opposite in direction to the temperature drift error parameter.
[0078] In some embodiments, the digital control quantity is a digitally quantized signal generated by the microprocessor based on the temperature drift error parameter. Its core characteristic is that it is proportional to the amplitude and opposite in polarity to the temperature drift error parameter. For example, if the temperature drift error parameter is +2.1mV (positive deviation), the digital control quantity corresponds to a quantized value of -2.1mV; if the error parameter is -1.5mV (negative deviation), the digital control quantity corresponds to a quantized value of +1.5mV. As the input instruction to the digital-to-analog converter (DAC), the digital control quantity acts as a bridge connecting the digital error parameter and the analog compensation signal. The temperature drift error parameter output by the microprocessor is a digital quantity (such as +2.1mV in decimal), which cannot directly drive the DAC. The digital control quantity converts the amplitude and polarity of the error parameter into a digital code that the converter can recognize, clearly instructing the converter to output an analog signal of what amplitude and polarity, ensuring the accuracy of the direction and magnitude of the subsequently generated compensation signal.
[0079] In some embodiments, a digital-to-analog converter is a hardware component that can convert digital control quantities (binary numbers) into analog voltage signals that are proportional to them. Its core performance indicators include resolution, conversion accuracy, and conversion speed. It is the core of the digital-to-analog conversion of the compensation signal generation module.
[0080] In some embodiments, the analog voltage signal is a continuous voltage signal output by a digital-to-analog converter that is proportional to the digital control quantity. Its amplitude and polarity have been initially matched to the compensation requirements, but there may be problems such as insufficient driving capability (high output impedance) or the amplitude accuracy needs to be fine-tuned. It needs to be processed by an operational amplifier before it can be used as the final compensation signal.
[0081] In some embodiments, impedance matching is a technique used to ensure that the output impedance of the compensation signal generation module matches the input impedance of the differential amplifier circuit through the circuit design of the operational amplifier (e.g., selecting an op-amp with high input impedance and low output impedance). This typically requires the output impedance of the signal source to be much smaller than the load input impedance, such as ≤1 / 10, thus ensuring that there is no attenuation or distortion during signal transmission.
[0082] As one possible implementation, this invention clarifies how to complete the conversion chain from digital error parameters to analog compensation signals, thus solving the engineering feasibility problem of compensation signal generation.
[0083] As one possible implementation, the embodiments of the present invention are optimized by conditioning circuits (such as amplification and filtering) to ensure that the signal amplitude is consistent with the temperature drift error of the original sampled signal (such as ±5mV error, the compensation signal is also ±5mV), and to filter signal noise to avoid introducing interference when superimposed.
[0084] Step 104: The compensation signal is superimposed on the original sampling signal of the Hall current sensor through a differential amplifier circuit to obtain the final current signal.
[0085] In some embodiments, a differential amplifier circuit is an analog electronic circuit that amplifies the difference between two input signals while suppressing common-mode signals (such as environmental noise and power supply interference). Its core components typically include an operational amplifier (op-amp) and a symmetrical resistor network (input resistor and feedback resistor). It possesses a high common-mode rejection ratio (CMRR), meaning it is sensitive to the difference between the two input signals and has a strong ability to suppress the same interference components (common-mode signals) in both signals. As the core of signal superposition and purification in a temperature drift compensation system, the differential amplifier circuit plays two crucial roles: accurately achieving signal superposition by algebraically superimposing the compensation signal with the original sampled signal through circuit design (such as an inverting adder circuit or a differential input circuit). Utilizing the characteristic that the compensation signal and the temperature drift error are equal in magnitude but opposite in direction, the temperature drift error component in the original sampled signal is canceled out. Secondly, it suppresses interference and purifies the effective signal. The original sampled signal of a Hall current sensor is susceptible to common-mode noise such as electromagnetic interference and power supply fluctuations. The differential amplifier circuit can significantly suppress these noises, ensuring that the superimposed output signal retains only the effective components reflecting the true current, thus improving the signal-to-noise ratio and measurement accuracy of the final current signal.
[0086] In some embodiments, the original sampling signal of the Hall current sensor is an analog electrical signal directly output by the Hall current sensor without any temperature drift compensation processing. Its signal amplitude is proportional to the magnitude of the measured current (following the Hall effect law: output voltage = sensitivity × measured current), but it contains a temperature drift error component caused by temperature changes. That is, under the same measured current, temperature changes will cause additional deviations in the signal amplitude. The original sampling signal of the Hall current sensor is the initial processing target for temperature drift compensation. Its core function is to provide a basic signal containing true current information. Although this signal contains temperature drift error, it essentially carries the magnitude information of the measured current and is a prerequisite for subsequent superposition of compensation signals and extraction of the true current signal. Without this signal, the compensation system has no correction target and cannot generate a final signal reflecting the true current.
[0087] In some embodiments, the final current signal is an electrical signal (usually a voltage signal, which can be converted into a current signal by subsequent circuits) that reflects only the true magnitude of the measured current after the compensation signal and the original sampling signal are superimposed by a differential amplifier circuit. This signal has canceled the temperature drift error component in the original sampling signal and suppressed common-mode interference. The signal amplitude has a precise linear correspondence with the measured current (without temperature-related deviation). The final current signal is the final output of the entire temperature drift compensation method. Its core function is to provide a temperature-drift-free and accurate current measurement signal for subsequent application scenarios. This signal can be directly used in scenarios such as industrial control, data monitoring, and fault diagnosis (e.g., overload current judgment), ensuring that these scenarios can make decisions based on accurate current data and avoid control deviations or monitoring errors caused by temperature drift errors.
[0088] As one possible implementation, step 104 can be specifically implemented as steps A31-A32.
[0089] A31: Based on the compensation signal and the original sampling signal from the Hall current sensor, differential operation is performed between the operational amplifier in the differential amplifier circuit and the symmetrical resistor network to extract the initial effective signal without temperature drift.
[0090] A32: Based on the feedback resistor of the differential amplifier circuit, the amplitude of the initial effective signal is adjusted to obtain the final current signal.
[0091] In some embodiments, an operational amplifier is an analog electronic component with high gain, high input impedance, and low output impedance. It amplifies the voltage difference between two input terminals and is the core component of a differential amplifier circuit. An ideal operational amplifier satisfies the virtual short (voltages at the two input terminals are approximately equal) and virtual open (current at the input terminal is approximately zero) characteristics. Actual selection requires consideration of parameters such as accuracy (e.g., low offset voltage) and bandwidth (to match the signal frequency). As the signal amplification core of a differential amplifier circuit, the operational amplifier plays two key roles: amplifying the differential signal by amplifying the difference between the compensation signal and the original sampled signal through its high gain characteristics, highlighting the effective component of the superposition to offset temperature drift error; and maintaining the linear operation of the circuit by relying on the virtual short and virtual open characteristics, combined with an external resistor network to construct a stable amplifier circuit, ensuring a linear correspondence between the output signal and the input signal difference, thus avoiding signal distortion.
[0092] In some embodiments, a symmetrical resistor network is a circuit structure consisting of four (or more) resistors with matched parameters (resistance error ≤ 1%). It typically includes an input resistor (connecting the op-amp input to the signal source) and a balancing resistor, and is a key component in differential amplifier circuits for suppressing common-mode interference. For example, in a typical differential amplifier circuit, the external resistors connected to the non-inverting and inverting inputs of the op-amp must be symmetrical, as must the feedback and balancing resistors. The core function of the symmetrical resistor network is to ensure the common-mode rejection ratio (CMRR) of the differential amplifier circuit. When common-mode interference exists (such as environmental electromagnetic noise or power supply fluctuations, which are superimposed on both the compensation signal and the original sampled signal), the symmetrical resistor network allows the interference signal to generate approximately equal voltages at the two inputs of the op-amp. Relying on the op-amp's ability to amplify the difference and suppress common-mode interference, the output of the interference signal is significantly weakened. Simultaneously, the symmetrical structure ensures that the op-amp stably amplifies the difference between the compensation signal and the original sampled signal (i.e., the effective component after temperature drift cancellation), avoiding signal distortion caused by asymmetrical resistor parameters.
[0093] In some embodiments, differential operation is a circuit operation based on operational amplifiers and symmetrical resistor networks to calculate and amplify the difference between two input signals: the compensation signal and the original sampling signal from the Hall current sensor. The mathematical expression can be simplified to: Output voltage = Amplification factor × (Original sampling signal voltage - Compensation signal voltage). Its core focus is on the difference between the two signals, rather than the absolute value of a single signal. The core operations of differential operation for achieving temperature drift error cancellation and interference suppression are: precise temperature drift cancellation, because the temperature drift errors in the compensation signal and the original sampling signal are equal in magnitude and opposite in direction, after differential operation, the temperature drift error components cancel each other out, retaining only the effective signal reflecting the true current; and common-mode interference filtering, as environmental noise, power supply fluctuations, and other common-mode signals simultaneously affect both input signals. During differential operation, these are suppressed because the signal difference remains unchanged, preventing interference from entering the final output.
[0094] In some embodiments, the initial valid signal without temperature drift is an analog signal obtained through differential operation, which has canceled temperature drift error but whose amplitude may not be adapted to downstream equipment. Its core characteristic is that it only contains components reflecting the true magnitude of the measured current, without temperature-induced deviations requiring further amplitude adjustment before it can be used by downstream equipment. The initial valid signal without temperature drift serves as the basic prototype of the final current signal, and its core function is to provide a pure and valid signal carrier. This signal has completed temperature drift error cancellation and interference filtering, and it is the reference signal for subsequent amplitude adjustment. Without this signal, subsequent amplitude adjustment will result in inaccurate final output due to signal errors or interference, making accurate current measurement impossible.
[0095] In some embodiments, the feedback resistor is the resistor connecting the output terminal and the inverting input terminal of the operational amplifier. It is a key component for adjusting the amplification factor of the differential amplifier circuit. The ratio of its resistance to the input resistance directly determines the amplification factor of the circuit (mathematical relationship: amplification factor = feedback resistor value / input resistance value). High-precision resistors with low temperature drift must be selected to ensure stable amplification factor. The core function of the feedback resistor is to adjust the amplitude of the initial effective signal without temperature drift. The amplitude of the initial effective signal is usually small and cannot directly drive downstream devices (such as PLCs and display instruments, which usually require V-level signals). By adjusting the resistance value of the feedback resistor (or by using feedback resistors with different resistance values for selection), the amplification factor of the circuit can be changed, amplifying the amplitude of the initial effective signal to a range suitable for downstream devices (such as amplifying 50mV to 5V), and finally obtaining a usable final current signal.
[0096] As one possible implementation, the embodiments of the present invention clarify how to achieve signal superposition, error cancellation and amplitude adaptation through hardware circuits, thereby solving the hardware executability problem of abstract method steps.
[0097] As one possible implementation, embodiments of the present invention can obtain the final current signal by superimposing the compensation signal and the original sampling signal through a differential amplifier circuit. This is the final execution link and output terminal of the entire temperature drift compensation method. Its core function is to complete the closed loop of error cancellation, signal purification and accurate output, and to transform the compensation logic of the previous steps into a usable accurate current signal.
[0098] In some embodiments, the types of prediction sub-models include linear prediction sub-models and quadratic prediction sub-models.
[0099] For example, the linear prediction sub-model is a mathematical model built on the linear relationship between ambient temperature and temperature drift error. Its core expression is: Temperature drift error = a × Ambient temperature + b (where a and b are model coefficients, a is the slope, and b is the intercept). It is suitable for temperature ranges where temperature drift characteristics are approximately linear (such as the normal temperature range of 0℃ to 80℃). The linear prediction sub-model adapts to temperature ranges with linearly changing temperature drift, quickly calculates the theoretical temperature drift error, and compared to complex models, has a smaller computational load and faster response speed. It can reduce the computational load on the microprocessor while maintaining accuracy, making it suitable for scenarios with stable temperature drift patterns.
[0100] For example, the quadratic prediction sub-model is a mathematical model built on the quadratic relationship between ambient temperature and temperature drift error. The core expression is temperature drift error value = a (Where a, b, and c are model coefficients), applicable to temperature ranges with nonlinear temperature drift characteristics (such as the low-temperature range of -40℃ to 0℃, where the error changes at an uneven rate with temperature). The quadratic prediction sub-model adapts to temperature ranges with nonlinear temperature drift, improving the accuracy of error calculation: when the temperature drift error changes curvilinearly with temperature, the linear model will produce significant deviations, while the quadratic model can better fit the actual temperature drift law, ensuring the accuracy of the theoretical error value within this range.
[0101] In this embodiment of the invention, the ambient temperature data of the Hall current sensor is acquired in real time by a temperature sensor. A microprocessor, combined with a temperature drift prediction model, calculates a temperature drift error parameter that matches the current temperature. A compensation signal generation module uses this temperature drift error parameter as a reference to generate a compensation signal that is equal in magnitude but opposite in direction to the temperature drift error. This compensation signal is then superimposed on the original sampling signal of the Hall current sensor via a differential amplifier circuit. This specifically cancels out the temperature drift component in the original signal caused by temperature fluctuations, achieving the cancellation of the temperature drift error and the compensation signal. Ultimately, this eliminates temperature drift interference, reduces the deviation between the output current signal and the actual measured current, and improves the detection accuracy of the Hall current sensor.
[0102] Optionally, the temperature drift compensation method of the present invention further includes steps A41-A47.
[0103] A41: The microprocessor periodically calculates the mean temperature drift deviation based on the actual temperature drift error and the temperature drift error predicted by the prediction sub-model.
[0104] A42: If the average temperature drift deviation is greater than the preset deviation threshold, construct a dataset based on the data samples corresponding to the temperature range; the data samples include data pairs of ambient temperature and actual temperature drift error.
[0105] A43: Calculate statistics based on the type of the prediction sub-model and the dataset; the statistics include the total number of samples, the sum of ambient temperatures, the sum of the squares of ambient temperatures, the sum of the cubes of ambient temperatures, the sum of the fourth powers of ambient temperatures, the sum of the actual temperature drift errors, the sum of the products of ambient temperatures and actual temperature drift errors, and the sum of the products of the squares of ambient temperatures and actual temperature drift errors.
[0106] A44: If the prediction sub-model is a linear prediction sub-model, the first coefficient is calculated based on statistics and the least squares formula.
[0107] A45: If the prediction sub-model is a quadratic prediction sub-model, construct a system of least squares equations based on statistics, and calculate the second coefficient using the matrix inversion method.
[0108] A46: Generate fitted values based on the first or second coefficient, and calculate the mean residual between the fitted values and the actual error.
[0109] A47: If the mean of the residuals meets the preset conditions, the first coefficient or the second coefficient will be used as the coefficient of the prediction sub-model to update the prediction sub-model.
[0110] In some embodiments, the actual temperature drift error is the actual temperature drift deviation of the Hall current sensor under the current operating conditions. The calculation formula is: Actual temperature drift error = Current original output voltage - Theoretical output voltage corresponding to the current actual current. The actual temperature drift error serves as a benchmark for verifying the accuracy of the sub-model. By comparing the actual temperature drift error with the temperature drift error predicted by the sub-model, it can be determined whether the accuracy of the sub-model has degraded due to factors such as sensor aging and environmental changes. It is the core reference for triggering sub-model updates.
[0111] In some embodiments, the mean temperature drift deviation is the average difference between the actual temperature drift error and the predicted temperature drift error of the sub-model over a period of time (e.g., 1 hour, 100 sampling periods). The calculation formula is: Mean Temperature Drift Deviation = (Σ(Actual Temperature Drift Error - Predicted Temperature Drift Error)) / Number of Sampling Times, reflecting the overall accuracy decay of the sub-model. The mean temperature drift deviation is used to determine whether the sub-model's quantitative indicators need updating: if the mean deviation is small (e.g., <0.1mV), it indicates that the sub-model's accuracy meets the standard; if the mean deviation is large (e.g., ≥0.1mV), it indicates that the sub-model can no longer accurately reflect the true temperature drift pattern, and an update process needs to be initiated to avoid compensation failure due to insufficient model accuracy.
[0112] In some embodiments, the preset deviation threshold is a pre-set critical value (e.g., 0.1mV, 0.5mV) for determining whether the sub-model accuracy meets the standard. It serves as the threshold for triggering sub-model updates and needs to be determined based on the sensor's accuracy requirements (e.g., 0.1 grade, 0.5 grade). The preset deviation threshold provides a clear triggering condition for sub-model updates: when the average temperature drift deviation is greater than the preset deviation threshold, the sub-model accuracy is determined to be substandard, and the update process is automatically initiated; if it is less than the threshold, the current parameters of the sub-model are maintained to avoid unnecessary update operations consuming system resources.
[0113] In some embodiments, the data samples are pairs of data consisting of the ambient temperature at a certain moment and the actual temperature drift error at the corresponding moment (e.g., (25℃, +2.1mV), (-10℃, -1.5mV)). These data samples form the original data basis for reconstructing the sub-model coefficients. The data samples provide data support for the calculation of the sub-model coefficients: the coefficients of the sub-model need to be fitted based on a large number of data samples. The more samples there are and the more complete the temperature range covered, the higher the accuracy of the fitted coefficients, and the better the updated sub-model fits the real temperature drift pattern.
[0114] In some embodiments, statistics are fundamental parameters calculated based on data samples and used to fit the coefficients of the sub-model. These include the total number of samples, the sum / sum of squares / cubic / fourth power of ambient temperatures, the sum of actual temperature drift errors, the sum of the products of ambient temperature and actual temperature drift errors, and the sum of the products of the squares of ambient temperature and actual temperature drift errors. These serve as input materials for the least squares fitting coefficients. Simplifying the coefficient calculation process using statistics involves a computationally intensive approach, which directly uses the original data samples to fit the coefficients. This is achieved by pre-calculating statistics (such as Σ temperature, Σ...). Σ(temperature × actual error) can transform complex fitting operations into algebraic calculations based on statistics, significantly reducing the computational load on the microprocessor and improving update efficiency.
[0115] In some embodiments, the residual mean is the average of the differences between the fitted temperature drift error calculated using the updated sub-model coefficients and the actual temperature drift error in the data samples. The calculation formula is: Residual mean = (Σ(Actual temperature drift error - Fitted temperature drift error)) / Sample size, reflecting the accuracy of the updated sub-model. The residual mean is the final criterion for verifying the success of the sub-model update: if the residual mean < a preset condition (e.g., < 0.05mV), it indicates that the accuracy of the updated sub-model meets the standard and can replace the old coefficients; if the residual mean > a preset condition, it indicates that the fitting has failed (e.g., insufficient samples, data anomalies), and it is necessary to re-collect samples or investigate the problem to avoid a decrease in accuracy after the update.
[0116] As one possible implementation, this embodiment of the invention establishes a periodic check-up mechanism for sub-model accuracy by periodically calculating the average temperature drift deviation (the average of the actual temperature drift error and the sub-model prediction error). When the average deviation exceeds a preset threshold, the sub-model accuracy is explicitly determined to be substandard, requiring an update; if it is less than the threshold, the accuracy is considered normal, avoiding compensation failures caused by sub-model failures going unnoticed and ensuring timely detection of accuracy issues. The update logic for linear prediction sub-models and quadratic prediction sub-models is clearly distinguished, and the update efficiency and accuracy of different types of sub-models are optimized accordingly.
[0117] Optionally, the temperature drift compensation method of the present invention further includes steps A51-A53.
[0118] A51: Calculate the rate of change of ambient temperature based on the ambient temperature obtained from the Hall current sensor in real time.
[0119] A52: If the rate of change of ambient temperature is less than the preset rate of change threshold, the ambient temperature is sampled at the first preset sampling frequency.
[0120] A53: If the rate of change of ambient temperature is greater than or equal to the preset rate of change threshold, the ambient temperature is sampled at the second preset sampling frequency, and the first preset sampling frequency is lower than the second preset sampling frequency.
[0121] In some embodiments, the rate of change of ambient temperature is the amount of change in ambient temperature at the location of the Hall current sensor per unit time. The calculation formula is: rate of change of ambient temperature = (current ambient temperature - previous ambient temperature) / time interval between two samplings, which is used to quantify the speed of temperature change.
[0122] In some embodiments, the preset rate of change threshold is a pre-set critical value used to distinguish between stable ambient temperature and rapid changes in ambient temperature, and is a quantitative standard for triggering sampling frequency switching.
[0123] In some embodiments, the first preset sampling frequency is a pre-set low sampling frequency for stable ambient temperature conditions, and its frequency is lower than the second preset sampling frequency.
[0124] In some embodiments, the second preset sampling frequency is a pre-set high sampling frequency for operating conditions with rapidly changing ambient temperature, and its frequency is higher than the first preset sampling frequency.
[0125] As one possible implementation, embodiments of the present invention can dynamically adjust the temperature sampling frequency to balance system resource consumption and power consumption while ensuring the accuracy of temperature drift compensation, thus avoiding resource waste or insufficient accuracy caused by one-size-fits-all sampling.
[0126] Optionally, steps A61-A62 may be included after step 102.
[0127] A61: Obtain the cumulative effective power-on time of the Hall current sensor.
[0128] A62: If the cumulative power-on time exceeds the preset time, the temperature drift attenuation coefficient is queried based on the time, and the temperature drift error parameter is corrected to obtain the corrected temperature drift error parameter.
[0129] In some embodiments, the cumulative effective power-on time is the total time that the Hall current sensor is actually in a powered-on working state during its life cycle (excluding invalid power-on time during power outages, standby, or when no measured current is connected), for example, a sensor with a cumulative effective power-on time of 1000 hours. The cumulative effective power-on time serves as a core criterion for determining whether the sensor's temperature drift pattern has changed due to aging. The core components of the Hall current sensor (such as the Hall chip and internal amplification circuit) will slowly age with increasing power-on time, causing a slight shift in its temperature drift characteristics (i.e., temperature drift decay). The longer the cumulative effective power-on time, the more obvious the aging may be, and the greater the deviation between the original temperature drift error parameter and the actual temperature drift. By recording this time, subsequent corrections for temperature drift deviations caused by aging can be triggered.
[0130] In some embodiments, the preset duration is a pre-set critical duration threshold used to trigger the temperature drift attenuation coefficient correction. The unit is consistent with the cumulative effective power-on time (e.g., 500h, 1000h), serving as a quantitative standard for determining whether sensor aging has affected temperature drift accuracy. The preset duration provides a clear trigger condition for whether to initiate temperature drift correction. If the cumulative effective power-on time is less than the preset duration, it is determined that the sensor aging is minor, and the original temperature drift error parameters still meet the accuracy requirements, requiring no correction. If the cumulative effective power-on time is greater than or equal to the preset duration, it is determined that sensor aging has caused a deviation in the temperature drift pattern, and the temperature drift attenuation coefficient needs to be used to correct the original error parameters to avoid a decrease in compensation accuracy due to aging.
[0131] In some embodiments, the temperature drift attenuation coefficient is a pre-set correction coefficient (usually a decimal or ratio greater than 0, such as 1.02 or 1.05) for the temperature drift aging deviation corresponding to different cumulative effective power-on times of the sensor. Its value is positively correlated with the cumulative effective power-on time; the longer the time, the closer the coefficient is to the value that can offset the aging deviation. For example, the coefficient is 1.02 when powered on for 1000 hours and 1.05 when powered on for 2000 hours. The temperature drift attenuation coefficient accurately corrects the temperature drift error deviation caused by sensor aging: the original temperature drift error parameter is calculated based on the temperature drift law of the sensor in its new state. After aging, the actual temperature drift will be larger or smaller than the original parameter (e.g., the original parameter is +2.1mV, but the actual value becomes +2.142mV due to aging). By calculating the corrected temperature drift error parameter = original temperature drift error parameter × temperature drift attenuation coefficient, the error parameter can be rematched with the actual temperature drift law after aging, restoring the compensation accuracy.
[0132] As one possible implementation, the embodiments of the present invention can solve the problem that the accuracy of the original temperature drift error parameters of the Hall current sensor decreases due to aging after long-term use, and further extend the high-precision validity period of the compensation system.
[0133] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0134] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.
[0135] Figure 2 A schematic diagram of the temperature drift compensation device for a Hall current sensor provided in an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown, and are described in detail below: like Figure 2 As shown, the temperature drift compensation device 2 of the Hall current sensor includes: Communication module 21 is used to acquire ambient temperature data from Hall current sensor using temperature sensor; The processing module 22 is used by the microprocessor to calculate the temperature drift error parameter corresponding to the current ambient temperature data based on the ambient temperature data and the temperature drift prediction model; the compensation signal generation module generates a corresponding compensation signal based on the temperature drift error parameter, the compensation signal and the temperature drift error characterized by the temperature drift error parameter are equal in magnitude and opposite in direction; the compensation signal and the original sampling signal of the Hall current sensor are superimposed through the differential amplifier circuit to obtain the final current signal.
[0136] Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. For example... Figure 3 As shown, the electronic device 3 of this embodiment includes a processor 30 and a memory 31. The memory 31 stores a computer program 32. When the processor 30 executes the computer program 32, it implements the steps in the various method embodiments described above. Alternatively, when the processor 30 executes the computer program 32, it implements the functions of each module / unit in the various device embodiments described above.
[0137] For example, computer program 32 may be divided into one or more modules / units, which are stored in memory 31 and executed by processor 30 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 32 in electronic device 3.
[0138] Electronic device 3 may include, but is not limited to, processor 30 and memory 31. Those skilled in the art will understand that... Figure 3 This is merely an example of electronic device 3 and does not constitute a limitation on electronic device 3. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device 3 may also include input / output devices, network access devices, buses, etc.
[0139] For the sake of simplicity and clarity, only the above-described functional modules / units are used as examples. In practical applications, the functions described above can be assigned to different functional modules / units as needed. These modules / units can be implemented in hardware, software, or a combination of both.
[0140] In the above embodiments, the descriptions of each embodiment have their own emphasis. Parts not detailed or described in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Unless otherwise specified or in conflict with logic, the terminology and / or descriptions between different embodiments are consistent and can be referenced interchangeably. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.
[0141] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A temperature drift compensation method of a Hall current sensor, characterized by, The application is applied to a temperature drift compensation system, and the temperature drift compensation system comprises a temperature sensor, a microprocessor, a temperature drift prediction model, a compensation signal generation module and a differential amplification circuit. The temperature drift compensation method comprises the following steps: The temperature sensor is used to obtain the ambient temperature data of the Hall current sensor; The microprocessor calculates the temperature drift error parameter corresponding to the current ambient temperature data based on the ambient temperature data and the temperature drift prediction model; The compensation signal generation module generates a corresponding compensation signal based on the temperature drift error parameter. The compensation signal is equal in size and opposite in direction to the temperature drift error parameter. The differential amplification circuit is used to superimpose the compensation signal and the original sampling signal of the Hall current sensor to obtain the final current signal.
2. The method of claim 1, wherein the Hall current sensor is a Hall effect current sensor. The temperature drift prediction model comprises a plurality of prediction sub-models, each prediction sub-model corresponds to a preset temperature range interval, and the temperature range interval is divided according to the characteristics of temperature drift at different temperature ranges. The microprocessor calculates the temperature drift error parameter corresponding to the current ambient temperature data based on the ambient temperature data and the temperature drift prediction model, which comprises the following steps: Based on the ambient temperature data and the preset temperature range interval, the temperature range interval corresponding to the current ambient temperature is determined; Based on the ambient temperature data and the prediction sub-model corresponding to the temperature range interval, a theoretical temperature drift error value is calculated; Based on the current original output voltage of the Hall current sensor and the theoretical output voltage corresponding to the current actual current, a real-time temperature drift error value is calculated; The theoretical temperature drift error value and the real-time temperature drift error value are weighted and summed to calculate the temperature drift error parameter.
3. The method of claim 2, wherein the Hall current sensor is a Hall effect current sensor. The calculation of the temperature drift error parameter by weighting and summing the theoretical temperature drift error value and the real-time temperature drift error value comprises the following steps: Based on the real-time ambient temperature of the Hall current sensor, the change rate of the ambient temperature is calculated; Based on the input current of the Hall current sensor, the change rate of the input current of the Hall current sensor is calculated; If the change rate of the ambient temperature is less than the preset temperature change rate threshold, and the change rate of the input current of the Hall current sensor is less than the preset current change rate threshold, the weight of the theoretical temperature drift error value is a first preset theoretical weight, and the weight of the real-time temperature drift error value is a first preset real-time weight; If the change rate of the ambient temperature is greater than or equal to the preset temperature change rate threshold, or the change rate of the input current of the Hall current sensor is greater than or equal to the preset current change rate threshold, the weight of the theoretical temperature drift error value is a second preset theoretical weight, and the weight of the real-time temperature drift error value is a second preset real-time weight. The first preset theoretical weight is greater than the second preset theoretical weight, and the first preset real-time weight is less than the second preset real-time weight.
4. The method of claim 2, wherein the Hall current sensor is a Hall effect current sensor. The calculation of the theoretical temperature drift error value based on the ambient temperature data and the prediction sub-model corresponding to the temperature range interval comprises the following steps: If the ambient temperature data is within the interval boundary threshold range of the temperature range interval, a first temperature drift error parameter is calculated based on the ambient temperature data and the prediction sub-model corresponding to the temperature range interval; A second temperature drift error parameter is calculated based on the ambient temperature data and the adjacent prediction sub-model close to the ambient temperature data. The theoretical temperature drift error value is obtained by weighted summation of the first temperature drift error parameter and the second temperature drift error parameter.
5. The method of claim 4, wherein the temperature drift compensation of the Hall current sensor is performed by a microcontroller. The theoretical temperature drift error value is obtained by weighted summation of the first temperature drift error parameter and the second temperature drift error parameter, including: Based on the environmental temperature data, the index of the corresponding prediction sub-model is determined through hash table matching; the key of the hash table is the upper limit and the lower limit of the temperature interval, and the value of the hash table includes the index of the prediction sub-model, the pre-stored basic parameter and the boundary weight of the adjacent prediction sub-model; The theoretical temperature drift error value is calculated based on the first temperature drift error parameter, the second temperature drift error parameter and the boundary weight of the adjacent two prediction sub-models.
6. The method of claim 2, wherein the Hall current sensor is a Hall effect current sensor. The type of the prediction sub-model includes a linear prediction sub-model and a quadratic prediction sub-model; The temperature drift compensation method further includes: The microprocessor periodically calculates a temperature drift deviation mean value based on an actual temperature drift error and a temperature drift error predicted by the prediction sub-model; If the temperature drift deviation mean value is greater than a preset deviation threshold, a data set is constructed based on data samples corresponding to the temperature interval; the data samples include data pairs of environmental temperature and actual temperature drift error; Based on the type of the prediction sub-model and the data set, a statistic is calculated; the statistic includes a total number of samples, a sum of environmental temperature, a sum of squares of environmental temperature, a sum of cubes of environmental temperature, a sum of fourth powers of environmental temperature, a sum of actual temperature drift error, a sum of products of environmental temperature and actual temperature drift error, and a sum of products of squares of environmental temperature and actual temperature drift error; If the prediction sub-model is a linear prediction sub-model, a first coefficient is calculated based on the statistic and a least square method formula; If the prediction sub-model is a quadratic prediction sub-model, a least square method equation set is constructed based on the statistic, and a second coefficient is calculated by matrix inversion method; A fitting value is generated based on the first coefficient or the second coefficient, and a residual mean value of the fitting value and the actual error is calculated; If the residual mean value meets a preset condition, the first coefficient or the second coefficient is taken as a coefficient of the prediction sub-model to update the prediction sub-model.
7. The method of claim 1, wherein the Hall current sensor is a Hall effect current sensor. The temperature drift compensation method further includes: Based on the real-time acquired environmental temperature of the Hall current sensor, a change rate of the environmental temperature is calculated; If the change rate of the environmental temperature is less than a preset change rate threshold, the environmental temperature is sampled at a first preset sampling frequency; If the change rate of the environmental temperature is greater than or equal to the preset change rate threshold, the environmental temperature is sampled at a second preset sampling frequency, and the first preset sampling frequency is lower than the second preset sampling frequency.
8. The method of claim 1, wherein the Hall current sensor is a Hall effect current sensor. The compensation signal and the original sampling signal of the Hall current sensor are superimposed through the differential amplification circuit to obtain a final current signal, including: Based on the compensation signal and the original sampling signal of the Hall current sensor, differential operation is performed through an operational amplifier and a symmetric resistance network in the differential amplification circuit to extract an initial effective signal without temperature drift; Based on the feedback resistance of the differential amplification circuit, the amplitude of the initial effective signal is adjusted to obtain the final current signal.
9. A temperature drift compensation device for a Hall current sensor, characterized by It includes: The communication module is configured to acquire environmental temperature data of the Hall current sensor by using a temperature sensor; The processing module is used for calculating a temperature drift error parameter corresponding to the current environmental temperature data based on the environmental temperature data and the temperature drift prediction model by the microprocessor; The compensation signal generation module generates a corresponding compensation signal based on the temperature drift error parameter, and the compensation signal is equal in size and opposite in direction to the temperature drift error represented by the temperature drift error parameter. The compensation signal and the original sampling signal of the Hall current sensor are superimposed through the differential amplification circuit to obtain the final current signal.
10. An electronic device, comprising: A computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 8.
Citation Information
Cited By
Planetary roller screw linear module operation characteristic analysis method and system
CN122065279A