Skip to content

Simplest Arduino based thermometer using LM35 and LCD i2c screen

Hi everyone, this is a quick diy thermometer based on Arduino and LM35 temperature sensor and shown on a LCD I2C screen




LCD i2c Library: Download library




//Arduino Thermometer using LM35DZ sensor with a LCD display

//SurtrTech Youtube channel

#include <Wire.h> //Libraries for I2C and LCD

#include <LCD.h>

#include <LiquidCrystal_I2C.h>

float temp;   //Variable where we will stock the temperature value

int tempPin = 0; //Pin used with the sensor output here it's A0

#define I2C_ADDR 0x27 //I2C Adress

#define BACKLIGHT_PIN 3 //LCD Stuffs :D

#define En_pin 2

#define Rw_pin 1

#define Rs_pin 0

#define D4_pin 4

#define D5_pin 5

#define D6_pin 6

#define D7_pin 7

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup() {


  lcd.begin (16,2);



  lcd.home ();


void loop()


  temp = analogRead(tempPin); //Reading the value from the analog input

  temp = temp * 0.48828125; //Sensor calibration to get the real value


    lcd.setCursor (0,0); //Start writing on 0.0 on lcd screen


    lcd.setCursor (0,1);

    lcd.print(temp); //Temperature value

    lcd.print(" C"); //Celsius of course :D


     delay(1000); //Refresh every 1s




Yassine View All

Electronics, Automation engineering student... I try to share my little experience with other electronics amateur.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s