# LM35 Temperature sensor is not giving accurate reading

#### JIL PATEL

Joined Apr 14, 2021
5
Hello
I am facing quiet a bit trouble with LM25 temperature sensor, The readings are a bit too high(90-120*C) for room temprature. I have tried following things to get an expected result but non seems to work

Adding Filter Capacitor at power rails of LM35:
The fluctuation of temperature output might be the noise available in power supply so it’s better to use an electrolytic capacitor at power supply i.e. connected to Vcc and GND of LM35. (I added 10 uF)

Adding resistance between output pin and GND pin
According to datasheet of LM35 it has low sinking capability as a result its output become more sensitive to electromagnetic interference. 1K or 2K resistor between output and GND can solve this issue to some extent and also solve self-heating error.

Fluctuation or drift are one of the major issues of arduino sensor. One way to make fluctuation less is trying to calculate average reading instead of single reading.

Minimize the error
When we use default reference i.e. 5V refence at analog input, it is less sensitive to voltage difference. At this reference arduino can map 5V input voltage into 1024 steps i.e. 0-1023. This means resolution at 5V = 5/1023 = 4.88 x 10-3V = 4.88mV. So, if we use default 5v analog reference minimum temp deviation that arduino can detect is 0.50C. If we use default arduino reference voltage we will end up with adding 0.50C extra error.
This error can be minimized by selection proper reference value for arduino. I used 1.1V internal reference for arduino, so that the minimum temperature deviation that arduino can measure improves.

At the end I even purchased a new sensor assuming the frist one was faulty butthe is no avail!. I am still facing the same problem
It was be great if someone helped me out here

#### ericgibbs

Joined Jan 29, 2010
13,614
hi Jil,
Welcome to AAC.
Do you have circuit diagram you could post, also a some indication of the error values you are reading.?
E

#### andrewmm

Joined Feb 25, 2011
1,751
Hello
I am facing quiet a bit trouble with LM25 temperature sensor, The readings are a bit too high(90-120*C) for room temprature. I have tried following things to get an expected result but non seems to work

Adding Filter Capacitor at power rails of LM35:
The fluctuation of temperature output might be the noise available in power supply so it’s better to use an electrolytic capacitor at power supply i.e. connected to Vcc and GND of LM35. (I added 10 uF)

Adding resistance between output pin and GND pin
According to datasheet of LM35 it has low sinking capability as a result its output become more sensitive to electromagnetic interference. 1K or 2K resistor between output and GND can solve this issue to some extent and also solve self-heating error.

Fluctuation or drift are one of the major issues of arduino sensor. One way to make fluctuation less is trying to calculate average reading instead of single reading.

Minimize the error
When we use default reference i.e. 5V refence at analog input, it is less sensitive to voltage difference. At this reference arduino can map 5V input voltage into 1024 steps i.e. 0-1023. This means resolution at 5V = 5/1023 = 4.88 x 10-3V = 4.88mV. So, if we use default 5v analog reference minimum temp deviation that arduino can detect is 0.50C. If we use default arduino reference voltage we will end up with adding 0.50C extra error.
This error can be minimized by selection proper reference value for arduino. I used 1.1V internal reference for arduino, so that the minimum temperature deviation that arduino can measure improves.

At the end I even purchased a new sensor assuming the frist one was faulty butthe is no avail!. I am still facing the same problem
It was be great if someone helped me out here
where did you get it from ?

The number of fakes of the LM35 is "amazing" ,

If its a reliable distributor, then no problem,
if it was say an un known far east person, just keep it in mind,
might be your circuit / code, but..

You mention arduino,

you following this, I have used the code as a quick test of LM35's

https://create.arduino.cc/projecthu...rduino-lm35-temperature-sensor-project-0a43ba

#### MrChips

Joined Oct 2, 2009
24,175
Measure the voltage across the LM35.

#### jayanthd

Joined Jul 4, 2015
906
Are you sure you can use 1.1V Internal VRef+ for ADC and input 1.5V into ADC input pin. The max output voltage of LM35 for 150 degree C is 1.5V.

When ADC input voltage is higher than the VRef+ voltage then ADC module will get damaged.

#### DickCappels

Joined Aug 21, 2008
7,702
Are you sure you can use 1.1V Internal VRef+ for ADC and input 1.5V into ADC input pin. The max output voltage of LM35 for 150 degree C is 1.5V.

There is no such limitation to Arduino controllers.

When ADC input voltage is higher than the VRef+ voltage then ADC module will get damaged.
I see problems when the input signal exceeds the positive power supply by about 0.5 volts. The problem of having an input greater than Vref is usually that of the ADC measuring full scale.

#### JIL PATEL

Joined Apr 14, 2021
5
hi Jil,
Welcome to AAC.
Do you have circuit diagram you could post, also a some indication of the error values you are reading.?
E
i have attached the circuit diagram. and talking about the readings , i im getting valude such as 200F ,220F, sometimes 90F.
The reading varies between 50 and250 F.

Also i am not getting right value for the pulse sensor.

#### bertus

Joined Apr 5, 2008
21,531
Hello,

Why are you using a LM35 to read Fahrenheit?
The LM34 will directly output a Fahrenheit value of 10 mV/°F.

Bertus

#### Attachments

• 251.3 KB Views: 16
• 303.7 KB Views: 16

#### JIL PATEL

Joined Apr 14, 2021
5
where did you get it from ?

The number of fakes of the LM35 is "amazing" ,

If its a reliable distributor, then no problem,
if it was say an un known far east person, just keep it in mind,
might be your circuit / code, but..

You mention arduino,

you following this, I have used the code as a quick test of LM35's

https://create.arduino.cc/projecthu...rduino-lm35-temperature-sensor-project-0a43ba
Thanks.
But I am not getting correct reading by using this as well.

But relatively the reading are much better.

I am getting around 22°C whereas the actual temperature is 32°C

#### ericgibbs

Joined Jan 29, 2010
13,614
hi Jil,
E

#### jayanthd

Joined Jul 4, 2015
906
Thanks.
But I am not getting correct reading by using this as well.

But relatively the reading are much better.

I am getting around 22°C whereas the actual temperature is 32°C

Code:
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;
try this...

Code:
float mv = ( val/1024.0)*5000.0;
float cel = mv/10.0;
float farh = (cel*9.0)/5.0 + 32.0;
Also, try

Code:
int tempPin = A1;

I am getting the correct values for the code that you mentioned...

Last edited:

#### UweX

Joined Sep 2, 2020
6
Hi Jil,
to me the source of the problem is unclear. To identify the deviation from expected behavior, please measure the output voltage with a DVM and check, if any variation is visible there. This gives a first clue, if the sensor is really the problem or maybe something wrong on the Arduino side.
If possible, also check with a scope, if there is some noise on the signal. In your sketch I see on the upper right some RF generating module. Is there enough distance or shielding between the sensor and the transmitter ?

#### andrewmm

Joined Feb 25, 2011
1,751
Can I just check, this is a real bit of kit, not simulations ?

#### JDiaz

Joined Nov 4, 2019
3
This is look like a noise on power source, that could be a reason you don't get accuracy readings.
Add 0.01uF disc capacitor and 470uF electrolytic capacitor to the (+) and (-) power on breadboard.
If you have more than 2 inches of cabling on a crkt that is recommended to avoid noise on power line so it can affect your whole circuitry..