loading

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.
        }
great job !!!
super it's working
<p>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.</p><p>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</p>
<p>Actually, yes the pots in the starter kit are 2-1 pins. </p><p>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. </p><p>One day I also heated up the TMP because I switched the connections, but it wasn't broken.</p><p>For the LCD, make sure the connections are the right ones(checkout this video: <iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/eKuvpRsHv9o" width="500"></iframe>) </p><p>Have fun tinkering!</p>
<p>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)</p>
<p>Model of temperature sensor ?</p>
TMP 36
<p>Thanks.</p>
You're welcome. Mine comes from Arduino starter kit
<p>very nice, thanks for this.</p><p>I think there is a mistake</p><p>float temperature = (voltage- .5) * 100</p><p>must</p><p>float temperature = (voltage- .05) * 100</p>
Actually, these 2 lines of code come from the book in the Arduino starter kit, i just copied them...
<p>Great stuff , cannot wait to try .</p><p>thanks for your instructable </p>
<p>Great Project for the beginner like me. Thank you</p>

About This Instructable

1,232views

30favorites

License:

Bio: Hi! I'm Hugo, 15 yo student from the French Alps. I spend most of my spare time programming, tinkering, building electronic stuff, observing planets ... More »
More by Hugo Trombert:Remote Controlled Telescope - Arduino Bluetooth robot arm + app | Arduino & Android Telescope motorization (focus + orientation) 
Add instructable to: