Professional Documents
Culture Documents
Aim:
To write a program for detecting the temperature using a temperature sensor(LM35) in
Arduino – UNO 3 board and verifying the output.
Requirement:
S. No Apparatus Quantity
Project Explanation:
Temperature Sensor LM35:
LM35 is a temperature-measuring device having an analog output voltage proportional to the
temperature. It provides output voltage in Centigrade (Celsius). It does not require any
external calibration circuitry. The sensitivity of LM35 is 10 mV/degree Celsius. As
temperature increases, the output voltage also increases. It is a 3-terminal sensor used to
measure surrounding temperatures ranging from -55 °C to 150 °C.LM35 gives temperature
output that is more precise than thermistor output.
Arduino UNO board:
A microcontroller board is based on the ATmega328P. It has 14 digital input/output pins (of
which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB
connection, a power jack, an ICSP header and a reset button. ,Connect it to a computer with
a USB cable or power it witan h AC-to-DC adapter or battery to get started.
Procedure for Connection:
Step 1 : Connect temperature sensor LM35 to the bread board.
Step 2 : Connect Arduino 5V to Sensor pin 1( Vcc)
Step 3 : Connect Arduino Ground pin to Sensor pin (GND pin)
Step 4 : Connect Arduino analog pin 0 to sensor pin 2
Step 5 : Upload the code and open the serial monitor to note readings of the
temperature.
Step 6: Set the serial monitor in 9600bauds.
Program Code:
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();
*/
}
Submitted to