A1340, A1341, and A1343 Sensor Temperature Compensation
A1340, A1341, and A1343 Sensor Temperature Compensation
By Nevenka Kozomora and Jesse Lapomardo,
Allegro MicroSystems, LLC
Introduction
Sensor output can change over temperature due to sensor imperfections or temperaturedependent properties of the magnetic system. The purpose of applying temperature compensation inside the sensor is to keep the sensor output value independent of the temperature and only dependent on the input magnetic field strength.
Implementation
Allegro sensors allow the customer to change how the sensor responds to temperature deviations through the use of sensor temperature compensation coefficients. These coefficients are part of the sensor temperature algorithm implemented in the Temperature Compensation Block shown in Figure 1.
The transfer function of the temperature compensation block is given as the following equation:
V_{OUT} (V) = SENS(ΔT_{A}) × V_{IN} (V) + OFFSET(ΔT_{A}) (1)
where T_{A} is ambient temperature, and ΔT_{A}= T_{A} – 25°C.
The Sensitivity Temperature Compensation, labeled as SENS(ΔTA), is used to manipulate the effect of temperature on the gain that the sensor applies on the input magnetic signal.The Sensitivity Temperature Compensation is described as a polynomial function of second order:
SENS(ΔT_{A}) =
[TC1_SENS (m%/°C) × ΔT_{A} (°C) +
TC2_SENS (m%/°C2) × (ΔT_{A})^{2} (°C) + 1 ] (2)
where SENS(ΔT_{A}) at some temperature T is actually calculated as:
(SENS at 25°C) / (Recorded SENS @ T°C) (3)
The userprogrammable parameters are described in the following table:
Table 1: Input Variables of Sensitivity CompensationParameter  Definition  Unit 
TC1_SENS  Firstorder gain temperature coefficient. Coefficient applied to the first order term of the sensitivity change over temperature. 
m%/°C 
TC2_SENS  Secondorder gain temperature coefficient. Coefficient applied to the second order term of the sensitivity change over temperature. 
m%/°C^{2} 
Applying Compensation Coefficients, TC1_SENS and TC2_SENS, as calculated will result in a temperatureindependent gain applied to the sensor’s input signal. It is important to keep in mind that there two sets of these parameters—one to compensate for temperatures below 25°C and one for temperatures above 25°C.
The Offset Temperature Compensation, labeled as OFFSET(ΔTA), is used to change the temperature behavior of the offset that the sensor applies on the input magnetic signal. The equation for OFFSET(ΔTA) is described as a linear firstorder function:
OFFSET(ΔTA) =
TC1_OFFSET (mG/°C)× ΔT_{A} (°C) ×
DIV_SENS_COARSE (mV/G) (4)
where OFFSET(ΔT_{A}) at some temperature T is actually calculated as:
OFFSET(ΔT_{A}) = (OFFSET @ 25°C) –
(Recorded OFFSET @ T°C) (5)
Applying the coefficient TC1_OFFSET as calculated would result in temperatureindependent offset behavior.
In the case of the A1343 device, parameter DIV_SENS_COARSE is not applicable since the temperature compensation algorithm is not accounting for this parameter.
Table 2: Input Variables of Offset Compensation
Parameter  Definition  Unit 
TC1_OFFSET  Firstorder offset temperature coefficient. Coefficient applied to the firstorder term of the offset change over temperature.  mG/°C 
DIV_SENS_COARSE  Offset Compensation coefficient for different magnetic ranges. It changes respectively to the change of magnetic field. It is equal to 1 for value of ±500 G. For example if field range changed to ±300 G, coefficient value will be 3/5.  mV/G 
Calculating Sensitivity Compensation
Allegro sensors are often used with permanent magnets of unknown field strength at the specific operating positions. Therefore exact calculation of the system Sensitivity per gauss is impossible. However, Sensitivity can be calculated with respect to device position.
In the example below, the user collects device output at two different points in the movement range. Position 1 is at –10 degrees and Position 2 is at +10 degrees.
Table 3: Example of Device Output
Temperature (°C) 
Sensor with Analog Output  Sensor with PWM Output  Sensor with SENT Output  
Sensor Output @ Position 1 (V) 
Sensor Output @ Position 2 (V) 
Sensor Output @ Position 1 (%D) 
Sensor Output @ Position 2 (%D) 
Sensor Output @ Position 1 (LSB) 
Sensor Output @ Position 2 (LSB) 

