Go Down

Topic: LM34/35 temp sensor (Read 3455 times) previous topic - next topic


I am interested in measuring temperatures using the LM34 or 35. The LM34 measures in Farenheit, while the LM35 does degrees Centigrade. Here is the datasheet:


The temp sensor will output a voltage of 200mV at 20°C, 500mV at 50°C, 1000mV at 100°C etc. You get the picture.

How exactly do I have to connect the sensor to the Arduino's analog input? What kind of resolution can I expect? 5V/10bit = 5V/1024 = 5mV, or 0.5°C? Is there a way to improve this without using an op amp?


Oct 26, 2006, 08:16 am Last Edit: Oct 26, 2006, 08:28 am by Daniel Reason: 1
I have used these a few times and they are a snap to wire up. Connect power and ground, and the remaining pin gives you an output voltage proportional to temperature.

There are three pins on the sensor:

+Vs      >>     connect  to Arduino +5V

Vout      >>    connect  to an Arduino Analog input  
(they suggest a 2 to 100K resistor in series with the sesnor output in the data sheet, but not completely necessary)

GND      >>     connect to Arduino ground

I think your resolution calculations are about right, and that to do better you would need an op amp to optimize the voltage swing of the sensor's output, i.e move it from 200mv full scale to 5V full scale. You may find that  in practice, the actual sensing area is very tiny, and once hooked up might not appear to have a realy strong correspondence to the actual room temperature... temperature variations are a pretty subtle thing to sense.

Glueing or calmping the sensor to something like a heatskink might help with the response...


Don't mind me - I'm just bumping a message that's almost 2 years old. ;)

So - I'm trying to make some sense of the math here.  I have an LM34, and the math is obviously the same.  I'm using Perl to connect and get the raw reading back from the LM34.  .5 degrees isn't quite accurate, it's more like .488 mV, or 500mV/1024 (10 bits).

But that math doesn't make even the slightest sense to me.  I've read the first post here upside down and sideway, and where are we getting 10 bits from?  The documentation for the LM34 doesn't make any mention of this.  Is it just a known thing about the arduino that if you hook up a 5V analog device that it has a range of 0 bits to 10 bits, thus it's always going to be a division of 500mV/1024?



the ADC on the AVR chip on the Arduino has a 10 bit resolution.




The 10-bits comes from the Arduino's analog-to-digital converter.  Any analog signal you connect is coverted to a 10-bit digital value (0 to 1023).

The Arduino has an analog reference voltage that you can use to shrink the range, so for example, you can supply 2 volts there and then have the 0 to 2 volt range over 1023 values and you'd have under 2mV resolution.


There we go.  That's what I was missing - I had no idea where on earth those numbers were coming from! :P

FYI to anyone that does this with the LM34 vs LM35 - don't just fudge the conversion by just doing OUTPUT * .5 - for Fahrenheit that WILL throw off your reading.  A common room temp output will be 144.  At .5 that then goes to 72 degrees.  Doing it properly and doing OUTPUT * .4882 gives you 70.3, and that's enough to screw up things just enough to make you scratch your head. :)


If you use analogReference(INTERNAL) you can have a 1.1V reference which will give should work fine up to about 110 degreesF. (LM34)


Kirby, Thanks for that, that is a great idea. I have been playing with an LM35 (celcius) sensor and it seems a great idea as that also gets the LM35 to 110 celcius which would be enough for me.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131