Automatic room light and fan controller with bidirectional visitor counter

Published Sep 25, 2018
 16 hours to build
 Beginner

Automatically turn the room lights and fan ON when at least one person is present in the room.

display image

Components Used

LCD 16x2 Display Module
LCD16x2 has two lines with 16 character in each line. LCD16x2 is generally used for printing values and string in embedded application.
1
Arduino Nano
Arduino Nano
1
Relay Module Two channel
Relay Module Two-channel
1
AK9753 IR sensor
AK9753 is a low power and compact IR (infrared) sensor module.
1
Description

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.
Project Setup

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.

IR Sensor Working Principle

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

Hardware Connection

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.
Project's Hardware
  • Upload the code to the Arduino UNO.

 

Video

Codes
Comments
Ad