Electronic – arduino – Why is the analog temp sensor’s signal so unstable

arduinotemperature

I have an analog temperature sensor (TMP36 – datasheetproduct page) and it is properly connected to an analog pin for reading its output.

The Arduino sketch (firmware) works just fine. Everything actually works fine except for two things:

  1. If I plug more components in the circuit, like for example connecting an LED in parallel, temp readings go up for 1 degree (Celsius).

  2. From time to time the readings go crazy (like 80°C or 100°C), although it's never that hot in here.

The connection is like this: from the Arduino's 5V pin to the sensor positive lead. Then, from the sensor's negative lead to the GND pin in Arduino. And finally, from the middle lead to the A1 analog reading pin.

Why are situations 1 and 2 happening? Is this normal?

Best Answer

The most common error people make with the Arduino vis analog reading is assuming the Vref is exactly 5V. This is seldom the case, especially if you using the USB port to power the board.

USB is a relatively high impedance power source and doesn't take too kindly to changes in load (such as flashing an LED) and the voltage can fluctuate quite a lot. You should adjust any calculations to do to use the real Vref (Vcc) voltage and not assume it's exactly 5V. The simplest way is to measure the voltage with a DMM when you have all your components connected up.

A better way would be to use a precision voltage reference chip to provide a stable reference voltage to the Vref pin of the Arduino.

Also: have you decoupled the power to the sensor? I.e., placed a capacitor across the \$V_{CC}\$ and \$GND\$ pins (100nF for the device, and maybe 2.2µF - 10µF for the remote connection to the power).