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 = 1 | ambient | plate | free | offset |
---|---|---|---|---|

mean: | 1696.75 | 1667.32 | 1734.46 | -29 |

variance: | 15.58 | 16.65 | 9.83 | |

mean: | 1.37.V | 1.34.V | 1.40.V | -24.mV |

variance: | 13.mV | 13.mV | 7.9.mV | |

mean: | 20.84C | 20.47C | 21.30C | -0.36C |

variance: | 0.19C | 0.20C | 0.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 = 1 | ambient | plate | free | offset |
---|---|---|---|---|

mean: | 1702.79 | 1669.57 | 1736.16 | -33 |

variance: | 3.04 | 3.03 | 1.47 | |

mean: | 1.37.V | 1.35.V | 1.40.V | -27.mV |

variance: | 2.4.mV | 2.4.mV | 1.2.mV | |

mean: | 20.91C | 20.50C | 21.32C | -0.41C |

variance: | 0.04C | 0.04C | 0.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 = 1 | ambient | plate | free | offset | |
---|---|---|---|---|---|

mean: | 2173.75 | 2170.44 | 2230.43 | -3 | |

variance: | 2.85 | 3.80 | 2.65 | ||

mean: | 1.75.V | 1.75.V | 1.80.V | -2.7.mV | |

variance: | 2.3.mV | 3.1.mV | 2.1.mV | ||

mean: | 26.69C | 26.65C | 27.39C | -0.04C | |

variance: | 0.04C | 0.05C | 0.03C |

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

nREPS = 1 | ambient | plate | free | offset |
---|---|---|---|---|

mean: | 1596.04 | 1598.53 | 1665.27 | 2 |

variance: | 3.01 | 3.00 | 1.37 | |

mean: | 1.29.V | 1.29.V | 1.34.V | 2.0.mV |

variance: | 2.4.mV | 2.4.mV | 1.1.mV | |

mean: | 19.60C | 19.63C | 20.45C | 0.03C |

variance: | 0.04C | 0.04C | 0.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