iot ass 1
iot ass 1
ASSIGNMENT - 2
Submitted by
K.AISHWARYA (Reg.No:921722102005)
A.ABIRAMI (Reg.No:921722102003)
K.HARINI (Reg.No:921722102046)
S.DHIKSHA (Reg.No921722102037)
BACHELOR OF ENGINEERING
in
COMPUTER SCIENCE AND ENGINEERING
This Smart Home Automation System is built using an Arduino Uno R3 and multiple
sensors to automate home appliances and enhance security. The system includes a PIR
sensor for motion detection, an ultrasonic sensor for distance measurement, and a gas
sensor for detecting hazardous gases. A relay module is used to control electrical devices
like a bulb and a motor. The system displays real-time data on a 16×2 LCD display.
Step-by-Step Implementation
1. Components Required
2. Circuit Connections
1. Power Connections
o Connect the VCC of sensors and LCD to 5V on Arduino.
o Connect the GND of all components to GND on Arduino.
2. LCD Display (16×2)
o Connect RS, E, D4-D7 to Arduino digital pins.
o Connect VSS, RW, K to GND.
o Connect VDD, A to 5V.
o Use a potentiometer to adjust contrast.
4. PIR Sensor
o VCC → 5V
o GND → GND
o OUT → Digital Pin (e.g., 7)
5. Gas Sensor
o VCC → 5V
o GND → GND
o A0/D0 → Analog/Digital Pin (e.g., A0)
6. Relay Module
o VCC → 5V
o GND → GND
o IN → Digital Pin (e.g., 6)
o Common (C) → Bulb One Terminal
o Normally Open (NO) → Power Supply Live Wire
o Other Bulb Terminal → Power Supply Neutral Wire
7. DC Motor
o Controlled using relay or motor driver module.
8. Slide Switch
o Used to turn the system ON/OFF.
Code :
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
// Reads the echo pin, and returns the sound wave travel time in microseconds
return pulseIn(echoPin, HIGH);
}
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
pinMode(releNO, OUTPUT);
pinMode(inputPir, INPUT);
pinMode(sensorLDR, INPUT);
Serial.begin(9600);
}
void loop() {
// set threshold distance to activate LEDs
distanceThreshold = 350;
// measure the ping time in cm
cm = 0.01723 * readUltrasonicDistance(7, 6);
// convert to inches by dividing by 2.54
inches = (cm / 2.54);
lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will
be displayed
lcd.print("D:"); // Prints string "Distance" on the LCD
lcd.print(cm); // Prints the distance value from the sensor
lcd.print("cm");
delay(10);
val = digitalRead(inputPir);
resuldoSensorLDR = analogRead(sensorLDR);
if(resuldoSensorLDR<600)
{
if(val == HIGH)
{
digitalWrite(releNO, HIGH);
lcd.setCursor(0,1);
lcd.print("L: On ");
delay(5000);
}
else{
digitalWrite(releNO, LOW);lcd.setCursor(0,1);
lcd.print("L: Off");
delay(300);
}
}
else{ digitalWrite (releNO, LOW);
Serial.println(resuldoSensorLDR);
delay(500);
}
delay(250);
}
Output ;
Usefulness of Smart Home Automation System in Society
This Smart Home Automation System has various benefits that contribute to safety,
energy efficiency, and convenience in daily life. Here’s how it helps society:
Automatic Light Control: The PIR sensor detects human movement and turns
on/off lights, reducing electricity wastage.
Smart Fan/Motor Control: The ultrasonic sensor can detect room occupancy and
adjust fan/motor operation, saving power.
Motion Detection: The PIR sensor can act as an intruder detection system,
triggering alarms or sending notifications.
Gas Leak Detection: The gas sensor detects harmful gases (e.g., LPG, CO) and
prevents accidents by alerting homeowners.
Remote & Smart Control: The system can be expanded to work with IoT,
allowing users to control appliances via a smartphone.
LCD Display for Alerts: Real-time updates on temperature, gas leaks, and motion
detection help users stay informed.
5. Disaster Prevention
Early Gas Leak Alerts: This system can prevent fire hazards caused by gas leaks.
Smart Power Control: Automatically turns off appliances when no one is
present, preventing electrical hazards.
Future Scope