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:

 

Sensor Pin Arduino
GND GND
Signal A1
Vcc 5 V

 

 

The connection scheme of sensor with the Arduino Uno.

 

Program for Arduino

In the example, we used the following code:

 

  1. int sensor = A1; //analog pin A1 is connected to the signal from the sensor
  2. float VOLTS;
  3. float TEMP;
  4.  
  5. void setup(){
  6. Serial.begin(9600); //initialize serial monitor
  7. Serial.println("Test temperature sensor");
  8. }
  9.  
  10. void loop(){
  11. int reading = analogRead(sensor); //read the value from the sensor
  12. VOLT = (reading * 5.0) / 1024.0; //conversion of the measured value for voltage in volts (for connection at 5 V)
  13. TEMP = VOLT * 100; //conversion from voltage to temperature, the resolution of the sensor is 10 mV per degree
  14. Serial.print("Temperature (C): "); //display it on the monitor
  15. Serial.println(TEMP);
  16.  
  17. delay(200); //delay between consecutive readings
  18. }

 

The results of the program can be seen below:

 

A screenshot of the serial monitor.

Botland.store - shop for makers!