Introduction: LCD Thermometer - Arduino

About: Hi! I'm Hugo, 15 yo student from the Alps. I spend most of my spare time programming, tinkering, building electronic stuff, observing planets through my telescope, learning to pilot airplanes, reading and day…

Let's learn how to create a thermometer that displays the temperature on an LCD !

Step 1: Hardware Needed

-An Arduino Uno

-A breadboard

-Jumper wires

-A 10K potentiometer

-A temperature sensor

-And of course, an LCD (Liquid Crystal Display)

You won't need any tool.

Step 2: Build the Circuit

The steps here correspond to the image above...

First, pin your LCD on your breadboard and power the breadboard by connecting a wire from "5V" on your Arduino to the positive row on the breadboard and another one from "GND" (ground or 0V) to the negative row.

Then connect the LCD to the Arduino:

LCD pin 4 - Arduino pin 2

Pin 6 - pin 3

Pin 11 - pin 4

Pin 12 - pin 5

Pin 13 - pin 6

Pin 14 - pin 7

After that, power the LCD:

LCD pin 1 = GND (on the breadboard)

Pin 2 = 5V

Pin 5 = GND

Pin 15 = 5V

Pin 16 = GND

Then connect pin 3 of your LCD to the central pin of the 10K potentiometer.

Finally, power the potentiometer with one pin on GND and the other one on 5V (on the breadboard).

Finally, power your temperature sensor like the potentiometer and connect its central pin to pin A0 (analog input) on your Arduino.

Step 3: Code

Now let's write the code:

#include <LiquidCrystal.h> //Include the library that enables you to use the LCD.
const int sensorPin = A0;//Declare that your sensor is connected to pin A0 on your arduino.
LiquidCrystal lcd(2,3,4,5,6,7);//Declare that your LCD is connected to pins 2,3,4,5,6 & 7 on your arduino.

void setup() {
  for(int pinNumber = 2; pinNumber<8; pinNumber++){
  pinMode(pinNumber,OUTPUT);//These two lines mean that the LCD pins are outputs for the Arduino 
  }
  }

    void loop() {
    int sensorVal = analogRead(sensorPin);//Declare that you read the data coming from the sensor
    float voltage = (sensorVal/1024.0) * 5.0;//Change the value of the data (0-1024) to a voltage (0-5)
    float temperature = (voltage - .5) * 100;//Translate this voltage to a temperature.
    lcd.begin(16, 2);//16 by 2 are the dimensions of the LCD (in number of characters)
    lcd.print(temperature);//print the temperature on the LCD
    lcd.print(" *C");//print "degrees Celsius" on the LCD.
    delay(1500);//print the text on the LCD every 1.5 second. This will enable the Arduino to print the exact temperature at approximately in real time, without making the screen blink.
        }