Lightweight Thermal Compensation Technique for MEMS Capacitive Accelerometer Oriented to Quasi-Static Measurements

The application of MEMS capacitive accelerometers is limited by its thermal dependence, and each accelerometer must be individually calibrated to improve its performance. In this work, a light calibration method based on theoretical studies is proposed to obtain two characteristic parameters of the sensor’s operation: the temperature drift of bias and the temperature drift of scale factor. This method requires less data to obtain the characteristic parameters, allowing a faster calibration. Furthermore, using an equation with fewer parameters reduces the computational cost of compensation. After studying six accelerometers, model LIS3DSH, their characteristic parameters are obtained in a temperature range between 15 °C and 55 °C. It is observed that the Temperature Drift of Bias (TDB) is the parameter with the greatest influence on thermal drift, reaching 1.3 mg/°C. The Temperature Drift of Scale Factor (TDSF) is always negative and ranges between 0 and −400 ppm/°C. With these parameters, the thermal drifts are compensated in tests with 20 °C of thermal variation. An average improvement of 47% was observed. In the axes where the thermal drift was greater than 1 mg/°C, the improvement was greater than 80%. Other sensor behaviors have also been analyzed, such as temporal drift (up to 1 mg/h for three hours) and self-heating (2–3 °C in the first hours with the corresponding drift). Thermal compensation has been found to reduce the effect of the latter in the first hours after power-up of the sensor by 43%.


Introduction
Micro-electromechanical systems (MEMS) [1] have multiple advantages over traditional technology. Their small size, low cost, and low power consumption have promoted their use in smartphones. And the expansion of smartphones and tablets has contributed greatly to the improvement of MEMS technology and sensors. The MEMS accelerometer of smartphones can be used in multiple applications, such as user transportation means detection [2], pedestrian recognition [3], or structural integrity monitoring [4].
However, one major disadvantage of MEMS capacitive accelerometers is their temperature dependence. This effect, although small compared to some other technologies, reduces the viability of MEMS accelerometers in medium to high precision applications where thermal variations are expected. Thermal stresses can temporarily or permanently alter the behavior of the units [11]. These alterations are not deterministic; different units of the same model exposed to the same processes exhibit different thermal sensitivities [12].
Multiple ways have been proposed to improve the thermal behavior of MEMS accelerometers. Some studies propose alternative design techniques of the internal structures [13][14][15][16][17]. Other studies reduce the thermal drift by compensating its effects on the resonant circuits [18], implementing sub-circuits [19], implementing application specific integrated circuit [20], taking advantage of the capacitor parasitic resistance [21], or isolating them in a micro oven-control system with controlled temperature [22]. These techniques are used to improve the technology capabilities, but, to improve the performance of an accelerometer in application, other techniques are required.
Some software techniques have been proposed to obtain thermal compensation parameters for the accelerometers [23,24]. These techniques are based on a polynomial equation in which the parameters are obtained with regression methods. To ensure the accuracy of the parameters, the tests must be performed for each working temperature and inclination. Alternative methods consists of using neural networks to predict and compensate the thermal behavior [25]. In both methods, the calibration process for each DUT (Device Under Test) is time consuming and hard to compute, increasing with each degree of the polynomial model or with each neuron added. Generally, external hardware and software must be used to achieve calibration. This can increase significantly the cost, as the calibration must be performed individually.
Many modern MEMS accelerometers and IMUs integrate a temperature sensor. Some of the more advance series, like the ADIS series by Analog Devices, also include the compensation techniques and are individually factory calibrated. This greatly improves its performance, but also the cost.
The objective of this paper is to research a lightweight and fast method to achieve the thermal characterization and compensation of MEMS accelerometers, and test its performance. This work proposes a straightforward model according to theoretical analysis of MEMS capacitive accelerometers [26]. The proposed model contains only two characteristic parameters for every axis. Both parameters are directly related to the accelerometers thermal behavior: the Temperature Drift of Bias (TDB) and the Temperature Drift of Scale Factor (TDSF). This method does not require a polynomial regression, reducing the amount of data and time required to obtain the compensation parameters.

Working Principle
Capacitive accelerometers rely on a change in electrical capacitance in response to acceleration. They utilize the properties of opposed plate capacitors. One plate of each capacitor is fixed, and the other is attached to a seismic mass between springs [27]. Multiple pairs of capacitors are used with the same seismic mass, as shown in Figure 1. Any external acceleration displaces the seismic mass, modifying the distance between the capacitors plates, and, therefore, their capacitance. The difference between the values of opposing capacitors varies proportionally to the applied acceleration. Both capacitances can be measured with voltage pulses [11].
The micromechanical structure is made of silicon. Silicon is a temperature-sensitive material and its physical characteristics vary greatly with temperature. Specific structural designs can reduce this temperature dependence [17]. Two single-axis structures can be arranged perpendicular to each other on the same plane creating a biaxial MEMS accelerometer. To allow for the third sensitive axis, another sensing technique has to be used. There are multiple ways to allow this perpendicular axis sensitivity, for example, the torsional springs technique [27]. This way a triaxial accelerometer can be fabricated in one plane. However, this third axis usually suffers from lower sensitivity, higher thermal drifts and, in general, worse performance.
MEMS capacitive accelerometers are very sensitive to soldering processes. Thermal stresses and dilatations can induce permanent mechanical stresses in the interior of the MEMS. Externally, uneven cooling of the solder tin can also induce mechanical stresses.
Both of these effects permanently affect the Zero-g level of the sensor. Therefore, it is necessary to calibrate the devices after the soldering process.

