Introduction: How to Display Temperature Using a LM35 and Arduino UNO

In this instructable, I will show you how connect a LM35 temperature sensor to an Arduino UNO and read the temperature in degrees Celsius on the serial monitor.

Step 1: Here Is What You'll Need

For this project you'll need:

1 Arduino UNO

1 LM35 temperature sensor

1 Breadboard

few jumper wires

Step 2: Connect the Electronics

There are three pins on the LM35 Ground (GND), Signal and a VCC

Place the LM35 with the flat surface facing you:

The VCC pin will be on the left, connect it to the Red + rail on the breadboard

The signal pin is in the middle, connect it to the Analog 0 (A0) on the Arduino

The Ground pin will be on the right, connect it to the - Blue rail on the breadboard.

See picture for more details

Connect the 5V from the Arduino to the + red rail on the breadboard

Connect the GND from the Arduino to the - blue rail on the breadboard

Step 3: Sketch

This is a simple sketch:

Start by defining variables:

temp is a variable that will hold the data from the LM35 sensor and we will manipulate this data to convert it to Celsius later in the sketch

float temp;        //Define the temp float variable
int sensor = 0;     // sensor middle pin on analog pin 0

In the void setup, just start the serial monitor which we will use the read the temperature from.

void setup()
{Serial.begin(9600); //start the serial monitor}

Here We will read the data from the LM35 using analogread(sensor) and store this information in the variable temp. The we will multiply this value with 0.48828125 to convert from volts to degrees Celsius.

void loop(){
temp = analogRead(sensor);        //assigning the analog output to temp
temp = temp * 0.48828125;         //converting volts to degrees celsius ----- 0.48828125 = [(5V*1000)/1024]10

The next series of lines will display the information on the serial monitor in this format:

The temperature is : VALUE deg. Celsius

and it will repeat this line every second.

Serial.print("The temperature is :");
Serial.println("deg. Celsius"); 

I attached the sketch in this instructable, all you have to do is unzip it and upload it to the Arduino.

I will be posting another instructable showing how to display the temperature on an LCD

Have fun



Nice work. Thanks for the Ible.