Arduino Uno 9v batteries and sensors, an observation

I recently got a temperature sensor for my Uno - LM35. It looks like a transistor. So I hook it up like it said in the datasheet, one pin to ground, one to 5v and the other to A0. I hooked up the results to an LCD and everything worked, for a time.

I noticed something strange - the values would sky-rocket after some time while running the Uno from a 9v battery. From 22C to 34C in the span of 15 minutes. So I started thinking about the reason. I tried a power bank - now the readings are accurate. I try a new 9v battery - accurate. I try the old one - inaccurate.

I'm going to make an observation here - when the battery starts draining the internal current of the Uno's 5v pin drops a little. This probably interferes with the readings of the sensor. Maybe that's why those more expensive sensors have chips on them, I reckon they've got an internal voltage regulator and current regulator to keep the sensors accurate. Maybe they have some sort of a reference point and an internal formula that can re-calculate the values depending on the voltage and current.

At least that's what I think. Did I guess correctly?

Sorry, that doesn't make sense to me.

Sounds like your battery just went dead, leaving the circuit starved of power, resulting in borderline/chaotic/unpredictable behavior.

9V batteries aren't good power supplies to begin with; don't bother with them. Save them for your smoke alarms.

2 Likes

By default the analog inputs use the 5v chip supply as its reference , so when running off a 9v battery it’s likely the reference voltage is falling below 5v and hence your analog reading rises .
The answer is

  1. A 9v battery is not good enough for the job.
  2. Use the internal voltage reference on the chip and a voltage divider on the input .
1 Like

I don't see that happening. The dropout of a typical linear regulator you'll find on an arduino board is less than 2V. A 9v battery would have to drop below 7V in order for the 5V Vref to start dropping. By that time the whole contraption has long stopped working altogether.

I'm going to guess you don't own a multimeter, otherwise you wouldn't be guessing? A multimeter is one of the first items you should buy if you want to learn some electronics. Doesn't have to be an expensive one, 15~20 £/$/€ is fine for anyone who is not a professional and will help you learn and understand so much more about what's going on in the circuits you build.

Hi,

Which a PP3 smoke detector battery will do in quite short time.

Tom.... :smiley: :+1::coffee: :australia:

1 Like

So the battery is clearly the issue !

Yes, no.
The LM35 only outputs 1volt at 100 degrees C, so no voltage divider needed.
Yes to using the internal 1.1volt Aref.

Most examples on the internet and starter pack books are using default Aref, which is wrong.
Supply dependent instability (as you already noticed0, and poor resolution (true 0.1C can't be displayed).
If the LM35 (or TMP36) sketch doesn't have
analogReference(INTERNAL;
in setup(), then mark it as useless.
Leo..

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.