Triaxial Accelerometer Calibration
The design of a triaxial accelerometer consists of three orthogonally arranged single axis sensors. Manufacturing inaccuracies cause misalignment between the sensitive axes and the accelerometers body. Furthermore, the sensitive axes are not orthogonal and cross sensitivities appear. Compensating for these effects is especially important to achieve reliable tilt measurements. It is also necessary to calibrate the individual sensitivity and bias for each axis. The output of a triaxial accelerometer can be represented as Equation (1).
where X 0 , Y 0 , and Z 0 are the accelerometer measurements; X, Y, and Z are the ideal accelerations on the orthogonal axis; S X , S Y , and S Z are the scale factor of the accelerometer axes; b X , b Y , and b Z are the bias of the axes; and A XX , A YX , A ZX , A XY , A YY , A ZY , A XZ , A YZ , and A ZZ are the transformation parameters that relate the orientation of the sensitive axes to the orthogonal axes of the body [28]. Multiple algorithms can be used to obtain the calibration parameters [29,30]. A simple method consists of using the six positions where an axis is perpendicular to the earth plane. After obtaining all the data, the factors are obtained with the least square method.
Temperature affects each sensitive axis individually, so they must be analyzed separately, without mutually affecting each other due to mechanical calibration. Once the thermal drift is compensated, the misalignment, bias and sensitivity calibration will be performed to obtain reliable measurements of inclination.

Tilt Measurement Techniques for Accelerometers
Measurement of tilt using accelerometers takes advantage of the constant gravity vector. Each axis measurement (g x , g y , and g z ) represents the projection of the gravity vector on that axis (see Figure 2) [31]. With them, it is possible to determine the Euler pitch, α, and roll, β, angles. Depending on the number of axes and mathematical formula used to compute the angles, the measurement range, sensor sensitivity, and alignment dependence may change [32]. With three orthogonal accelerations, it is possible to compute the Euler angles in different ways. The performance of some of them is greatly affected by the orientation of the sensor [32]. The sensitivity of tilt measurements drops down to zero near ±90 • . Therefore, to obtain the best performance in the maximum range, all three axes have to be taken into account.
The two Euler angles α and β can also be computed if only the acceleration in two axes is available. However, if one of the axis used is close to ±1 g, the accuracy will be reduced. Therefore, the best solution would be to mount both sensitive axes parallel to the ground. This allows the use of Equations (2) and (3) to obtain the Euler angles [33].
These equations could be used assuming that g is exactly 1000 mg, or computing it as the geometric sum of g x , g y , and g z .

