Arduino Uno: Temperature Sensor With Display

Published

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

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)

Share

Recommendations

  • Oil Contest

    Oil Contest
  • Clocks Contest

    Clocks Contest
  • Creative Misuse Contest

    Creative Misuse Contest

8 Discussions

What's the potentiometer for? I really Dont Understand

2 replies

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

The potentiometer is for adjusting the contrast of the display.

will it work with 2 pin thermistor??

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

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

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