Smart Temperature Detector Documentation
Smart Temperature Detector Documentation
1. Introduction
This project aims to create a smart temperature detector using an Arduino UNO board and an LM35
temperature sensor. The LM35 sensor detects the ambient temperature and sends data to the
Arduino, which then displays the temperature in both Celsius and Fahrenheit on a 16x2 LCD
2. Components Required
4. Potentiometer 10K - 1
5. Connecting Wires - 20
6. Breadboard - 1
3. Circuit Diagram
The LM35 temperature sensor has three pins: VCC, GND, and OUT. Connect the VCC pin to the 5V
pin of the Arduino, the GND pin to the GND of the Arduino, and the OUT pin to analog pin A0 of the
Arduino. The 16x2 LCD display is connected using I2C communication. Connect the SDA and SCL
4. Code Explanation
1. Define the sensor pin as A0 and initialize the LCD library with I2C communication.
3. In the loop function, read the analog value from the LM35 sensor and convert it to voltage.
5. Arduino Code
#define sensorPin A0
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600);
lcd.begin();
lcd.backlight();
}
void loop() {
lcd.clear();
int reading = analogRead(sensorPin);
float voltage = reading * (5.0 / 1024.0);
float temperatureC = voltage * 100;
Serial.print("Temperature: ");
lcd.setCursor(0,0);
lcd.print("Temperature:");
lcd.setCursor(0,1);
lcd.print(temperatureC);
lcd.setCursor(6,1);
lcd.print("C");
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
lcd.setCursor(8,1);
lcd.print(temperatureF);
lcd.setCursor(14,1);
lcd.print("F");
delay(1000);
}
6. Working Principle
The LM35 sensor measures temperature based on the voltage across its terminals, which varies
with temperature. The Arduino reads the voltage output from the sensor, converts it to Celsius, and
then displays it on the 16x2 LCD. The temperature is also converted to Fahrenheit for easy
reference.
7. Conclusion
This project demonstrates the use of an LM35 temperature sensor with an Arduino to display
real-time temperature data in Celsius and Fahrenheit. This setup can be used in various applications
where temperature monitoring is needed, such as environmental monitoring and home automation.