LM-35 Temperature Sensor and Arduino-Temperature Monitor using LCD Display

In this article, we are going to make a device That can Sense and Display Temperature on LCD  and control LED by Temperature. We are going to learn how to interface LM-35 Temperature Sensor and Arduino along with Arduino code. 

We are going to use the following components for this project:

  1. Arduino MEGA 2560 microcontroller
  2. LM35 Temperature Sensor
  3. 16X2 LCD Display
  4. LEDs
  5. 10K Registers
  6. Bread Board and Wires.

The Arduino Mega 2560 is a powerful microcontroller board based on the ATmega2560 microcontroller. This is one of the popular Arduino boards in the Arduino family. It has 54 digital i/o pins. 14 pins can be used as PWM pins, 16 pins can be used as analog inputs, 4 UARTs which are known as hardware serial ports, a USB connection, a power jack, a reset button, etc. It contains everything needed to support the microcontroller. We have to simply connect it to a computer with a USB cable or we can power it with an AC-to-DC adapter or battery to get started. 

Arduino Mega-2560

Arduino Mega-2560

LM-35 sensor is a temperature sensor that can be connected to an Arduino board to measure the current temperature of any place. it's an analog linear temperature sensor. The output voltage varies linearly with a change in temperature. This sensor has three pins(VCC, GND, out). The pinout of  LM35 is shown in the figure below:

LM-35 sensor
LM-35 Temperature Sensor

LM35 Interfacing with Arduino Mega-2560:

The connection between Arduino mega and LM35 is very simple. We are going to connect LM35 VCC to Arduino VCC, LM35 GND to any on the Arduino GND, and Vout to Arduino Ao analog pin. 

LM35 connections with Arduino Mega2560

QC1602A 16x2 LCD display is an LCD display with 16 columns and 2 rows that can be connected to an Arduino board to display any character or string. 

QC1602A 16x2 LCD display

16X2 LCD Display

16x2 liquid crystal display(LCD) with Arduino Board: 

Let's connect LCD with Arduino board. First, we power up the LCD display by connecting LCDs VSS and VDD pin to boards GND and 5v pin respectively. 

As the  RS pin or register select pin is used for sending commands or data to the LCD (For example if the RS pin is set on low commands to the LCD like set the cursor to a specific location, clear the display, turn off the display and so on, and when RS pin is set on High state commands like data or characters to the LCD) we will connect this pin with boards a PWM pin-like pin 12. After setting up all we can send commands to LCD like this:

lcd.setCursor(0, 1);

The RW pin is used to read from LCD or write to LCD. As we just write to the LCD we connect RS pin boards GND pin for the low state.

The E pin which enables the writing to the registers or the next 8 data pins from D0 to D7 we connect this E pin to boards any PWM pin-like pin 10. We set the pin by writing this

LiquidCrystal lcd(12, 10, 5, 4, 3, 2);  

Then we connect the LCDs data bus line D4-D7 to the board’s any 4 PWM pin-like pin 5,4,3,2 respectively. We set this pin by writing this

  // LiquidCrystal lcd(RS, E, D4, D5, D6, D7);  

    LiquidCrystal lcd(12, 10, 5, 4, 3, 2);

Pin A and K is used to set the backlight. so we connect pin A, K
to boards pin7(PWM) and GND respectively. We set the backlight by writing like this:

    int backLight = 7;
    void setup() {
    pinMode(backLight, OUTPUT);
   //sending commands to set the backlight to high(1)
   digitalWrite(backLight, HIGH);  

Pin V0 is used to set the display contrast. so we connect the pin V0 to board pin8(PWM). We can also use a potentiometer to control the contrast or we can set the contrast by writing like following:

    //setting up pin 8 to contrast
    int contrast = 8;
    void setup() {
    pinMode(contarst, OUTPUT);
   //sending commands to set the contrast to high(1)
   digitalWrite(contrast, HIGH); 
  //or analogWrite(contarst, 250);//value from 0-255 

LCD Display connection with Arduino:

From LCD

TO microcontroller






Pin 8




Pin 12


Pin 10






Pin 3


Pin 2





LED Indicator connection with Arduino:

Finally, we can connect an LED light as an indicator of high or low temperature. We will connect LED at Arduino 13 number digital pin. 

LM-35 Temperature Sensor and LCD Display Arduino Code

The program is simple and straightforward. The Arduino program for Temperature Monitor system with LM-35 Temperature Sensor and Arduino is given below:

Final Outcome Of The Project:

LM-35 Temperature Sensor and Arduino
Temperature Monitor using LCD Display

0/Post a Comment/Comments