Introduction: Arduino Uno: Temperature Sensor With Display

Picture of 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

Step 1: Step 1: Wiring

Picture of 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

Picture of 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)

Comments

MAQ2259 (author)2017-01-04

What's the potentiometer for? I really Dont Understand

ShiroN1 (author)MAQ22592017-08-08

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

LaszloK33 (author)ShiroN12017-10-18

The potentiometer is for adjusting the contrast of the display.

NikeshV1 (author)2017-04-18

will it work with 2 pin thermistor??

phmontalvao made it! (author)2016-11-02

Really nice tutorial. Nice job AlexanderP23 ! Thanks

AlfredZ (author)2016-06-25

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

AlfredZ (author)2016-06-25

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

Ignacio AlejandroA (author)2016-06-23

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

seamster (author)2015-08-17

Nicely done. Thanks for sharing this!

About This Instructable

13,011views

14favorites

License:

Add instructable to: