**Temperature Compensation of Electrolytic Tilt Sensors**

**Description**

Electrolytic tilt sensors are fluid based devices making their output susceptible to variations in temperature. The purpose of this document is to explain how temperature compensation of electrolytic tilt sensor outputs can be achieved to produce the highest accuracy angular measurement.

**Temperature Compensation**

There are two components to the temperature compensation of an electrolytic tilt sensor:

- Null temperature compensation
- Scale (or sensitivity) temperature compensation

Null temperature compensation is accomplished with a null temperature coefficient. This is a factor which varies from sensor to sensor and therefore must be calibrated individually for each sensor. The units of this factor will vary depending on the type of output. For example, some sensors have an analog output of 0 to 5 V while others will have an ASCII decimal output of the current tilt angle.

Scale temperature compensation is accomplished with a scale temperature coefficient. This is a factor which is uniform among all sensors of the same type. It has units of percent of output per degree C or %/°C.

The only other requirement for temperature compensation is the ability to read the current temperature. This feature is available on all TFC signal conditioner circuits through the use of the MCP9700 from Microchip (http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en022289).

**Null Temperature Compensation**

In order to accomplish null temperature compensation, a null temperature coefficient must first be calculated (because the coefficient varies for each individual sensor, TFC cannot provide it). This is accomplished by temperature cycling the sensor over the desired range and recording the output while the sensor remains stationary at null (0° tilt). At TFC we typically do a 3 point calibration at -20° C, +20° C, and +50° C.

Let’s suppose we have a 0717-4318-99 TFC wide range dual axis tilt sensor sitting at null at +20° C being driven by a TFC digital signal conditioner with a 16 bit (0 to 65535) output. We take a reading and record the following output:

Output at +20° C = 32768

We then reduce the temperature to -20° C and allow the sensor to reach ambient temperature. We take another reading and record the following output:

Output at -20° C = 32738

We then increase the temperature to +50° C and again allow the sensor to reach ambient temperature. We take another reading and record the following output:

Output at +50° C = 32798

We can now calculate a temperature coefficient for temperatures between -20° C and +20° C and another for temperatures between +20° C and +50° C using the following formula:

Temperature coefficient = (output at 20° C – output at current temperature)/(20 – current temperature)

Completing the calculations for the above example, we find the following two temperature coefficients:

Temperature coefficient between -20° C and +20° C = (32768 – 32738)/ (20° C – (-20° C)) = 30/40 = 0.75 counts/°C

Temperature coefficient between +20° C and +50° C = (32768 – 32798)/(20° C – 50° C) = (-30)/(-30) = 1 count/°C

Once the null temperature coefficients are calculated, null temperature compensation can be achieved by using the coefficients along with the following formula:

Null compensated output = (20 – current temperature)*(null temperature coefficient) + current output

Let’s suppose that we have the same sensor above at an unknown position where its output reads 35000 at a temperature of +40°C. We can use the formula for the compensated output to complete the following calculations:

Compensated output = (20° C – 40° C)*(1 count/°C) + 35000 = -20 + 35000 = 34980

It is important to note that the null offset due to temperature will produce an offset, and therefore an error, across the full range of the sensor if it is not compensated.

**Scale Temperature Compensation**

Scale temperature compensation can be achieved by using the scale temperature coefficient provided by TFC along with the following formula:

Scale compensated output =

(current output)*(20 – current temperature)*(-scale temperature coefficient) + current output

Let’s suppose we have a 0703-1602-99 TFC mid-range single axis electrolytic tilt sensor. This sensor has a scale temperature coefficient of 0.075%/°C. Now let’s suppose that the current sensor output is 5° tilt at a temperature of -20° C. We can then use the formula above to complete the following calculations:

(5° tilt)*(20° C – (-20° C))*(-0.00075) = (5° tilt)*(40° C)*(-0.00075) = -0.15° tilt

5° tilt + (-0.15° tilt) = 4.85° tilt

4.85° is therefore your temperature compensated angular position measurement.

Here’s another example. This time let’s suppose that the current sensor output is -5° tilt at a temperature of 40° C:

(-5° tilt)*(20° C – 40° C)*(-0.00075) = (-5° tilt)*(-20° C)*(-0.00075) = -0.075° tilt

-5° tilt + (-0.075° tilt) = -5.075° tilt

-5.075° is therefore your temperature compensated angular position measurement.

It’s important to keep in mind the sign of the current output when doing calculations for scale temperature compensation. If you are using a TFC signal conditioning board that has a 16-bit output of 0 to 65535, this output will first need to be shifted so that 0 is the midpoint (this is easily accomplished by subtracting 32768).

**Complete Temperature Compensation **

To properly apply temperature compensation, it’s necessary to use both components of temperature compensation together. This is done by using the null compensated output to calculate the scale compensated output:

Compensated Output

= (null compensated output * (20 – current temperature) * -scale coefficient)

+null compensated output

Let’s suppose we have the same 0717-4318-99 dual axis sensor from the null temperature compensation example above. Recall that when the sensor was held at an unknown position at a temperature of +40°C, the null compensated output was 34890. Let’s finish the temperature compensation of this measurement by applying scale temperature compensation.

First, we have to shift the raw value to make sure the scale temperature coefficient is calculated correctly:

34890 − 32768 = 2122

The 0717-4318-99 has a scale temperature coefficient of 0.1%/°C. Using this and the null compensated output, we can now apply scale temperature compensation as described above:

2122 * (20°C – 40°C) * -0.001 = 2122 * -20°C * -0.001 = 42.44

Compensated Output = 2122 + 42.44 = 2164.44 = 2164

Finally, we add back to offset we subtracted earlier to get our final, unsigned 16-bit result.

2164 + 32768 = 34932

It’s important to make sure you use both components of temperature compensation in your calculations. Using only one component can have unpredictable results, sometimes resulting in the measurement becoming less accurate than the uncompensated output.