Introduction: Measure the Temperature and Show It on a LCD Display

I made a little arduino sketch, that displays the temperature on a LCD display measured by a LM35. I used a 16X1 LCD Display. The Code is quite easy and can send the value via serial connection, too.

What you need:

Arduino Board
LCD Display
LM35 temperature sensor
resistor (for backlight)

Step 1:

Here’s my source coude (based on the example LCD code on arduino.cc):



#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define LCD_CLEAR 0b00000001 // 0×01
float temp;
int tempPin = 0;

void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
//lcd.print(“”);
}

void loop() {
temp = analogRead(tempPin);
temp = temp * 0.48828125;
lcd.setCursor(0, 0);
lcd.print(temp);
lcd.print(” C”);
delay(1000);
lcd.clear();

Serial.println(temp);

}