Thermal Behavior
Capacitive MEMS accelerometers are sensitive to temperature variations. These variations are produced by both external and internal phenomena; for example, internal electronics produce heat due to ohmic loss. Temperature changes affect the internal structure in multiple ways: changes in the Young's modulus, thermal deformations and thermally induced stresses [34]. Thermal drifts are linked to variations in the stiffness of the beams and springs of the structure, caused by manufacturing imperfections [35].
Other effects, such as imperfections in the soldering process or the different coefficients of thermal expansion between the glass substrate and the silicon structure, can also induce mechanical stresses when subjected to temperature variations.
In working conditions, the thermal behavior of the MEMS accelerometer is characterized by the Temperature Drift of Bias and the Temperature Drift of Scale Factor [17,26,36]. TDB is expressed in mg/ • C, it can greatly affect the output value depending on the temperature, and it is directly proportional to the beam stiffness differences. Since manufacturing imperfections are random, so are the sign and value of the TDB. This randomness requires a specific thermal calibration for each DUT to ensure the best performance.
The TDSF generates a change in the sensitivity of the sensor as a function of temperature. This generates a drift proportional to both the temperature and the raw acceleration of the axis. The TDSF value is expressed in ppm/ • C and is always negative [26], which implies that the sensitivity of the sensor always decreases when the temperature increases.
The data provided by manufacturers shows a similar behavior. In Reference [11], typical "Sensitivity change versus temperature" (TDSF) and "Zero-g level change versus temperature" (TDB) data are provided. By using a reference temperature T R , which the manufacturer sets at 25 • C, the output value of a MEMS accelerometer, X, can be expressed as the real value, X 0 , plus the bias error and the scale factor error, as shown in Equation (4), where T represents the DUTs' temperature.
Thermal Compensation To ensure the best possible performance of the accelerometer, the thermal drift has to be compensated. The most common method is to fit a linear polynomial to the MEMS behavior. Niu et al. [24] proposed a third order polynomial equation (Equation (5)) to achieve the calibration. This equation does not take into account the change in sensitivity with the temperature, since the raw acceleration is not present in the equation. All the parameters of the polynomial models correspond to different orders of TDB. The dispersion between the A1 parameter of the three axes in both studied accelerometers agrees with the randomness of sign and value previously described. The result of this equation is not the compensated value, but the thermal induced error (E) according to the temperature (T). It has to be added, or subtracted, to the measurements to get the compensated acceleration value.
To account for variations in the sensors sensitivity, the raw acceleration has to be included in the thermal compensation technique. This results in a compensation surface with more parameters. Ruzza et al. [23] proposed a second order surface (defined by Equation (6)) to obtain the thermal induced error (E) from the raw acceleration (X) and temperature (T). E(T, X) = p 00 + p 10 T + p 01 X + p 20 T 2 + p 11 T · X + p 02 X 2 .
They generate different surfaces for cooling and heating cycles. This can compensate for the possible hysteresis of the system, but increases the complexity of the technique, since two surfaces are used for each axis, and the temperature gradient must be taken into account before compensation. The two surfaces are not coincident, and it can lead to sudden changes in the output value.
Each coefficient in Equation (6) can be related with a specific characteristic of the system, and compared with the theoretical Equation (4): • p 00 = Bias in LSBs at 0 • C. • p 10 = Data variation proportional to temperature in LSBs/ • C. Same as TDB. This technique can lead directly to the compensated acceleration value, X 0 . For that to happen, p 01 must be close to 1, adding the raw acceleration to the output value.
Ruzza et al. also detected that the thermal drifts in a small population of sensors is random [12]. In all these studies, the Z axis shows a different behavior compared to the X and Y axes. This may be due to the different sensitive axis design mentioned in Section 2.1.
The randomness and magnitude of the thermal drifts requires an individual calibration for each accelerometer. This process can be expensive and time consuming, as each accelerometer has to be analyzed at all temperatures and inclinations, and then the model parameters have to be extracted.
We propose a fast compensation technique based on Equation (4). By using the two most relevant parameters (TDB and TDSF), the computational cost and time required for each DUT can be reduced. Each parameter, if not properly adjusted, can lead to errors. Therefore, fewer compensation parameters can mean a more robust compensation technique, as there are fewer potential sources of error.
This thermal compensation does not have to give the exact acceleration measurement; the objective is to obtain a value that does not depend on temperature. After this, a mechanical calibration is carried out that allows us to obtain reliable measurements of acceleration and inclination.

Methodology
To study the characterization of a MEMS capacitive accelerometer according to Equation (4), it is necessary to analyze its response to temperature variations in multiple orientations. This data can be used to obtain the TDB and TDSF parameters for each DUT and compensate for its thermal drifts. Six accelerometers will be studied simultaneously; in this way, the dispersion between DUTs can be perceived.

The Accelerometer-Device under Test
For this paper, we will use the LIS3DSHTR MEMS accelerometer manufactured by STMicroelectronics [11]. This accelerometer has been chosen for being a low cost model of a company with significant importance in the inertial MEMS market. In addition, its small size and low energy consumption favor its use in IoT systems or in portable devices.
The LIS3DSH is a capacitive three-axis linear accelerometer that has dynamically selectable full scales of ±2 g, ±4 g, ±6 g, ±8 g, and ±16 g. This device also comes with one embedded temperature sensor with an 8 bit resolution. It is factory calibrated to give an output of 1 LSB per • C.
Communication with the LIS3DSH can be done through I2C and SPI serial interfaces. Other typical characteristics of this MEMS accelerometer are shown in Table 1.
Some of these characteristics, such as bias and TDB, can vary depending on multiple factors (PCB mounting, thermal stresses, mechanical stresses). Therefore, the manufacturer does not guarantee typical specifications. This accelerometer has a built-in self-test. This allows the user to unbalance the internal capacitive bridge and simulate an acceleration. In the Z axis, this simulated force is four times bigger than on the X and Y axes. This is an indication that the Z axis has four times lower sensitivity and requires more amplification. It is probably caused by the different mechanical design of the sensitive axis.
In many tilt measurement applications, and especially in monitoring applications, acceleration is not expected to experience rapid variations. Consequently, the accelerometer sampling rate and the antialiasing filter frequency can be set to low values. The working range will not exceed 1g, allowing to achieve a better resolution. The configuration loaded into the DUTs is shown in Table 2. All other configuration registers are not modified.

