CIRCUIT DIAGRAM
LM35 to Arduino UNO:
VCC (LM35) to 5V (Arduino)
GND (LM35) to GND (Arduino)
OUT (LM35) to A0 (Analog pin on Arduino)
LCD Display to Arduino UNO:
VSS to GND
VDD to 5V
V0 to a 10K potentiometer (to adjust contrast)
RS to D12
RW to GND
E to D11
D4 to D5
D5 to D4
D6 to D3
D7 to D2
A (LED Anode) to 5V via a 220Ω resistor
K (LED Cathode) to GND
REQUIRED LIBRARIES
LiquidCrystal Library:
✓ Controls the 16x2 LCD display
✓ Pre-installed in the Arduino IDE
ARDUINO CODE
#include <LiquidCrystal.h>
// Initialize the library by associating any LCD interface pin
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int LM35Pin = A0; // Pin connected to LM35
float temperature; // Variable to store the temperature
void setup() {
lcd.begin(16, 2); // Set up the LCD's number of columns and rows
lcd.print("Temp Control"); // Display welcome message
delay(2000); // Wait for 2 seconds
lcd.clear(); // Clear the LCD
void loop() {
int sensorValue = analogRead(LM35Pin); // Read LM35 output
temperature = (sensorValue * 5.0 * 100) / 1024; // Convert to temperature
lcd.setCursor(0, 0); // Set cursor to the first line
lcd.print("Temp: "); // Display "Temp: "
lcd.print(temperature); // Display the temperature value
lcd.print(" C"); // Display "C" for Celsius
delay(1000); // Update every second
}
PIN CONFIGURATION
1. LM35
2. LCD 16x2
3. Arduino UNO