loading

Now make your own temperature sensor by Arduino and LM35 Sensor
You required following parts
1-ARDUINO BOARD ANY VERSION
2-LM35 TEMPERATURE SENSOR
3-USB CABLE
4-COMPUTER WITH ARDUINO SOFTWERE

MAKE THE CONNECTION AS SHOWN IN IMAGE AND UPLOAD THE FOLLOWING CODE ON ARDUINO BOARD.




int val;
int tempPin = 1;

void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;

Serial.print("TEMPRATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);

/* uncomment this to get temperature in farenhite
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();


*/
}








NOW SEE THE SERIAL MONITOR IN THE ARDUINO SOFTWERE ,
ITS DONE.

VISIT https://www.facebook.com/SparkingElectronics FOR MORE PROJECTS
;)
:)


<p>We can get value magic number 0.48828125 from following expression:</p><p>(SUPPLY_VOLTAGE x 1000 / 1024) / 10 where SUPPLY_VOLTAGE is 5.0V (the voltage used to power LM35)</p><p>1024 is 2^10, value where the analog value can be represented by ATmega (cmiiw) or the maximum value it can be represented is 1023. The actual voltage obtained by VOLTAGE_GET / 1024.</p><p>1000 is used to change the unit from V to mV</p><p>10 is constant. Each 10 mV is directly proportional to 1 Celcius.</p><p>By doing simple math: (5.0 * 1000 / 1024) / 10 = 0.48828125</p>
Sorry for asking this but what is the magic number you refer to about? What is the importance of it
<p>I think he meant the calibration value. instead of doing all the computation , just get the value from the sensor and multiply it with that value</p>
<p>Hi Please can you tell me if I was to run this program through a Attiny85 on 4.5 volts what formula would I need to use to get the correct results?</p>
<p>you can substitute the SUPPLY_VOLTAGE part which result in</p><p>(SUPPLY_VOLTAGE x 1000 / 1024) / 10 = (4.5 x 1000 / 1024) / 10 = </p><p>0.439453125</p>
<p>the supply voltage doesn't really matter , i think the analog to digital converter matters though, coz see we can even power the LM35 with a 20 v power supply, if we do that and still read the analog value from arduino, your equation will not hold, </p>
<p>Indeed the supply voltage can ranging from +35V to -0.2V. Well, I got the equation from the LM35 datasheet and never done things outside the datasheet.</p>
<p>the output values are not making ant sense when i kept the sensor in different climatic conditions.they are printing the same values</p>
<p>Very easy, I recieved temperature in F on the serial output. Now I want to output the script to a multi digit LED Dispaly.</p>
<p>instructions are useful but can i connect this project with ni labview?</p>
<p><a href="http://api.bjdroid.com/2016/05/31/temperature-sensor-with-arduino/" rel="nofollow">http://api.bjdroid.com/2016/05/31/temperature-sens...</a></p><p>See here Full tutorial</p>
<p>I have seen lot of people commenting they are getting improper reading let me give you some <a href="http://www.dnatechindia.com/LM35-Temperature-Sensor-Basics.html" rel="nofollow">basic description of LM35 Temperature Sensor</a></p><p>Well LM35 is a linear temperature sensor whose output voltage is proportional to degree centigrade. LM35's output is 10mv/Degree C which means for every degree rise in temperature the output of LM35 will rise by 10mv. So if the output of LM35 is 220mv/0.22V the temperature will be 22&deg;C. So if room temperature is 32&deg;C then the output of LM35 will be 320mv i.e. 0.32V.</p><p>So if you are not getting proper reading then check the output voltage of the sensor is it proportional to the room temperature as explained above? If so check the code that you have typed.</p>
<p>Sweet! Works like a charm - will modify as I see fit :)</p>
<p>I Made it!</p>
<p>There's something wrong, with my LM35, when i connect it directly to my mega, it works correctly it shows the correct temperature but then when i connect with with ethernet shield w5200, the sensor reading become weird its like random or something. but when i use other sensors like LDR and gas sensor, it just works fine. anyone experience this before? can help me? ps: ethernet shield w5200 with teleduino library </p>
<p>Hi , I have the same issue , can you help me please , how i can solve this problem ?</p>
<p>Do yuo test both sensors with the same analog pin (I mean analog 0 or 1).</p><p>As far as I know, w5200 has sdcard slot on it and it uses analog 0 and 1 pins for sd card Access.</p><p>Probably it will be ok when you try on other pins such as A3</p>
<p>yes, using the same pin its analog 15 (mega 2560), i'll take not on the pin that the w5200 uses. i didnt know what i did but now its working. thanks. </p>
<p>Interesting and easy to understand, thanks for the sample code, I was able to tweak it for my own needs :D </p>
<p>I do not know how it happens, but measurements that vary completely randomly of an entire degree are useless. </p><p>How do I avoid this noise.</p>
thank you
<p>The value of the temperature is opposite. When it is cold the temperature value increases, while when it is hot the temperature value decreases. How to fix this? HELP ME! T_T</p>
double check your connection<br>
<p>I'm trying to make something where the arduino changes the color of a rgb led based on the temperature, I think i have the code to use a rgb led with it but i don't know how the code would go to have it do different commands based off of the temperature. I'm assuming it has something to do with setting the minimum mV and maximum mV from the LM35's output for that command or colour. Any ideas would be helpful! Thanks!</p>
<p>This might help:</p><p><a href="https://publiclab.org/notes/warren/12-12-2011/circuit-diagram-simple-thermal-flashlight" rel="nofollow">https://publiclab.org/notes/warren/12-12-2011/circ...</a></p>
<p>thanks for the info</p>
<p>sir how can download pdf for this project</p>
<p>sir how can download pdf for this project</p>
<p>Hello. I'm somewhat new to Arduino and I have a box of random sensors, one of which was the temp sensor. I tried out this program but the sensor kept on giving me high values ranging from 180*C to sometimes at the 400s. I am using an Arduino Mega and I have tried all possible configurations. There is only one that works, the other ways two heat up my sensor...</p><p>And it's nothing wrong with my Arduino because I tried it with two of the same board.</p><p>How can I get this to work?</p>
Don't keep the length of sensor pin wire (A0- to lm35) long..<br>kepp it as short as possible<br>and check your connection..
<p>I had that happen the other night with a project that was just fine minutes before. I had accidentally knocked a wire loose. I reconnected it and the sensor felt like it really WAS 440 degrees. I reversed it and it was fine. Can't explain all that, but I tried to reset my Arduino several times first, and this was the only thing that worked.</p>
<p>I m getting d output as 132.34*C .....in ds pattern nly but not as 23*C n all...wat crctns can I make ????</p>
Don't keep the length of sensor pin wire (A0- to lm35) long..<br>kepp it as short as possible
just check the wiring once again ...<br>see the picture and connect exactly as shown in image<br>
<p>Hi, I've got wrong temperature. I have 2 pieces of lm35DZ sensor, one of them read 451.9 and the other show numbers between zero and 24.38, correct temperature of my desktop is 26.5 degrees centigrade. I'm using pin A0 of arduino. Off course when I pull out the sensor from the bred board, my arduino UNO R3 shows some numbers. Please help me on this problem</p>
Don't keep the length of sensor pin wire (A0- to lm35) long..<br>kepp it as short as possible
<p>You should use pin A1 to work, if you read the program you should be able to figure that ... ( int tempPin = 1; )</p>
<p>Excuse me bro, This is my code and simulation. It s a bit difference from you and LCD look not so nice. But wiring is ok. Similar to <a href="https://www.instructables.com/member/karengrace.victor/" rel="nofollow">karengrace.victor</a>, i also have a problem with temperature and display it, Thanks</p>
Don't keep the length of sensor pin wire (A0- to lm35) long..<br>kepp it as short as possible
<p>please help me! :(</p><p>the output (from your code) always &quot;499.51*C&quot;</p><p>and i very very sure wired it correctly.</p><p>can u tell my how to fix this?</p><p>PLEASE :(</p>
Don't keep the length of sensor pin wire (A0- to lm35) long..<br>kepp it as short as possible
Double check your wiring and position of your sensor
<p>Hi. When I try use this code, the results are incomprehensible. results show on etched image. the result is same wen i remove temperature sensor.</p>
Don't keep the length of sensor pin wire (A0- to lm35) long..<br>kepp it as short as possible..
in your code if you use analog pin A0 then check the code whrere it should be temperature pin = 0 <br><br>if you use analog pinA1 then temp. pin=1<br>like wise...<br>
check out the connection once again please..<br>It should work..<br>
<p>CAn we send this values sensed to the other microcontroller using zigbee, if yes let me have a brief idea .</p>
yes you can connect xbee to your arduino.
Bro may i know how it can be done, i would be greatful if would be given any information about it
<p>Your Code work at first my project</p><p>Thank You</p>

About This Instructable

447,209views

131favorites

More by TAPAN MOJIDRA:ARDUINO 4*4 OR 4*3 KEYPAD :- Convert key pressed into intiger value  24*10 LED MATRIX PERFECTLY RUNNING ARDUINO AS A 8051 PROGRAMMER - CHEAPEST PROGRAMMER IN THE WORLD 
Add instructable to: