3
\$\begingroup\$

I have an analog temperature sensor (TMP36 - datasheet - product 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?

\$\endgroup\$

3 Answers 3

5
\$\begingroup\$

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).

\$\endgroup\$
2
\$\begingroup\$

The LM135 sensor needs a resistor (something like 2K) in series with the + pin, otherwise you'll likely damage the sensor.

It is a shunt device, like a zener diode (as its symbol indicates).

\$\endgroup\$
1
2
\$\begingroup\$

In your comment to Spehro's reply you mention that you use a TMP36 sensor, not an LM335A. Shouldn't you update your question accordingly for new readers??

Majenko's remark about the stability of the USB voltage might be your main problem.

But from the TMP36's datahseet I get the idea (but it is not stated clearly) that the sensor has a quite high source impedance: 50uA source capability means ~ 100kOhm, and I did not find a mentioning of the sink capability, and the circuit diagram suggests a emitter follower output. My suggestion would be to add a 100k resistor from the sensor's output to ground, with a parallel 1nF capacitor.

\$\endgroup\$
3
  • \$\begingroup\$ Sorry, I thought I was updating it but I commented instead... \$\endgroup\$
    – A R
    Jul 6, 2014 at 19:47
  • \$\begingroup\$ OK, I'll try to do that. BUt first: can you post schematics here? I'll try to draw one for this so you can tell me if things will blow up before they do. \$\endgroup\$
    – A R
    Jul 6, 2014 at 19:54
  • \$\begingroup\$ There is a schematic editor, you start it by clicking one of the symbols in the question editor. \$\endgroup\$ Jul 6, 2014 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.