LM35 Temperature Sensor with Arduino Uno
Vložit
- čas přidán 4. 08. 2024
- Let's interface Analog Temperature Sensor LM35 with Arduino Uno. We'll discuss how to setup hardware with circuit connection and then write arduino code to read temperature sensor reading from LM35 in Degree Centigrade. This video also demonstrate, how to convert ADC counts into degree centigrade with LM35 Sensor.
Formula for Temperature Conversion (In Degree Centigrade):
temp = analogRead(A0);
float temp = ( temp/1024.0)*5000;
float temp = temp/10;
clear+short+beautiful, danke !!!
Germany?
Nice, amazing, easy and educational video.
Another thing to consider, especially those who have followed the instructions on the video and get a reading of around 90, is the type of temperature sensor you have. In the video, the temperature sensor used is LM35 that is linearly proportional to Celcius scaling. Check maybe you have an LM34 that is linearly proportional in FAHRENHEIT SCALING.
it would very useful if you can give an idea totransmit this temperature and receive on another arduino using rf 432mhz module?
I have a problem with the temperature measurement it is not accurate it gives me 49.95 each time. Did you know where the problem came from?
wonderful sir.
@BINARY UPDATES hey, how do we make the Celcius outputs to ferinheit
Can we use this in flame sensor?
I have tried this code...but its showing value of 7, -11. My temperature sensor is 62AB LM35 DZ
thank you for your suport
Can I use arduino nano board to this sensor , where I am using other digital pins for a relay & 7seg display???????? Actually I want to control a relay on/off timing according to temperature limit,,,, please suggest me...
Yes, you can use Arduino Nano with LM35 Sensor
bagus videonya..
sir tell me what if i connect 3 lm sensor to know the temp of three diffrent chambers
You can do that.
Then you get 3 different temperature readings ? lol
Can I take small arduino board
hey man. I'm kinda desperate, but could you explain a code, where if the thermal sensor detects a certain temperature, the servo turnes?
Man use a if statement, ig it'll work then..
Thanks very much great video
Hi Mr. Roland
Glad you enjoyed it!
Thank you
I can apply this with Arduino méga 2560???
yes they are more or less same
If people encounter wrong readings, it's probably because the 0.48828125 is the conversion for a 5 volts power supply... If your specific Arduino supplies 3.3 volts, it would have to be a different number; do the same steps with the calculator but starting with 3.3 instead of 5.
I say, maybe change the multiplying factor to (5/1023)
i am using the 36gz sensor and have this same set up, is my math wrong? my temp is reading 78c to 80c
It looks like you are interpretation the raw sensor data as your temperature. Devide the sensor value by 2 and you will output your degrees celsius.
thanks.
Sir how can I use this in house and seeing the temperature in my office???
Using Wifi
If anyones geting any high values of temperature....pls check the connections first....if problem persists pls change the sensor.....i hv done it and its working........The code above is correct
thanks
My Sensor is exactly the same one in the video, but it is giving me 0.00 output. please help.
Mine too, and the legs are opposite. If I connect them as the video, my Arduino turns off and get disconnected (port disconnects), and the sensor gets hot.
@@tupa2pac if you flip it, it gets short that why it gets disconnected, your sensor will be burnt like this
hi. can LM35 detect temperature lower than 0 dgree celcius?
and does anyone hv any suggestion on other temperature sensor that i can use to detect negative temperature.
Yes, according to the datasheet of LM35 from TI. This sensor can measure temperature from range -55 to 150 Degree Centigrade.
BINARY UPDATES previously i tried to connect arduino and lm35 equipped with a java application, but somehow lm35 cannot detect lower than 0°C. And i encounter a forum saying that lm35 cannot detect lower than 0 dgree temp when connected to arduino. Which is different than the specification of the lm35.
Some even said to try use lm335 instead. Can anyone clarify me about this? Thanks in advance.
Upto -55
Sir is it possible that after reaching a particular temperature, the sensor goes off? Can you please give me the code and the curcuit diagram?
Hi Avin, sensor never stops as long as it has power. You can program in a way that when certain temperature threshold reach then stop reading data from temperature sensor. I hope this can help. Good Luck
@@BINARYUPDATES thank you for the info sir but actually I am not a kind of professional and I have to code a temperature sensor for a school competition so can you please send the code?
Hello sir,,, I have tried LM35 with arduino nano board as you showed in video. Same circuit same code. But LM35 is giving incorrect reading to serial monitor. Like 11.45 /21.06 /39.88 /17.2 /25.22 . Please solve this problem
It is correct. You just need to process the raw data into something sane.
The problem is rather complex, you should first set refrence point(best to be zero centigrade of Celsius) and then mesure voltage drop from there. It requires a lot more knowledge than described here.
Those answers are ok, just take average of 500 of those.
nice
hello, i followed your code and setup on the arduino uno. however, i never be able to get an accurate result(The result aint stable. It Looks like waves, Peak to 0, 0 to Peak). how can i fix this?
it probably means the sensor is picking up a lot of noice, so try connecting the sensor to the 3.3V
the output changes as well then, so youll have to use another conversion from output volts to degrees
Alright, thanks
Could this code be used with a fan to control the temperature of a room? I want to kick in a fan if the temp goes to or above 28c then cut off when it gets down to 25c
I dont see why not.
guys the diagram is wrong, the 1st one is righ, but the other two wires are interchanged, hope yall like this and i was helpfull
From where we got 1024 . Didn't get it
sir 4.8828125 it is in volts and ur dividing by 10 and saying that 10mv=1degree celsius how it is possible
Mr. Kashirajvk Kalshetti, I mean when we divide 5/1024 = 0.0048828125 V. Now when we conver 0.0048828125 V into mili-volt we get 4.8828125 mV. Now 1 Degree Centigrade is 10mv (according to datasheet). We must divide 4.8828125/10 = 0.48828125. Now this 0.48828125 will be multiplying factor to get Temperature in degree centigrade from LM35 Sensor. I hope this would help. Have a Good Time. CHeers
This tutorial is not correct please make corrections as follows:
Suppose I have 0-80 volts range:
10mv/1 C *80= 0.8= Vref
suppose I have 8 bit adc 0-255 range and suppose my sensor value is 200
so formula would be: sensor values * (Vref/max value)
= 200 * (0.8/255) =0.627
To convert to degrees centigrade 0.627*(1 C/0.01 or 10mv) = 62.7 degrees centigrade
I am getting output on serial monitor from 90 to 120 and I'm using LM35. When I remove all the connections from arduino, it is still showing some garbage value on serial monitor. What could be the issue?
Hi Suddhi, It seems like as Issue is with LM35 temperature sensor. Your Arduino is fine. If you want to test then try other sensor to make sure its not an fault of Arduino Board. Good luck and best wishes!
Hii,plz give me the code of the program ,thank you
Mr. Ali, download program/code from github.com/binaryupdates/LM35-with-Arduino
I'm getting really high temperatures..I dunno what i'm doing wrong
me aswell.. like 498°C
It is probably your arduino dosent consume 5v.
ardu-ino-uno XD (no offense great video)
great!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I am not getting temperature reading in serial monitor... So can you tell me what's the issue?
Hi Jainnypatni, please check with the connection between LM35 and Arduino Uno. Make sure when you hold sensor facing your face then left pin with connect to 5V, middle pin will connect to A0 and right most pin will connect to GND. I hope this may help to get temperature data. Good luck and best wishes!
even though it is not effecting the result , the accurate calculation is to divide by 1023 and NOT 1024
analogRead() returns values from 0 to 1023 so 0v is 0 and 5v is 1023 !!!
Yes thanks for adding comment. Good day
5v / 1024 = 0.0048828125 is already in volts... multiplied by 1000 to make it in millivolts. hehe.
LMAO of cause if you devide voltage with a number you still have voltage as your result. Multiplying the result with 1000 will just bring you back to almost 5 volts so i am not understanding your logic.
You do 5v divided by 1024 because that is your arduino range. Then you multiply that by 10 to see the exact (millivoltage) mV per unit.
but DIVIDING 5v by 1024 gives you mV per unit. ITS ALREADY MILLIVOLTAGE !!! You dont have to multiply that to get mV, it will just bring you back to 5v
I guess you could divide by 5000 instead of divide by 1024 and then multiplying by 1024
''''
temp = analogRead(A0);
Serial.print(temp);
temp=temp/1024;
Serial.print(" /1024 ");
Serial.print(temp);
Serial.println();
temp= (temp/5)*1024;
Serial.print("TEMPERATURE: ");
Serial.print(temp/10);
Serial.print("*C");
Serial.println();
delay(1000);
'''
@@jared1122 at any case 1024 is wrong it should be 1023 cause analogRead returns values from 0 to 1023 representing 0v to 5V
Hi,
I followed your Vedic step by step by it gives me wrong values. it gave me VALUES OF 500 *C
Please make sure your LM35 Sensor genuine and functioning properly. Otherwise connections will be the only reason for not getting real temperature value. Good luck and best wishes!
Why 1024 ? sorry the audio was not clear.
Yah tell me ans to this question
The Analog Pins means an ADC Channel on Arduino Uno is 10-bit so 2^10-1=1023 and if you start counting from 0 as in any digital electronics. Its become 2014. I hope this can help you. Thanks
@@BINARYUPDATES Wrong !
the analogRead() returns linear value representing the voltage 0 for 0V up to 1023 for 5V so the voltage calculation is V=analogRead * (5/1023)
NOT 1024
hi
thank you for the code. but this lm35 is totally not accurate. cant be trusted. instead good to use DHT11 or DHT22
Lm35 is really accurate
If you use it correctly
Its only 0.5% error
Are you robot?
bc