Governance by those who do the work.

Friday, April 10, 2015

Temperature Sensor Calibration

Having gotten the digital-to-analog and analog-to-digital conversions working while connected to each other, I plugged the STM32F3DISCOVERY board into my apparatus and started to debug the program to do analog-to-digital conversions of the LM35CZ temperature sensors. The initial readings were quite noisy; I traced this back to power supply noise caused by current fluctuations from the STM32F3DISCOVERY LEDs being switched on and off. I changed the program to keep the LEDs off during conversions and improved the power supply conditioning. The STM32F3DISCOVERY board consumes about 90.mA while running.

I found that the plate heater was slightly heating even though my program had the DAC controlling it set to 0. It turns out that when its output buffer is enabled, the STM32F303VCTx isn't specified to drive that output below 0.2V. Disabling the buffer reduced the output to a few millivolts.

The next task was to calibrate the temperature sensors. The calculations for measurement of convection are most sensitive to the time-derivative of the plate temperature and the difference between temperatures of the plate and ambient air. I attached the two ambient sensors ("ambient" and "free") to the back of the plate with thermal adhesive so that they would be at the same temperature. The statistics of (triple) 621 samples taken once per second are:

nREPS = 1ambientplatefreeoffset
mean:1696.751667.321734.46-29
variance:15.5816.659.83
mean:1.37.V1.34.V1.40.V-24.mV
variance:13.mV13.mV7.9.mV
mean:20.84C20.47C21.30C-0.36C
variance:0.19C0.20C0.12C

The plate-ambient offset is about -29 LSB = -24.mV = -0.36C. The 13.mV variance is rather large and matches measurements made by a RMS voltmeter at the ADC inputs; this bodes ill for the time-derivative of the plate temperature.

Note that voltage is measuread at the ADC input. There is a voltage gain of 6.56 from each LM35CZ (10.mV/C) output to the ADC input.

The STM32F303VCTx datasheet specifies a total unadjusted error of +/-4.5 LSB for the single-ended ADC at 25C and with a 3.3V supply.

The 16 LSB variance is much larger than the ADC error; thus it will act as a dither and smooth discontinuities in the ADC transfer function. So I rewrote the program to sum the result of converting each signal 16 times (per second). The statistics of 943 readings averaged over 16 conversions apiece are:

nREPS = 1ambientplatefreeoffset
mean:1702.791669.571736.16-33
variance:3.043.031.47
mean:1.37.V1.35.V1.40.V-27.mV
variance:2.4.mV2.4.mV1.2.mV
mean:20.91C20.50C21.32C-0.41C
variance:0.04C0.04C0.02C

The variance is reduced by a factor of 5, which will greatly reduce the effect of noise on the time-derivative of plate temperature.

This time the plate-ambient offset is about -33 LSB = -27.mV = -0.41C. All three temperatures are higher in the averaged test than in the single conversion test. This and subsequent sample runs in a thermostatically controlled building show that ambient and plate temperatures change enough to hamper calibration. The problem was worse when the plate was heated because the ambient sensor had only a small contact area with the plate, causing a temperature gradient which would be indistinguishable from a gain error.

So I fitted some insulation over the temperature sensors to protect them from air currents. This reduced the plate-ambient offset by an order of magnitude!

nREPS = 1ambientplatefreeoffset
mean:2173.752170.442230.43-3
variance:2.853.802.65
mean:1.75.V1.75.V1.80.V-2.7.mV
variance:2.3.mV3.1.mV2.1.mV
mean:26.69C26.65C27.39C-0.04C
variance:0.04C0.05C0.03C

A (304s) run near 20C also shows an offset smaller than the variance and guaranteed minimum offsets of the components.

nREPS = 1ambientplatefreeoffset
mean:1596.041598.531665.272
variance:3.013.001.37
mean:1.29.V1.29.V1.34.V2.0.mV
variance:2.4.mV2.4.mV1.1.mV
mean:19.60C19.63C20.45C0.03C
variance:0.04C0.04C0.02C

So the measurement program will not need to apply offset and scale corrections to the plate-ambient temperature difference. The ambient and plate sensors came from the same lot, the free sensor from a different batch. To convert the free temperature to the equivalent ambient temperature, multiply by 1.023 and subtract 1.318C.

No comments:

Post a Comment