Author Options:

Sensor Help with Arduino Answered

Hi all!

I need help with trying to figure out datasheets. I was digging through my electronics when I found and LM35 sensor. So I looked up the datasheet but I couldn't find out how to convert the analog output to a temperature. I found an i'ble on how to do it but I want to know how to find that information in the datasheet so that next time I get something I'll be able to do it myself.

I looked at all the curves and none of them seemed to be temperature vs. voltage.
I also looked through the whole first part and couldn't find the multiplier.

Also does that multiplier change with the amount of voltage you supply the LM35 with? Say I use 5 volts. Will it give a different reading over 4.5 volts?
There's so much technical and complicated data that I don't know what to look for.

Here is the link to the datasheet http://www.ti.com/lit/ds/symlink/lm35.pdf



Most of the time the basic information you need is in the features, however that one is a bit complicated.

Since with transistors you only need three things I will explain them.

Watts max

Volts max

Amps max

Let’s take a MJE3055

90 watts

70 volts

10 amps

Watts divided by what you want.

This is current and voltage from collector to emitter.

So if you want to run on 12 volts

It is 90W/12V = 7.5 amps

If you want to run on 5 amps it is:

90W/5A = 18 volts

At volts max the max current you can pass through the transistor is 90W/70V = 1.3 amps.

At amps max the max voltage you can use is 90W/10A = 9Volts.

And Q is functioning at 50% of source voltage from collector to base.

Each component has its different pertinent information for what you want to do for instance the max frequency of a MJE3055 transistor is 2 MHz. so you can’t use this transistor in a 50 MHz. circuit.

And I bet you are more confused then you were when you asked this question.

Don’t worry if you like electronics, in time you will get it. After all if it was easy you wouldn’t need an engineering degree.


Oh man I might as well forget about it! So how does that help me find out how to use the sensor? The scale factor?

Its not hard:
The output voltage from an LM35 is (IIRC) 10mV per degree C.
The Arduino input sensitivity is 5/1024, or roughly 5mV per bit, so you can read around 0.5 degrees of resolution

Read your input from the LM35 as a number 0...1024, and then

Volts = reading * 5/1024, then temperature = volts/0.01 = reading * 5/10.24

...or temperature = reading *0.488

I don't understand. Could you try explaining it to a 5 year old? Maybe it would help if you told me what the factor would be if the scale factor was 15mV per C˚?

Also don't I need to use a resistor with the LM35? On the second picture on the right were it tells me the scale thingy it shows a resistor and I don't know how to calculate it. Will I get a diff reading without the resistor?


A five year old can't handle the maths.

0.325 x reading

You know what I'm talking about, simplified! I'm not an Engineer. If you would be so nice as to explain to me how you got that number and why it's different from the .488 reading.


BTW that number (0.325) says it's 55 when it's 78 out here. Math error?

C or F ? The LM35 datasheet says 2 to 150C, if you use it without the resistor. The Scale factor is 10mV/ deg C - that's what it is, you can't say its 15mV/deg C, its a fixed quantity.

Get it working in the basic mode first. And use my original scale.
You can work it out yourself. How do you convert the number from an analog read into a voltage ? Answer: its number *5/1024.

So, reading your sensor, you get a number n, the voltage you have read is n*5/1024. To convert that to temperature, every 10mV = 1 deg C, so your voltage 5n/1024 is divided by 0.01.
5/1024 = 0.00481.

Oh ok I understand you now.
And thanks you brought a really good point I was missing. I was assuming the the analog reading WAS the voltage. Wrong. I have to convert it first. Correct?

Now I was asking how would I do it *if* the sensor's factor was 15- that would just help me see when I have two. Anyways, imma give it a shot.

Sensor XYZ has a scale factor is *12mV/deg C.*
Convert analog reading to voltage, 5/1024 = 0.00481
0.0081 / 0.012 = 0.675.
So I'm gonna multiply my analog reading from my sensor by 0.675 to get the C temp?

If that's right then I got it down. Thanks!

You nailed it. The "number" from analog read is NOT the voltage - because you CAN change the reference voltage if you need to.

Ah gotcha.
Well thank you very much for your help!

I must be doing something wrong with my sensor or maybe I fried it too much with my soldering because it's giving me a temperature that is about 4 degrees lower than all of the thermometers we have.

Without the resistor, its offset by around 2 degrees C, so that's probably all it is. 2 degrees C ~ 3.8 deg F The next trick is to calibrate it against two known temperatures.

That's when I add 3.8 that gives me like a perfect temp! Hey man thanks!

learn about the sensor and you will understand the data sheet.

The data sheet basically said (And I am not reading it right now)

As the temperature goes up so does the voltage.

And it gives you a number to plug into a formula.

But like all almost data sheets it doesn’t give you the formula you need to know or figure out the formula.

Like I did with the transistor.