You are on page 1of 3

ARDUINO PROJECT

SIMPLE ROOM TEMPERATURE READOUT

A simple program and hardware to read room temperature from LM35


(Precision Centigrade Temperature Sensors) and display the temperature
in degree centigrade on 16X2 LCD. The hardware can be easily
assembled on Breadboard. Some instructions are redundant and are
added in just to show their usage. This program can be easily expended
for more complex usage.

//Program to read analog temperature from LM35 and show on LCD

//LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)

//LCD 1 Gnd, 2 VCC, 3 intensity, 4 RS, 5 R/W, 6 enable, 11 D0, 12 D1, 13 D2, 14 D3.

// LiquidCrystal display with:

// rs on pin 10

// rw on pin 9

// enable on pin 8

// d0, d1, d2, d3 on pins 5, 4, 3, 2

#include <LiquidCrystal.h>

LiquidCrystal lcd(10, 9, 8, 5, 4, 3, 2);

int refval = 0;

char* str1[] = {

"CHANNEL A", "CHANNEL B", "CHANNEL C"};

void setup()
{

//Initialise I/O ports. Not used

pinMode(12,OUTPUT);

pinMode(13,OUTPUT);

pinMode(11,OUTPUT);

pinMode(7,INPUT);

digitalWrite(12,LOW);

void loop()

refval = analogRead(0);

refval = refval/2;

lcd.clear();

lcd.print(str1[0]);

lcd.setCursor(1,1);

lcd.print("Temp");

lcd.print(" : ");

lcd.print(refval);

lcd.print(223,BYTE);

lcd.print("C");

delay(100);

}
HARDWARE