Hardware-TestBench
All the DUTs will be studied simultaneously to ensure that the temperature stresses are similar across all of them. In this way, the results become easier to compare. All the DUTs are in contact with the same metal plate. The temperature of this plate is changed using four Peltier modules distributed throughout the area. The modules allow to generate stable temperatures from 10 • C to 65 • C. Lower temperatures could be reached, but water might condensate on the pcbs. Temperatures above 65 • C are not recommended to avoid system degradation. Power is delivered to the Peltier modules through an H-Bridge for a better temperature control. The H-Bridge is controlled with an Arduino Nano Board, which has a temperature sensor on the metal plate for a close loop control (see Figure 3). Each DUT includes one LIS3DSH capacitive MEMS Accelerometer and a SAMD21G18 MCU. Five of the DUTs are attached to an identical printed circuit board and have been produced with the same industrial soldering processes, undergoing the same thermal and mechanical stresses (see Figure 4b). The last DUT will be the control DUT, which has not undergone any industrial soldering process. The pads of the control DUT have been carefully soldered to minimize the thermal stress on the package (see Figure 4a). Soldering wire with a melting point of 179 • C and a soldering station with temperature control has been used. The DUTs' temperature was always controlled to ensure that the internal structures suffered no thermal stresses.

Tests Conditions
Before starting the tests with temperature variations, the DUTs are studied in a fixed position and at room temperature for 20 h. This is used to get a cool start and a reference behavior. Some characteristics, such as signal noise, self-heating, or temporary drifts, can be analyzed. The main tests, which will be used for TDB and TDSF, are performed only after the accelerations are stable and no temporary drifts are detected.
The main tests are carried out in six different orientations, shown in Figure 5. It is not necessary for the orientations to be set very precisely, as the actual acceleration value used to subsequently calculate the TDSF will be taken during each test as the acceleration at 25 • C. The TDB only depends on variations, so it is not affected by the actual value of acceleration. These are the minimum number of tests that provide information about the full application range (±1 g) for all three axes.
The temperature profiles during the tests follow the Soak method [24]. This method is based on generating stable temperatures during the tests. Three different temperatures are used during each test. The fast temperature variations can help analyze the response time of the sensor and other effects, such as hysteresis [37]. The time spent in each temperature step must ensure that the entire transient response has been mitigated, and it is set at two hours for each step. Therefore, a full cycle will take eight hours to complete. Three uninterrupted cycles will be logged for each orientation, with a total duration of 24 h for each orientation.
The tests require only three temperature points to allow characterization. This allows the tests to be performed without specialized equipment, such as Peltier modules or thermal chambers. Only one heat source and one cooling source are required. These test conditions are chosen to allow thermal calibration without expensive equipment.
After the six main tests are completed, a verification test is performed. In this case, the temperature profile is triangular with a period of 12 h and an amplitude of 20 • C (from 25 • C to 45 • C). This test is carried out to simulate thermal variations closer to working conditions and to test the compensation performance. It is carried out for three days without interruption.

Signal Processing
The DUTs data are captured at 3.125 Hz, containing information about capture time, X axis raw acceleration (in LSBs), Y axis raw acceleration (in LSBs), Z axis raw acceleration (in LSBs), and temperature (in • C). The temperature is sampled with the LIS3DSH integrated temperature sensor. For a better comprehension of the results and comparison with other works, the acceleration is transformed to be expressed in mg.
The captured data has a large white noise component. Therefore, an exponential filter is used to reduce it (Equation (7)). This filter is chosen over others because of its low computing load. This allows it to be implemented in applications in low cost MCUs or CPUs. Since the data are quasi-static the filtering factor, α, can be set at a low value, increasing the response time. The filtering factor is set at 0.05; therefore, the response time of the filter is 43 samples, equivalent to 13.76 s at 3.125 Hz. Its effect on the signal can be appreciated in Figure 6.
(a) Response to a unitary step input (b) Effect on an acceleration signal Figure 6. Exponential filter behavior.

Results
The graphical representation of the captured data shows many characteristics that need to be further analyzed, such as noise, temperature drifts, temporary drifts, and selfheating. All DUTs, including the control DUT, exhibit similar behavior and characteristics, but to different extents.

Thermal Drift
It is clear that the temperature changes induce large variations in the measured acceleration (see Figure 7). If this effect is left uncompensated, it can lead to large errors. The first test shows that it can be higher than 1 mg/ • C. This means that thermal variations of 10 • C can cause more error than temporary drift or noise, so it is a characteristic that must be compensated for to improve the performance of the sensors. This is especially important in long-term tilt measurement applications, as the temperature changes can lead to errors that can not be compensated for with standard filters. The temperature variations induce immediate acceleration variations, there are no significant delays or response time between both variations. Furthermore, the drifts seem to be proportional to the thermal variations, and no significant hysteresis effect appears.

