Arduino + LM35

Hello,

I'm just a starter so excuse me for lame questions/mistakes :wink:

I'm trying to interface a LM35 Temperature Sensor (datasheet: http://www.libelium.com/squidbee/upload/b/bd/Temperatura-LM35.pdf )
I'm using the T0-92 plastic package version.

When I connect the sensor's +Vs and GND pin to arduino's 5V and GND pin the arduino seems to short-circuit (the power LED goes from bright to almost out)
When I switch the +5v and GND pins this behaviour doesn't occure.

But if i use it like this and connect the Vout pin of the sensor too an analog input of the arduino, I get an adc value of 146.
according to the datasheet the sensor's output is 10mV for every degrees. So this would be 71.7 °C (if an adc value of 0 is 0 °C..), which is a bit high for temperature :stuck_out_tongue:

This value does change if the temperature changes though...

So to summarize:

My two questions are:
1 - did I connect the sensor wright in the first place?
2 - If i did connect it wright, is my conversion from adc too °C correct?

Thanks in advance,

An arduino beginner :slight_smile:

But if i use it like this

Not sure what 'this' is. You need a connection between +5V, ground and the arduino input. It sounds like you connected them wrong at first. This could explain why it is not working right.

have you seen this:- My Projects: Arduino LM35 Sensor

Quote:
But if i use it like this

Not sure what 'this' is. You need a connection between +5V, ground and the arduino input. It sounds like you connected them wrong at first. This could explain why it is not working right.

if i use it like this the arduino doesn't short circuit:

Sensor -- Arduino
+Vs -- GND
GND -- 5V

I know it's far from logical but if I switch those two it short circuits :-?

Sensor -- Arduino
+Vs -- GND
GND -- 5V

No that's not right. Are you sure you are identifying the pins correctly?

Quote:
No that's not right. Are you sure you are identifying the pins correctly?.

Well I'm 99% sure, I hope this picture makes it clearer (excuse me for bad photo quality)

Looks to me like you've got +5 and Gnd swapped. The photo says top view and the drawing says bottom view.

Oh jeez how stupid is that hits head with hammer :stuck_out_tongue:

Can I blame the time (end of the day) for that? :stuck_out_tongue:

Anyway, I just tried a brand new LM35, still gives me the same ADC values so can anyone help me on my way a bit with the conversion?

You're something like the 4th person I've seen in the last week who made that mistake. I would have made it myself, except that I'm used to reading datasheets for TO-92 parts. The side view is always (as far as I know) an illustration of the pins when you look straight at the flat side of the casing.

Try using:-

temperature = (5.0 * val * 100.0)/1024.0;

Where val is what you read and temperature is a float.

That wiring mistake is not unlike a frequent one made by some when using 79XX TO-220 voltage regulators, the pin out is different then with 78XX positive voltage regulators in the same package style. People sometimes quickly look at a positive regulator data sheet and assume the negitive regulators are wired the same.

The devil is always in the details. :wink:

Lefty

Try using:-

temperature = (5.0 * val * 100.0)/1024.0;

Where val is what you read and temperature is a float.

I tried that, it still gives me way to high temperatures (±70 °C at room temperature) :frowning:

I've connect the LM35 like this to my arduino:

And i use this code to convert the ADC value to °C

temperature = ( 5.0 * analogRead(0) * 100.0) / 1024.0;

I've checked the output voltage of the sensor by hooking up a voltage meter between the gnd and the Vout of the LM35, wich gave me 0,73 Volts, wich would be 73 °C... :-?
Also checked the supply voltage (between +Vs and GND) wich was 5,03V.

this is a brand new LM35, and all the previously tested LM35 gave the same results, could someone please point out the my what it is that i'm doing wrong?

If the actual temperature is around 22 degrees Celsius then perhaps you have an LM34 which is calibrated in Fahrenheit

Hmm ofcourse that would explain it!

Is there any way to check that? there is no text on the casing

edit: typo

Is there any way to check that?

Put the sensor on an ice cube or heat it up and if you get a valid readings in Fahrenheit then you have an LM34

The Fahrenheit version is called the LM34
Application note:- http://www.national.com/an/AN/AN-460.pdf

Indeed it was a LM-34, I implemented a Fahrenheit to celcius conversion and the readings were okay :slight_smile:

Thanks alot for helping me out :smiley: