Arduino Uno: Temperature Sensor With Display

25,303

17

10

Introduction: Arduino Uno: Temperature Sensor With Display

I wrote a code that displays the temperature on an LCD screen. I used these components:

  • Arduino Uno board (rev 3)
  • 2x16 character LCD display
  • breadboard
  • TMP36 temperature sensor
  • Potentiometer

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: Step 1: Wiring

Wiring the LCD

Here's some explanation for the wiring of the LCD: pin 7 to 10 is not used in this case. Pin 11 to 14 are used to sent the characters to the display. Pin 14 is the power for the LED backlight and needs to be connected tot +5V with a 220 Ohm resistor in series. Pin 16 is the ground for the LED backlight and needs to be connected to the ground of the Arduino. Pin 1 (Vss) needs to be connected to the ground. Pin 2 needs to be connected to +5V. Both pin 1 and 2 power the LCD display. Pin 3 needs to be connected to the middel connector of the potentiometer and is used tot control the contrast of the display. Pin 4 is the register select connector and controls where the characters will appear on the display. This pin is connected to pin 12 of the Arduino Uno. Pin 5 is the read/write pin and because we will use the display to show things, we'll write to the display. To use the write mode, we need to connect pin 5 to the ground. Pin 6 is the enabler pin and tells the display it wil be receiving a command. This one is connected tot pin 11 of the Arduino Uno.

Wiring the TMP36 temperature sensor

The sensor has 3 pins. When facing the flat side of the sensor, this is the pin layout:

  • Left pin: +5V
  • Middle pin: analog output (0-5V)
  • Right pin: GND

DON'T switch the left and right pin!

Step 2: Step 2: Write the Code

The code is not that difficult to understand. The key of the code is this: when you read the sensor value in a loop and write it everytime to the display, the value changes constantly. To avoid this, I read the sensorvalue every second and I store it in an array. After 30 seconds, I'm calculating the mean of the values and this value, I write to the display. The value still varies but it's much more stable.

The code: Temperature_LCD.ino (also attached as images)

1 Person Made This Project!

Recommendations

  • Backyard Contest

    Backyard Contest
  • Silly Hats Speed Challenge

    Silly Hats Speed Challenge
  • Finish It Already Speed Challenge

    Finish It Already Speed Challenge

10 Discussions

0
Sebastian Leo
Sebastian Leo

2 months ago

Great Job! You are the first instructable that I found with an error-free program. I Hooked everything up correctly and I have been having trouble powering this thing. What battery did you use to power this project? I am trying to use a 9v but the LCD is not turning on. The Arduino turns on but then the light slowly fades and the electricity regulator overheats. And I need to have an answer as soon as possible because I am making a temperature monitor so that when it is the summer I can know when to turn on the fan for the chickens since I live in the desert.

0
MAQ2259
MAQ2259

3 years ago

What's the potentiometer for? I really Dont Understand

0
ShiroN1
ShiroN1

Reply 2 years ago

I think it's for the accuracy of the reading.

0
LaszloK33
LaszloK33

Reply 2 years ago

The potentiometer is for adjusting the contrast of the display.

0
NikeshVenkata
NikeshVenkata

3 years ago

will it work with 2 pin thermistor??

0
AlfredZ
AlfredZ

3 years ago

Ive been wondering, why is the potentiometer here? Is it just to serve as a resistor or whatnot?

0
AlfredZ
AlfredZ

3 years ago

Ive been wondering, why is the potentiometer here? Is it just to serve as a resistor or whatnot?

0
Ignacio AlejandroA
Ignacio AlejandroA

3 years ago

Hi, is a nice project, thanks for sharing this!!! ^^