Self-Heating
During the first moments of the start-up test, the temperatures of all DUTs rise (see Figure 8). This effect is caused by the heat produced in both the external and internal electronic circuits, due to ohmic losses. The temperature increase is up to 2 • C in the control DUT and between 2.5 • C and 3.5 • C in the PCBs (Printed Circuit Boards) on which the DUTs have been placed. This difference is caused by two factors: more heat produced in the PCB DUTs due to the nearby electronics (MCU and power supply), and better heat dissipation of the control DUT, as it is attached directly to a metal plate rather than soldered to a printed circuit board.
The thermal increase is concentrated in the first two or three hours after cool start. After that point, the temperature rises less than 1 • C in ten hours. After the ten-hour mark, the temperature can be considered stable. (The temperature falling at the end of the test is caused by the cooler room temperature during the night.) This initial thermal variation will cause a thermal drift that could be compensated for to improve the system performance during the first hours. Drift produced by this selfheating should be similar to the thermal drift produced by a similar variation in external temperature. Therefore, thermal compensation should also reduce the drift caused by this initial self-heating.
(a) First 5 h of the cool start test.
(b) First 20 h of the cool start test. Figure 8. Temperature variation during the cool start test.

Temporal Drift
During the constant temperature test, the acceleration values of the axes do not remain stable (see Figure 9). The drift during the first hours of the test can be caused by the self-heating effect. However, the remaining drifts after the first hours can not be attributed to thermal drifts because the temperature does not change significantly.
(a) X axes (b) Y Axes (c) Z Axes Figure 9. Acceleration value of the DUTs during the cool start test.
DUTs #2, #4, and #5 modify their behavior in the Z axis between the fifth and tenth hour of the test. This variation does not appear in DUTS #1 or #3. In general, this adds another unreliability factor to the Z axis of the sensor. This effect is also present, although much lower, in the X axis in the same DUTs. The DUTs average and worst temporary drifts for multiple time segments are shown in Table 3.
This drift is unique for each axis and DUT, although they have similar behaviors. The drift is very high in the first two hours of the test, up to 3 mg/h. As self-heating becomes less dominant, the drift progressively reduces, and the average drift after the first ten hours is around 0.13 mg/h. The control DUT has a high drift in the first hour, significantly higher than the average drift. After three hours, this drift is considerably reduced, becoming lower than 0.1 mg/h after ten hours. This may be due to the better thermal conductivity of the control DUT.
The maximum difference error caused by the drift in 20 h is up to 11 mg for the X axis, 9 mg for the Y axis, and 12 mg for the Z axis. The average total drift is between 2 mg and 6 mg for all the DUTs and axes.

System Noise
Even after the filtering process, there is a significant level of noise in all DUTs. This noise makes it difficult to analyze the DUTs' behavior in short times or with little temperature variations. All the data transmissions are digital; therefore, the noise is generated in the accelerometers internal electronics. This noise could be affected by the accelerometer configuration; however, the slowest sample rate-which is the one in use-should be the least noisy. This noise can only be reduced with more restrictive software filters. To analyze the noise levels of the DUTs, the tenth hour of the cool start test is chosen, since it has low drifts (see Table 4). In all six DUTs, the Z axis has a higher noise than the other two axe, typically 1.8 mg against 1.6 mg on the X axis and 1.3 mg on the Y axis. All the DUTs have a maximum noise between 0.95 mg and 2.05 mg.

Analysis
Theoretically the temperature dependent phenomena (Sections 4.1 and 6.2) can be compensated, or at least reduced, by knowing the characteristic parameters TDB and TDSF from Equation (4). To obtain these parameters the most common solution is to use all the available data and fit a polynomial equation with the least squares method. This can be performed by computers with specialized software, but not by low-cost MCUs or CPUs. All sensors and axes must be calibrated individually; therefore, an easier algorithm should be used. By selecting only the relevant data according to the temperature profile, the computing cost can be drastically reduced.
The reference temperature, T R , is the one in which the sensor is considered to have no drift and the value read, X, is the actual value X 0 (see Equation (8)). According to the manufacturer, the sensors are calibrated at 25 • C, so this is taken as the reference temperature.
When the test is performed in a stable position, it is correct to assume that X 0 in each axis is constant. Therefore, the sensitivity component of the thermal drift (TDSF · X 0 ) is also constant. This means that, for each static position, the thermal drift of the sensor is directly proportional to the temperature. A unique thermal drift parameter, TD X 0 , can be obtained for any specific orientation tested (see Equation (9)). And: The thermal drift parameter specific to one orientation, TD X 0 , can be obtained as the ratio between the data variation and the temperature variation 10. These variations are always proportional, since X 0 does not change, and allow any combination of two accelerations and their two respective temperatures to be used to compute TD X 0 .
For each temperature step of each test, one TD X 0 is computed using Equation (11) (see Figure 10), this will reduce the computing load compared to using all the data points. Each temperature step will result in one value of TD X 0 . Finally, all the obtained values for the same axis and test are averaged. If the temperature variations between the steps were too low, the acceleration variations would also be low, and Equation (11) would approximate to 0/0. The noise of both signals would lead to incorrect data that does not represent the sensors behavior. In our case, all the temperature variations exceed 10 • C and are considered reliable.