–40  0.354  4.548  8.0  91.9  139  3955 
–20  0.394  4.532  8.6  91.3  165  3929 
0  0.435  4.514  9.2  90.8  191  3902 
25  0.500  4.501  10  90  227  3867 
50  0.546  4.481  10.7  89.4  257  3837 
75  0.614  4.459  11.6  88.5  298  3796 
100  0.693  4.427  12.7  87.4  349  3746 
125  0.790  4.393  14.1  86.1  408  3686 
150  0.883  4.342  15.5  84.7  474  3621 
The Sensitivity throughout the temperature range can be calculated as:
SENS = (V_{OUT} @ Position 2 – V_{OUT} @ Position 1)
/ (Position 2 – Position 1) (6)
Table 4
Temperature (°C) 
Sensitivity (V/°C) 
Sensitivity (%D/°C) 
Sensitivity (LSB/°C) 
–40 
0.210  4.19  190.78 
– 20  0.207  4.14  188.23 
0  0.204  4.08  185.55 
25  0.200  4  182.00 
50  0.197  3.93  179.00 
75  0.192  3.84  174.90 
100  0.187  3.73  169.85 
125  0.180  3.60  163.90 
150  0.173  3.46  157.35 
In order to calculate the compensation function SENS(ΔT_{A}) versus ΔT_{A} values, apply equation 3 on the recorded data in Table 4. The equation effectively performs an inverted normalization with respect to 25°C. The resulting data is presented in the table below (note that the temperature values now appear as ΔT_{A} values, representing deviation from 25°C):
Table 5: Normalized Inverse Sensitivity vs. Temperature
ΔTA (°C) 
Normalized Inverse Sensitivity 

(cold)  –65  0.954 
–45  0.967  
–25  0.981  
0  1.000  
(hot)  25  1.017 
50  1.041 

75  1.072  
100  1.110  
125  1.157 
The graphical representation of Table 5 is given in Figure 3:
Since Allegro sensors have different temperature coefficient codes for compensation at hot and cold temperatures, the above curve is divided into two regions. The hot region, from ΔT_{A} of 0°C and above, is described with the following equation: SENS(ΔT_{A}) = 1.408E06x^{2} + 7.994E04x + 1.000. The cold region, below ΔT_{A} of 0°C on the xaxis, is governed by the equation: SENS(ΔT_{A}) = 5.941E06x^{2} + 5.094E04x + 1.000.
The programmable coefficients can now be calculated from the above equations. Note that to convert to m%, a factor of 105 should be introduced.
Table 6: Calculated Temperature Compensation Coefficients
Coefficients Hot 
Value  Coefficients Cold 
Value 
TC1_SENS_HOT (m%/°C) 
79.94  TC1_SENS_CLD (m%/°C) 
50.94 
TC2_SENS_HOT (m%/°C2) 
0.1408  TC2_SENS_CLD (m%/°C2) 
0.5941 
Programming Sensitivity Coefficients
Calculated values for the temperature adjustment can be entered in the software directly under the “Value” column, or the user can calculate the code manually and enter it under the “Code” column.
If the user enters the desired coefficient under the “Value” column, then the software will round the actual number to the closest discrete value offered in the device. For example, TC2_SENS_CLD is calculated as 0.5941 m%/°C2, but the program rounded to the 0.593 m%/°C2. The software automatically calculates the code based on the TC2_SENS_CLD value, the step size of that register, and also the transfer function between the value and the code.
In the case that the user would like to calculate the necessary codes, the table below, extracted from the datasheet, can be used as a guideline. The needed value of 0.5941 m%/°C2 would be divided by 0.00596 m%/°C^{2}, the typical step size, to get to the needed code of 99.
Calculating Offset Compensation
In the application, linear sensors often see a magnetic field in all positions or often the customer cannot determine in which position the field will be equal to 0. However, reading the device output in two application positions can help to determine the needed sensitivity of the sensor which then helps to calculate the offset as: (VOUT @ Position 2 – Position 2 × Sensitivity). This is shown in Table 7 below:
Table 7: Voltage Offset Over Temperature
Temperature (°C) 
Offset (V) 
Offset (%) 
Offset (LSB) 
–40 
2.45  49.95  2047 
–20  2.46  49.96  2047 
0  2.47  49.97  2047 
25  2.5  50.00  2047 
50  2.51  50.01  2047 
75  2.53  50.04  2047 
100  2.56  50.06  2047 
125  2.6  50.09  2047 
150  2.61  50.11  2047 
Once the offset at each temperature is obtained, the correction curve is calculated using equation 5.
From Figure 7, it can be seen that offset over temperature can be calculated as
OFFSET(ΔT_{A}) = –0.0009 × ΔT_{A} + 0.0004.
The recorded behavior is in mV/°C and represents the formula:
OFFSET(ΔT_{A}) = TC1_OFFSET (mG/°C) × ΔT_{A} (°C)
× DIV_SENS_COARSE (mV/G).
The constant term of 0.0004 is close to zero, so it can be ignored. The function gain of 0.0009 is the product of TC1_OFFSET (mG/°C) × DIV_SENS_COARSE (mV/G), so it is necessary to divide the gain number with DIV_SENS_COARSE (mV/G), which depends on the chosen magnetic coarse range. If the chosen range were 250 G, then the parameter DIV_SENS_COARSE (mV/G) has value of 0.5.
Table 8: Offset Coefficient Value
Offset Coefficient  Value 
TC1_OFFSET (mG/°C) for +/250 G range  0.0009 / 0.5 = –0.002 
Programming Sensitivity Coefficients
Calculated values for the temperature adjustment can be entered in the software directly under the “Value” column, or the user can calculate the code manually and enter it under the “Code” column.
In the case that the user would like to calculate the necessary codes, the table below, extracted from the datasheet, can be used as a guideline