Pages: [1]   Go Down
 Author Topic: LM34/35 temp sensor  (Read 2716 times) 0 Members and 1 Guest are viewing this topic.
0
Offline
Jr. Member
Karma: 0
Posts: 91
 « on: October 22, 2006, 02:45:37 pm » Bigger Smaller Reset

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?
 Logged

Daniel
Guest
 « Reply #1 on: October 26, 2006, 01:16:28 am » Bigger Smaller Reset

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

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

 « Last Edit: October 26, 2006, 01:28:35 am by Daniel » Logged

0
Offline
Jr. Member
Karma: 0
Posts: 91
 « Reply #2 on: October 26, 2006, 02:45:45 am » Bigger Smaller Reset

Thanks.
 Logged

0
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
 « Reply #3 on: September 18, 2008, 08:21:39 am » Bigger Smaller Reset

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?

 Logged

0
Offline
Full Member
Karma: 0
Posts: 207
Arduino rocks
 « Reply #4 on: September 18, 2008, 08:38:27 am » Bigger Smaller Reset

Numbski,

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

Regards,

Mike
 Logged

0
Offline
God Member
Karma: 2
Posts: 854
Arduino rocks!
 « Reply #5 on: September 18, 2008, 09:13:49 am » Bigger Smaller Reset

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

0
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
 « Reply #6 on: September 18, 2008, 12:50:35 pm » Bigger Smaller Reset

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

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

0
Offline
Newbie
Karma: 0
Posts: 1
Arduino rocks
 « Reply #7 on: March 14, 2009, 06:22:32 pm » Bigger Smaller Reset

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

0
Offline
Newbie
Karma: 0
Posts: 28
Arduino rocks
 « Reply #8 on: March 15, 2009, 05:55:10 am » Bigger Smaller Reset

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

 Pages: [1]   Go Up