Temperature Drift of Bias and Temperature Drift of Scale Factor
Once the six TD X 0 for each axis and DUT are known, they can be used to compute TDB and TDSF. The points can be represented as a straight line, where TDB is the bias, and TDSF is the slope (see Figure 11). Both parameters can be obtained with a linear regression. It is also possible to compute the TDB as the average of the TD X 0 when X 0 is approximately 0 mg and TDSF as the slope between the TD X 0 at ±1000 mg. This could lead to even lower computational costs. The TDB sign and values appears to be random, with values up to 1.3 mg/ • C. DUT #1 has the largest temperature drifts, with 1.3 mg/ • C in two axes. DUTs #2 to #5 show lower temperature drifts, with typical values around 0.4 mg/ • C. The control DUT also shows large temperature drifts, up to 1 mg/ • C. All computed TDSF are negative in sign but random in value. The Z axes do not show greater temperature drifts compared to the X axes. The Y axis has lower drifts than the others. The parameters obtained for each axis are shown in Table 5.

Compensation
Once the accelerometers thermal behavior is characterized, it is possible to compensate for thermal drift. The thermal behavior formula (Equation (4)) can be rearranged to obtain the real acceleration from the raw acceleration and the temperature (see Equation (12)).
Data compensation adds noise to the signals by combining acceleration and temperature noise. An exponential filter with α = 0.001-response time on the order of 10 min-is applied to reduce all the noise and better appreciate the effect of compensation, as shown in Figure 12. This can be done in tilt measurement applications, where response time is not a concern.
(a) X axis (b) Y axis (c) Z axis Figure 12. Filtered accelerations of DUT #1 before (in blue) and after (in red) compensation in the verification test.

Thermal Drift
To show the effect of compensation, the verification test will be analyzed before and after compensation. Thermal drift causes variations in the acceleration value; therefore, the compensated data should show lower variations in its value. To quantify the improvement due to compensation, the standard deviation and the maximum error will be used as indicators. These parameters show the data immunity to temperature variations and, therefore, the performance of the compensation technique. The verification test (explained in Section 3.3) is chosen as it has slower temperature variations than the calibration tests, closer to those expected in application. In addition, it has not been used to compute the TDB and TDSF values. The maximum temperature difference during this test was 20 • C; therefore, all the subsequent results are conditioned by this parameter.
The standard deviation, σ, is a measure of the variation or dispersion of a data set. A smaller standard deviation indicates that the values tend to be close to the mean. In our case, it implies that temperature variations do not affect the acceleration value, that is, thermal drift is reduced. Standard deviation for all DUTs is shown in Table 6. The X axes have, when uncompensated, the biggest σ of all three. They have an average value of 2.90 mg and two of the DUTs (including the control DUT) are over 4 mg. After compensating, they become much more stable, with an average σ of 0.80 mg, 72% lower. DUT #2 slightly deteriorates its performance, although it stays at 1.04 mg.
The Y axes show less improvement than the X axes, σ goes from 1.87 mg to 1.34 mg. This represents a 28% improvement. The lower improvement can be related to the al-ready lower σ when uncompensated. None of the DUTs deteriorated their behavior after compensation.
The uncompensated Z axes show a similar drift to the X axes, with an average σ of 2.80 mg. After compensation, it decreases to an average of 1.09 mg, 61% lower. All DUTs, except #2, had an uncompensated σ over 2 mg; no compensated data exceeds that value. Overall, no compensated axis exceeds 2 mg of deviation, and half of them are below 1 mg of σ.
All improvement percentages are computed as the difference between compensated and uncompensated, and divided by the uncompensated value.
The maximum deviation can be obtained as the difference between the higher and the lower values and is related to the maximum expected error. These data are shown in Table 7. In this case, the improvement is slightly lower than that of the standard deviation This can be related to the fact that the maximum error only takes into account the two worst values, while the standard deviation takes into account all the data.
Similar to the standard deviation, the X axis shows the largest average improvement, 61%. The Z axis also shows a great improvement, greater than 50%. The Y axis shows an average improvement of 20%. In all three cases, the average uncompensated maximum deviation was over 10 mg. Compensation reduces this value in the X and Z axes to below 5 mg, and to 8.3 mg in the Y axis.
The best improvement is on the X axis of the control DUT, with an 81% improvement. The only axis that does not reduce its maximum error is the X of DUT #2.

