Skip to content

Simplest Arduino based thermometer using LM35 and LCD i2c screen

Hello there, this is an easy project to start with if you’re new to Arduino, this is my first project and pretty much my first contact with Arduino World.

It’s an easy thermometer, temperature sensor used with Arduino and a LCD i2c display. It measures and shows the ambient temperature in °C, you can do a little math to display it in °F.

The LM35z has a range of 0-100°C, linear, has an Analog output and can be used in all standard applications.

Wiring:

The wiring is easy as well, the sensor pins are VCC/OUT/GND are wired with respectively 5V/A0/GND.
A0 or any analog input will do the work, but don’t forget to modify the code.

The LCD i2c has 4 pins GND/VCC/SDA/SCL are wired respectively with GND/5V/A4/A5.

Libraries:

The only library I used is the LCD i²c New _liquid_crystal, you can use any library you want just adapt the functions.

In case you use a standard LCD you’ll need another library and suitable functions.

LCD i2c Library: Download library

 

Code:

Download the code here: Download .ino or:

 

 

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

2 thoughts on “Simplest Arduino based thermometer using LM35 and LCD i2c screen Leave a comment

  1. Good night;
    Below is the correct Source Code, since the one on your Site contains some errors:

    //Arduino Thermometer using LM35DZ sensor with a LCD display

    //SurtrTech Youtube channel

    #include //Libraries for I2C and LCD

    #include

    #include

    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 😀

    #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() {

    Serial.begin(9600);

    lcd.begin (16,2);

    lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);

    lcd.setBacklight(HIGH);

    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.clear();

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

    lcd.print(“Temperature”);
    lcd.setCursor (0,1);

    lcd.print(temp); //Temperature value

    lcd.print(” C”); //Celsius of course 😀

    delay(1000); //Refresh every 1s

    }

  2. ERROR MESSAGE – Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: “Arduino Uno”

    LM35_temperature_display_on_I2C_LCD:5:37: error: #include expects “FILENAME” or

    #include //Libraries for I2C and LCD

    ^

    LM35_temperature_display_on_I2C_LCD:7:9: error: #include expects “FILENAME” or

    #include

    ^

    LM35_temperature_display_on_I2C_LCD:9:9: error: #include expects “FILENAME” or

    #include

    ^

    exit status 1

    #include expects “FILENAME” or

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

Leave a Reply

Discover more from SURTR TECHNOLOGY

Subscribe now to keep reading and get access to the full archive.

Continue reading