Introduction
We built an IoT based system which can automatically switch ON room lights and fan when at least one person is present in the room. If room is empty, the lights and fan will automatically get switch off. It also displays count of persons present in the room.
We build this system using Arduino and IR sensor module.
Hardware used
- Two IR Sensors
- Arduino UNO
- Relay module
- Dc motor with propeller
- Bulb
- LCD display
- Breadboard
- Battery (9 V)
- Jumper wires
Project Overview
For building this application we have used arduino along with IR sensors and relay module.
- We have used two IR sensors one for detecting person entering into the room and
other for detecting person leaving (exit) the room. - Also these IR sensors are also used to count the person entering and leaving the room. This person counting will help to automate the room's fan and light. That means when the room is empty, the room's light and fan will remain off. But if someone enters the room then the room's light and fan will get turned ON automatically with person count displayed on LCD.
Working of IR sensor
The basic concept of IR sensor is to transmit an infrared signal, this signal bounces back from the surface of an object and signal is received at the infrared receiver.
Project Implementation
When person enters the room infrared signal bounces back and get received by infrared receiver which is considered as entry.
Therefore count is incremented.
if (digitalRead(In) == LOW)
{
count++;
}
Similarly for person leaving the room, count is decremented on detection.
else if (digitalRead(Out) == LOW)
{
count--;
}
When count is more than zero,Relay gets high therefore room lights and fan turn on
and for count less than or equal to zero relay gets low, so light and fan will get turn off.
else if (count > 0)
{
digitalWrite(relay, HIGH);
}
else if(count <= 0){
digitalWrite(relay, LOW);
}
Connection Diagram
Design Steps
- Now to design this circuit we have to interface 16x2 LCD with Arduino UNO as shown in diagram.
- Two IR sensors are connected to digital input pin 4 and 5 of Arduino UNO. (Pin 4 is for entry and pin 5 is for exit.)
- Relay module is connected to GPIO pin of Arduino UNO.
- Bulb and DC motor with propeller are connected in series with relay.
- Upload the code to the Arduino UNO.