Introduction: LM35 Temperature Sensor Interfaced With Arduino Uno

#arduino #LM35

Step 1: Collect All the Stuff!

You would need:

1) Arduino Uno board or equivalent.

2) LM35 temperature sensor.

3) Bread board.

4) USB (as supported by the board)

5) Arduino IDE.

6) Connecting wires.

All the required components are avilable on amazon as well as at local market if you're willing to venture.

I've given some links for some of the components should you wish to check :)

Arduino Uno:http://www.amazon.in/Arduino-UNO-board-DIP-ATmega3...

LM35: http://www.amazon.in/Robomart-LM-35-Temperature-Se...

Arduino IDE: https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&...

Step 2: Connections.

LM35 is a three terminal IC and reads analog voltage.

Connections are made as shown in the picture. (pins are numbered 1,2,3 from right seeing through the flat side of the IC)

  • Connect 1 to 5 Volts supply.
  • Connect 3 to GND.
  • Connect 2 to analog pin A1 of Arduino Uno.
  • Connect the supply to the bread board as shown in picture 2.

Step 3: Code!

int val;

int tempPin=A1;

void setup() {

Serial.begin(9600); //pinMode(tempPin,OUTPUT); // put your setup code here, to run once: }

void loop() {

val=analogRead(tempPin);

float cel=val/9.31;

float farh=(cel*9)/5+32;

Serial.print("TEMPERATURE in CELCIUS=");

Serial.print(cel); Serial.print("*C");

delay(5000);

Serial.println();

Serial.println("TEMPERATURE in FARHENHITE=");

Serial.print(farh);

Serial.print("*F");

delay(5000); Serial.println(); i

f (cel>25) { Serial.println("Its a hot day");

}

else {

Serial.println("Good day to be alive"); }

delay(2000);

Serial.println();

}

Step 4: Upload the Code

upload the code on your arduino. Open the Serial Monitor to see your circuit in work!