About temperature sensors

I’ve been experimenting with and reading up on the LM35 temperature sensor, used by the On Vacations board. The output pin of the sensor connects directly to an analog input on the Arduino, and after reading the value of the pin, the temperature (in Celcius) is calculated with this formula:

temperature = 5 * (analog value from sensor) * 100 / 1024

However, I found that the temperature values fluctuated by 1 or 2 degrees for every reading (taken once a second).  To stabilize the readings, I tried to average the readings in various ways, such as by taking several successive readings and then averaging the values, or by keeping an average of the last 10 readings (over the last 10 seconds).  The results were quite similar in each case, the temperature reading was notably more stable, but when it did fluctuate, it was still by a degree or two.

In reading about taking better readings from these sensors, I came across lots of info about some general downfalls with Arduino’s analog readings.  There are two particularly relevant posts on the Adafruit forum here and here, regarding multiple analog readings from different pins.  The solution seems to be the inclusion of a short delay (10ms) after each reading.

Adafruit also has a nice tutorial on temperature measurement, and it sounds like the LM36 might be a better choice for use with the On Vactions boards — depending where a farm/garden is located — since it can measure sub-zero temperatures without a negative power supply.

I also came across a library directed to improving Arduino’s analog functions.  I’m looking forward to experimenting with this.