Self-Heating Drift
In some cases, the initial drift caused by the self-heating can also be reduced with this method (see Figure 13). This self-heating drift is most dominant in the first three hours after a cool start, as shown in Section 6.2. The drift during the first 30 min after start is still high in many units and it is not advisable to rely on these measurements.
To determine the compensation performance in the self-heating effect, the average drift between 30 min and three h after the test start is measured in Table 8.
All three axes of the six DUTs reduce their self-heating drift, except for the X axis of the second DUT. That deteriorated drift gets increased to 0.112 mg/h, which is still a low value compared to the others. This deterioration is due to the fact that, in this DUT, thermal drift and temporal drift act in opposite directions, compensating for each other. When self-heating drift is compensated for, the temporal drift remains, and the end result is a drift greater than the original.
The average drift in the X axes is reduced from 0.62 mg/h to 0.281 mg/h, a 54% improvement. In Y, it gets reduced from 0.689 mg/h to 0.512 mg/h, a 25% improvement. And, in the Z axes, it goes from 0.828 mg/h to 0.426 mg/h, a 48% improvement.

Improvement as Inclinometer
To measure the performance of the compensation in a tilt measurement application, the Euler angles-pitch (Equation (2)) and roll (Equation (3))-are computed from both the uncompensated and compensated data (see Figure 14). Before computing the Euler angles, the six DUTs have been calibrated with a six-position static test [28] using a surface plate and an orthogonal cube. This is used to compensate for bias, sensitivities, and misalignments of each axis (Equation (1)), allowing for more reliable tilt measurements. Figure 14 and Tables 9 and 10 show the result of the calculation of the Euler angles before and after the thermal compensation during the verification test. As with acceleration, both standard deviation and maximum error are used as compensation performance indicators.   The average standard deviation without compensation is 0.151 • for pitch and 0.092 • for roll. The worst results before compensation are in the DUT #1 and the control DUT, both in the pitch angle. After compensation, this deviation is reduced to 0.040 • and 0.036 • respectively (85% and 88% improvement). In general, the average standard deviation with compensation is 0.036 • for pitch (76% lower than uncompensated) and 0.059 • for roll (36% lower). The compensated deviation is never greater than 0.06 • for pitch and 0.1 • for roll, bringing the results of the all DUTs closer together. Most of the DUTs with already low standard deviation (lower than 0.1 • ) do not show significant improvement, with two DUTs showing a slight deterioration, although they stay lower than 0.1 • .
The maximum detected deviation exhibits a similar behavior to the standard deviation, with a maximum deviation detected in the pitch of the DUT #1 and the control DUT. Average maximum deviation decreases from 0.592 • to 0.178 • in pitch (70% lower) and from 0.433 • to 0.319 • in roll (26.3% lower). The maximum error after compensation is never greater than 0.3 • for pitch and 0.6 • for roll.

Methods Comparison
The proposed method is considered similar to the surface calibration proposed by Ruzza et al. The main difference between them methods is that, in that case, a generic polynomial equation is used and the calibration parameters are adjusted without taking into account their physical meaning. In our case, a formula derived from the theoretical behavior of the sensor is used. This allows fewer compensation parameters to be used, reducing the amount of information needed to obtain them.
The advantage of using a generic polynomial fit is that it has a greater ability to compensate for behaviors that have not been previously taken into account, as long as they are not of a higher order than the polynomial equation.
The great advantage of the proposed method is the less amount of data necessary to obtain the calibration parameters and a clear relationship of them with a physical characteristic of the sensor. A lower computational cost also facilitates the recalibration of systems even in application.
Since both methods are similar, the parameters of one can be obtained with respect to the other by means of a regression. In Appendix A, the TDB and TDSF corresponding to the calibration surfaces used in Reference [23] have been calculated. The maximum relative error that is committed in each case when making the adjustment has also been calculated.
The surface parameters that cannot be adjusted with the proposed method are those of the second order of both the TDB and TDSF (p 20 and p 02 ). This is the main cause of the residuals when trying to match one method with the other. It can be seen that the greater these parameters are, the greater the maximum error and RMSE are. When these parameters are small, the residuals are reduced, allowing a good fit between both methods. If the behavior of the TDB and TDSF is of the first order, the efficiency of both methods is similar.

Application of the Thermal Calibration Algorithm
As with most calibration methods, using more data produces more reliable results, as noise and other random errors are averaged. It is recommended to use at least six calibration orientations and the full working range of the sensors for best results. It is considered that a viable option would be to perform the thermal calibration simultaneously with the mechanical calibration of the axes (bias, sensitivity, and cross-axis sensitivity).
In theory, with just two samples of TD X 0 (in different orientations), the two calibration parameters (TDB and TDSF) can be obtained. Furthermore, only two temperatures are required in each orientation to obtain the corresponding TD X 0 . Therefore, the fastest theoretical method to obtain the complete thermal calibration of the accelerometer requires only two orientations and two temperature variations (see Appendix B). The effectiveness of this method has not been tested. Any noise or temporary effects could affect the calibration, so it is recommended to use a greater number of points.
The performance of thermal compensation with this method is considered adequate. Considerable improvements are achieved in cases where the thermal drift is higher. This allows the operation of all units after calibration to be more uniform. This is because the greater the thermal drift, the easier it is to isolate and characterize it. If the thermal drift is very small, it mixes with the noise and cannot be compensated for. Therefore, effectively reducing noise in the signal could improve the efficiency of compensation, at the cost of increasing its complexity.

