# LCD Thermometer - Arduino

1,751

30

12

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

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Hardware Needed

-An Arduino Uno

-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).

## 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.
}```

## Recommendations

• ### Internet of Things Class

22,715 Enrolled

## 12 Discussions

Hello, I just got the starter pack and was interested in this type of project. I thik they chamged the potentionmeter from a 3 legs on one side to a 2-1 but I can put it on the other side.

My LCD only displays a white screen when the potentionmeter is bugged out. Also, tying to fix it, im pretty sure I switched the TMP around, but it didnt burst to flames, it just heated up

2 replies

Actually, yes the pots in the starter kit are 2-1 pins.

On the side with 2 pins, one must be connected to ground, the other to 5V. The pin on the other side must be connected to pin 3 on the LCD.

One day I also heated up the TMP because I switched the connections, but it wasn't broken.

For the LCD, make sure the connections are the right ones(checkout this video: )

Have fun tinkering!

BTW in this video, he switched the connections from 2,3,4,5,6,7 on the arduino to 7,6,5,4,3,2. If you do like him, you'll have to reverse the numbers at the beginning of your code (2nd line)

very nice, thanks for this.

I think there is a mistake

float temperature = (voltage- .5) * 100

must

float temperature = (voltage- .05) * 100