0% found this document useful (0 votes)
80 views

Temperature Sensor Using The Arduino Board Goal: To Measure and Display Temperature Using An Arduino Board Interfaced With 16x2 LCD

The document describes using an Arduino board to measure and display temperature. It explains: 1) An LM34 temperature sensor outputs a voltage proportional to degrees Fahrenheit and connects to an Arduino analog pin to measure temperature. 2) A 16x2 LCD display connects to digital pins on the Arduino to display the measured temperature readings. 3) Code is provided to read the sensor value, convert it to temperature, and print the temperature to the LCD at one second intervals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Temperature Sensor Using The Arduino Board Goal: To Measure and Display Temperature Using An Arduino Board Interfaced With 16x2 LCD

The document describes using an Arduino board to measure and display temperature. It explains: 1) An LM34 temperature sensor outputs a voltage proportional to degrees Fahrenheit and connects to an Arduino analog pin to measure temperature. 2) A 16x2 LCD display connects to digital pins on the Arduino to display the measured temperature readings. 3) Code is provided to read the sensor value, convert it to temperature, and print the temperature to the LCD at one second intervals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

UNIVERSITY OF PENNSYLVANIA

DEPARTMENT OF ELECTRICAL AND SYSTEMS ENGINEERING


ESE UNDERGRADUATE LABORATORY
Self Paced Arduino Laboratory

Temperature sensor using the Arduino board


Goal: To measure and display temperature using an Arduino Board interfaced with 16x2 LCD
Display.
Parts Required
1.
2.
3.
4.

Arduino board
USB Cable
LM 34, temperature sensor
Wires

Procedure:
a. Temperature Sensor

LM34 is a 3-pin device with 5V and GND inputs and temperature output. The LM34 is designed
to output 10 mV per degree Fahrenheit, so a reading of 0.73 V on the output pin means the
temperature is 73F. In order to use this on your Arduino you will have to connect the 5V and
GND pins to the corresponding buses on your Arduino, and wire the output pin to an analog
input pin.

Figure 1: Temperature Sensor

ESE Labs, SEAS, Univ of Pennsylvania, [email protected]

Figure 2: Arduino Board

Page 1 of 4

b. Display temperature
In order to display the measured temperature values you will have to wire the 16x2 LCD display
(Figure 4) to 6 Digital Output pins of the Arduino board.
Wire the pins according to the following assignments:
LCD

7 8 9 10 11 12 13 14 15

Arduino
GND +5V GND 12 GND 11 Board

16

+5V GND

Figure 4: 16X2 Liquid Crystal Display


LCD Display library functions are used interface the Digital I/O pins of the Arduino board with
the LCD Display. lcd.print(xxxxx) function is used to display the measured values. Refer to
the above code.
c. Compile and download the working code to the Arduino Board
Compile the following code in Arduino IDE and download it to the Arduino Board.
/*
TempSensor - University of Pennsylvania
Uses the LiquidCrystal Library to display
the real time temperature in deg. F using
the LM34 IC
The circuit:
* LCD RS pin to digital pin 12
ESE Labs, SEAS, Univ of Pennsylvania, [email protected]

Page 2 of 4

* LCD Enable pin to digital pin 11


* LCD D4 pin to digital pin 7
* LCD D5 pin to digital pin 8
* LCD D6 pin to digital pin 9
* LCD D7 pin to digital pin 10
*/

// include the library code:


#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins


LiquidCrystal lcd(12, 11, 5,4,3,2);
float tempVal;
float sensorVal;
int sensorPin = 4;

void setup() {
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Temp (deg. F)");
// initialize serial communication:
Serial.begin(9600);
}

void loop() {
lcd.clear();
// get temperature
sensorVal = (analogRead(sensorPin)/1023.0)*5.0;
tempVal = sensorVal*100.0;

ESE Labs, SEAS, Univ of Pennsylvania, [email protected]

Page 3 of 4

delay(100);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.print("Temp (deg. F):");
lcd.setCursor(0, 1);
lcd.print(tempVal);
delay(1000); //0.5sec
}

d. Questions:
i.
ii.
iii.

Explain how is temperature data acquired from the sensor using the Arduino board?
What are the maximum and minimum values of temperature you can measure using
the Arduino board?
Can you display the temperature in oC and K?

Figure 5: Measurement of temperature using Arduino board

ESE Labs, SEAS, Univ of Pennsylvania, [email protected]

Page 4 of 4

You might also like