- Version
- 1.0.1
Introduction
This library is intended to help out hardware and software engineers, system integrators and developers with the process of calibrating analog angle sensors. An analog angle sensor does not provide any angle value, only analog sine and cosine (positive and negative) output signals. The angle has to be calculated externally.
Analog angle sensors have to be calibrated before they are used in order to achieve the specified angle accuracy. This calibration process includes a compensation of offset, amplitude and non-orthogonality of the output channels in use with the help of an external microcontroller. Calibration can be done in a one time fashion at the start-up of the system for example, or in a continuous matter (dynamic calibration). This library and the examples given talk about the one-time calibration however the functions could be easily extended to support continuous calibration.
- Copyright
- Copyright (C) 2017 Infineon Technologies AG. All rights reserved.
- Attention
- Infineon Technologies AG (INFINEON) is supplying this file for use exclusively with Infineon's products. This file can be freely distributed within development tools and software supporting such microcontroller products.
THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, ASPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
- Warning
- It is in the responsibility of the system integrator to insure that:
- the magnet is large enough to ensure that the non-homogeneity of the magnetic field in the sensing area is negligible.
-
- the mechanical tolerances of the sensor-magnet assembly are minimal.
-
- the output amplitude together with the resolution of the ADC in use matches the requirement in angle accuracy.
- See also
- https://www.infineon.com/dgdl/Infineon-TLE5xxx(D)_Calibration_360_AN-v02_00-AN-v02_00-EN.pdf?fileId=5546d46264a8de7e0164f09d8bfa228d
Usage
- Note
- This library assumes that you have connected the analog angle sensor to an ADC and you can easily get the SINP, COSP, SINN, COSN digitized values.
The one time calibration process requires you to:
- turn the magnetic field 360 deg in one direction while acquiring SIN & COS data
- turn the magnetif field 360 deg in the opposite direction while aquiring SIN & COS data
- afterward the firmware library will compute:
- amplitude & offset correction values for left turn
- amplitude & offset correction values for right turn
- mean amplitude & offset values
If your application is subjected to temperature variations you should perform dynamic/continuous calibration as the one time calibration can help reduce only the temperature independent offset.
- Note
- Because the calibration process is quite intensive computationally the system integrator should use either a microcontroller with an FPU or a dedicated math coprocessor/hardware CORDIC.
Example
Code Example 1:
uint32_t sinP_in_LSB = 0;
uint32_t cosP_in_LSB = 0;
uint32_t sinN_in_LSB = 0;
uint32_t cosN_in_LSB = 0;
int main(void)
{
while(1U)
{
sinP_in_LSB = AnalogRead(ch0);
cosP_in_LSB = AnalogRead(ch1);
sinN_in_LSB = AnalogRead(ch2);
cosN_in_LSB = AnalogRead(ch3);
}
sinP_in_LSB = AnalogRead(ch0);
cosP_in_LSB = AnalogRead(ch1);
sinN_in_LSB = AnalogRead(ch2);
cosN_in_LSB = AnalogRead(ch3);
}
}
}
}
Example 2
Code Example 2:
float64_t differential_uncalibrated_angle_read = 0;
uint32_t sinP_in_LSB = 0;
uint32_t cosP_in_LSB = 0;
uint32_t sinN_in_LSB = 0;
uint32_t cosN_in_LSB = 0;
int main(void)
{
while(1U)
{
sinP_in_LSB = AnalogRead(ch0);
cosP_in_LSB = AnalogRead(ch1);
sinN_in_LSB = AnalogRead(ch2);
cosN_in_LSB = AnalogRead(ch3);
}
}
Other considerations
- See also
- https://www.infineon.com/dgdl/Infineon-TLE5xxx(D)_Calibration_360_AN-v02_00-AN-v02_00-EN.pdf?fileId=5546d46264a8de7e0164f09d8bfa228d