Typical Drifts
The TDB and TDSF data obtained in this work agree with the information provided by the manufacturer and other works. According to the manufacturer, the typical value of TDB is ±0.5 mg/ • C, while the mean of the TDBs obtained in this work is 0.62 mg/ • C. The technical information does not provide any information on the expected range of TDB, which in our case is ±1.3 mg/ • C. The accelerometer tested by Ruzza et al. shows higher values, with a mean value of −1.24 mg/ • C and a maximum of −1.67 mg/ • C (values obtained by adjusting the methods in Appendix A).
In the case of TDSF, the mean values obtained are also close to the change in sensitivity indicated by the manufacturer (100 ppm/ • C). In our case, the average value obtained is −160 ppm/ • C with a maximum value of −398 ppm/ • C. In the case of Ruzza et al., the average value obtained is −113 ppm/ • C with a maximum of −191 ppm/ • C. All the values obtained are negative, as indicated by theoretical studies. This means that the sensitivity always decreases when the temperature increases.
Furthermore, it can be observed that the drifts in the X axis are greater than in the Y axis both in this work and in that of Ruzza et al. [12]. This difference is quite remarkable in both studies, although the design of the two sensitive axes should be similar.
The control DUT has shown a similar level of thermal drift as the other units. This suggests that most of the thermal drift is due to internal factors (changes in stiffness) rather than factors related to the soldering process and possible surface tensions of the PCB.

Self-Heating
The initial drift has been reduced between 25% and 48%. Part of this drift is due to selfheating and part is due to the temporal drift, which cannot be eliminated by this method.
This improvement can be especially relevant for IoT devices to minimize the energy consumption. The self-heating drift compensation can lead to more reliable results after the systems wake up. If the MCU requires less time to achieve the same results, the energy consumption will be reduced accordingly.

Computing Time
The performance of the implementation of the proposed method can be compared with other techniques that also rely on polynomial equations. The computing time of three compensation algorithms in two different MCU are shown in Table 11. In these low-cost MCUs, the time required for each method is on the order of tens of microseconds. The proposed method and the third order curve take a similar time to compute: 65.6 µs (Proposed Method) against 63.7 µs (Third Order Curve) in the AT-mega328P and 27.7 µ against 34.1 µs in the SAMD21G18A. The second order surface takes approximately 78% more time to compute compared to the proposed method. This could be caused by the higher number of operations that have to be carried out.
In general, the proposed equation requires less computation time than high-degree polynomials, making it more suitable for low cost, low power, or time critical applications.

Conclusions
The thermal characteristic parameters, Temperature Drift of Bias and Temperature Drift of Scale Factor, are random in value and TDB also in sign, and can greatly affect the MEMS measurements when the temperature changes. Therefore, individualized calibration is essential for applications with thermal variations. This behavior is shown even before the soldering processes. According to the manufacturer, this process can also affect the calibration; therefore, the individual calibration must be carried out after the soldering process.
The proposed calibration method-relying on individual temperature drift coefficients for specific orientations-has been effective, particularly in the axes with the greater thermal drifts. This method has low computational and memory requirements, requiring small amounts of data and generating only two compensation parameters for each axis. To perform this calibration method only temperature variations, mechanical stability and one temperature sensor, usually integrated with the inertial sensor, are needed. This can lead to in-application calibration or recalibration.
The implementation of the calibration in a microcontroller unit is lightweight both in memory and computing cost. It has also shown that there is little difference compared to using a second-order surface, computationally more complex. The performance difference between the two resides mainly in the second order of the TDB.
In this paper, six tests were performed with 40 • C variations over six DUTs. With this data, the accelerometers were characterized. Another test was performed with temperature ramps of 20 • C to try out the effects of the compensation. After compensating the DUTs and computing the Euler angles, the average accuracy improvement was between 27% and 76%, depending on the angle and the method. In the DUTs with higher drifts, DUT #1 and CU, the improvements where up to 88% in thermal stability.
This technique allows the use of low cost MEMS accelerometers as inclinometers with a standard deviation lower than 0.1 • (with 20 • C thermal variations). The effect of the self-heating drift is also compensated to some extent in the 20 min to 3 h segment after cool start. Acknowledgments: This work has been supported in part by the company TECNIVIAL, S.A and its participation in the innovative public purchase tender approved by the Ministry of Development of the Government of Spain whose objective is to "search for innovative solutions in relation to the design and implementation of fog protection systems on the A-8 motorway between Mondoñedo and A Xesta "(Ref: BOE-B-2015-20619). Finally, we appreciate the collaboration of the engineer Sergio Sánchez Romanillos, head of the R&D department of TECNIVIAL.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript:

Appendix A
The second-order surfaces have been generated throughout the full working range, both in accelerations (±1 g) and in temperatures (−10 • C to +70 • C).