Categories

Temperature reading using Arduino and LM35DZ sensor

Temperature reading using an Arduino and a sensor LM35DZ

A tutorial is a method of processing a temperature sensor LM35DZ using the Arduino module.

 

In this example we used the following elements:

 

Connect the sensor with Arduino:

The sensor using the Arduino you should connect the layout as follows:

 

SensorPin Arduino
GNDGND
SignalA1
Vcc5 V

 

 

The connection scheme of sensor with the Arduino Uno.

 

Program for Arduino

In the example, we used the following code:

 

int sensor = A1; //analog pin A1 is connected to the signal from the sensor 
float VOLTS; 
float TEMP; 

void setup(){ 
 Serial.begin(9600); //initialize serial monitor 
 Serial.println("Test temperature sensor"); 
} 

void loop(){ 
 int reading = analogRead(sensor); //read the value from the sensor 
 VOLT = (reading * 5.0) / 1024.0; //conversion of the measured value for voltage in volts (for connection at 5 V) 
 TEMP = VOLT * 100; //conversion from voltage to temperature, the resolution of the sensor is 10 mV per degree 
 Serial.print("Temperature (C): "); //display it on the monitor 
 Serial.println(TEMP); 

 delay(200); //delay between consecutive readings 
} 

 

The results of the program can be seen below:

 

A screenshot of the serial monitor.