Learn interfacing Temperature Sensor in Arduino

Learn how to use Temperature Sensor in Arduino. We will learn about the working of the Temperature Sensor and Analog Input Pins. Currently, we are using the Arduino UNO board and LM35 as Temperature Sensor. You can use any Arduino/Genuino Board or any Temperature Sensor and perform this experiment on that. Also, view the output on Serial Monitor. So, let’s start it.

Step 1: Required Components

Temperature Sensor (LM35) x 1
Arduino Uno Board x 1
Breadboard x 1
Jumper Wires

Step 2: Circuit Time

Circuit Diagram of Temperature Sensor

Make a circuit as per the given diagram. In Temperature Sensor there are three pins are available. The left-sided pin is for VCC, the middle pin is for Analog Output and the right-sided pin is for Ground. Here we have connected the Temperature Sensor to Analog Input Pin A0 of Arduino UNO Board.

Step 3: Code Time

This is the code for Temperature Sensor. Here, we have declared one pin which is for Analog Input and two variables for storing Analog Input and Temperature. In setup, the Serial Monitor is begun at 9600 Baud. In the loop, first fetched the data from the analog pin and stored it in the analoginput variable. Then converted the analog input to a temperature in C. Finally printed it to the Serial Monitor.

Step 4: Upload the code to Arduino

Upload the above-given code to the Arduino UNO Board after the components are set as per the Circuit Diagram. The Temperature Sensor will give the analog output to the Arduino, Arduino will convert it into the Temperature and finally, it will show in the Serial Monitor. The screenshot of the output of the Serial Monitor is as below.

Serial Monitor of Temperature Sensor

Learn more information about uploading code to Arduino Uno.

2 thoughts on “Learn interfacing Temperature Sensor in Arduino”

  1. Its good to see you have started from very basic. You have to add some more innovatieve projects and idea.
    There is one suggestion for this project… You should have include serial plotter as well with serial monitor for analog sensors. So from that one can easily find that wether your sensor is analog or digital.

    1. Hello, We are working on adding more projects to Iotguider. Thank you for your suggestion for adding the serial plotter to this, we will work on that.

Leave a Reply