Go Down

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

brainfart

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:

http://www.national.com/pf/LM/LM35.html
http://www.national.com/ds.cgi/LM/LM35.pdf

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?

Daniel

#1
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...



brainfart


Numbski

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?


BigMike

Numbski,

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

Regards,

Mike

Go Up