Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Automatic_Room_Light_Controller_Using_Arduino_and_PIR_sensors

The document presents a thesis report on the design and simulation of an Automatic Room Light Controller using Arduino and PIR sensors, aimed at reducing energy consumption by automatically controlling lighting based on human presence. The project includes a visitor counter to track the number of individuals entering and leaving the room, with results displayed on an LCD. The report outlines the project's objectives, significance, limitations, and detailed descriptions of the system components and design procedures.

Uploaded by

yonas505275
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Automatic_Room_Light_Controller_Using_Arduino_and_PIR_sensors

The document presents a thesis report on the design and simulation of an Automatic Room Light Controller using Arduino and PIR sensors, aimed at reducing energy consumption by automatically controlling lighting based on human presence. The project includes a visitor counter to track the number of individuals entering and leaving the room, with results displayed on an LCD. The report outlines the project's objectives, significance, limitations, and detailed descriptions of the system components and design procedures.

Uploaded by

yonas505275
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

MEKELLE UNIVERSITY

MU MIT

DEPARTMENT OF ELECTRICAL AND ELECTRONICS


ENGINEERING (EEE)

DESIGN AND SIMULATION OF AUTOMATIC ROOM LIGHT


CONTROLLER USING ARDUINO AND PIR SENSORS
Thesis report

PROJECT MEMBERS:

Name Id Dept Year

Yonas Kelem mit/ur/241/11 EEE 4th

Girmay Haftu mit/ur/097/11 EEE 4th

Akberet G/medhin mit/ur/011/11 EEE 4th

Zerabruk Abrha mit/ur/249/11 EEE 4th

Advisor: Inst. Weldie D


Abstract
This project presents the design and implementation of an Automatic Room Light
Controller using Arduino microcontroller technology and Passive Infrared (PIR) sensors.
The primary objective is to create a system that detects human presence within a room
and automatically controls the lighting based on occupancy, thereby reducing
unnecessary energy consumption. our Project ‘Automatic Room Light Controller Using
Arduino microcontroller and bidirectional visitor counter’ controls a room light as well
as count the number of individuals entering and leaving a room. When an individual
enters into a room then one counter is incremented by one and one light in a room will be
switched ON and when the individual leaves a room then the counter is decremented by
one. Lights will turn OFF when all the individuals go out of a room. The total number of
individuals present inside a room is also displayed on the LCD display. PIR sensors and
microcontrollers do the above job. PIR sensors sense the obstruction and the
microcontroller receives the signals produced by the obstruction from the sensors. The
received signal is operated via a program stored in the ROM of the Microcontroller.
Table of Contents
Abstract ..............................................................................................................................I
List of figures .................................................................................................................. IV
List of symbols and abbreviations ................................................................................... V
Chapter One ...................................................................................................................... 1
Introduction ....................................................................................................................... 1
1.1 Overview ................................................................................................................. 1
1.2 Problem of the Statement ........................................................................................ 2
1.3 Objective of the Project .......................................................................................... 2
1.3.1 General objective: ............................................................................................ 2
1.3.2 Specific objective ............................................................................................. 2
1.4 Significance of the Project ...................................................................................... 3
1.5 Limitation of the Project ......................................................................................... 3
1.6 Organization of Project ........................................................................................... 4
Chapter Two ...................................................................................................................... 5
Literature Review .............................................................................................................. 5
2.1 Microcontroller Based Systems .............................................................................. 5
Chapter Three.................................................................................................................... 7
System components description ........................................................................................ 7
3.1 Introduction ............................................................................................................. 7
3.2 components used ..................................................................................................... 7
Chapter Four ................................................................................................................... 14
System design procedure ................................................................................................ 14
4.1 The Design ............................................................................................................ 14
4.1.1 Block Diagram ............................................................................................... 14
4.2 Interfacing with Arduino Microcontroller ............................................................ 15
4.2.1 Arduino Microcontroller ................................................................................ 15
4.2.2 Liquid Crystal Display (LCD) Interface ........................................................ 15
4.2.3 Relay to microcontroller interface circuit ...................................................... 17
4.2.4 Infrared Sensor interface to microcontroller .................................................. 17
4.3 Working operation of the system .......................................................................... 18
4.4 Flow diagram of the system .................................................................................. 20
Chapter Five .................................................................................................................... 21

II
Simulation and Result ..................................................................................................... 21
5.1 Software design ..................................................................................................... 21
5.1.1 Arduino IDE ................................................................................................. 21
5.1.2 Proteus 8......................................................................................................... 21
5.2 Testing................................................................................................................... 22
Chapter Six...................................................................................................................... 27
Conclusion and Recommendation .................................................................................. 27
6.1 Conclusion ............................................................................................................ 27
6.2 Recommendation .................................................................................................. 27
References ....................................................................................................................... 28
Appendix ......................................................................................................................... 29

III
List of figures
Figure1: flow chart of project methodology ………………………………………...4
Figure2: Arduino UNO microcontroller……………………………………………...8
Figure3: PIR sensor ………………………………………………………………....10
Figure4: light dependent resistor……………………………………………………...11
Figure5: Pictorial view of LCD Display……………………………………………...11
Figure 6: schematic view of an LCD screen………………………………………….12
Figure7: relay switch………………………………………………………………….12

Figure 8: lamp…………………………………………………………………………13

Figure 9: resistor ………………………………………………………………………13

Figure 10: jumper wires………………………………………………………………...13

Figure 11: Block diagram of the automatic room light controller …………………….14

Figure 12: character LCD………………………………………………………………16

Figure 13: system design……………………………………………………………….19

Figure 14: flow diagram of automatic room light controller ………………………….20

Figure15: final circuit of automatic room light controller using Arduino

Microcontroller………………………………………………………………………...22

Figure16: system response schematic of the designed system when LDR lighted……23

Figure 17: system response schematic of the designed system when LDR no lighted and
there is occupancy …………………………………………………………………...24
Figure18: system response schematic of the designed system when LDR no lighted and
leaves one person, but still there is occupancy ……………………………………….25
Figure19: system response schematic of the designed system when LDR no lighted and
there is no occupancy ………………………………………………………………...26

IV
List of symbols and abbreviations

ARLC Automatic room light control


AGC automatic gain control

COM common

CPU central process unit

DC direct current

KB kilobyte

LCD liquid crystal display


LDR light dependent resistor
mA mill ampere
NC normally close

NO normally open

Pf Pico farad

PIR passive infrared

POR power on reset

ROM Read only memory

DBVC Digital Bidirectional Visitor Count

V
Chapter One
Introduction
1.1 Overview

In recent years, we common people are interested to interact with technology and thus
make our day to day tasks easier by creating automation. Even we are really feeling the
seriousness to save energy for ours and future generations. People are getting lazy to even
do simple tasks like switching off the lights while going outdoors, which results in a large
amount of energy wastage. Such kind of carelessness is generally seen in public and
private buildings, industries, schools, colleges and most of us are disinterested to switch
off electronic appliances such as fans and lights when not in use. This has resulted in
increased power consumption in home areas on a large scale. Moreover, unusable power
consumption occurs in the absence of human beings in public and private sectors.

In today’s world, there is a continuous need for automatic appliances. With the increase
in standard of living, there is a sense of urgency for developing circuits that would ease
the complexity of life. The energy crisis is one of the major problems that the world
needs to resolve for sustainable economic development. Electrical energy lighting makes
up the largest part of power consumption in the world particularly through the use of
lamps [1]. These lamps are mainly controlled using ordinary switches that are manually
operated. Sometimes the intensity from outside is sufficient to illuminate the room.
Therefore, there is no need to turn any light ON. Due to a busy schedule and competitive
world, human beings cannot spare time to perform their daily activities manually. One
of the most common things that one forgets to do is switching OFF the lights whenever
they are not required. This leads to wastage of electrical power and an increase in the
payment for such services. Hence, the need of some power management to save energy.
The importance of electrical energy is increasing everyday with the impact of
technological advancements [2].

1
The main problem addressed by this project is the inefficient use of lighting in rooms
that are not occupied. The lack of an automated system to control the lights based
on occupancy results in increased energy consumption and higher operational costs.

To avoid all such situations, we designed this project called “Automatic room
light controller with visitor counter using Arduino and PIR sensors”. user can
reduce electricity usage and save some amount of money thereby. When there is
no human presence or motion the room lights will get switched off on their own. It
is an efficient way to save energy and human efforts.

1.2 Problem of the Statement


Wastage of electricity is one of the main problems which we are facing nowadays.
In our home, school and colleges. We see that fan/lights are kept ON even if there
is nobody in the room or area/passage. Leading to unnecessary energy consumption
and increased electricity bills and decreases the durability of the luminaire devices.

Lighting systems rely on manual operation, which is prone to human error, such as
forgetting to turn off lights when leaving a room. This issue is exacerbated in large
buildings where multiple rooms are involved, leading to significant energy wastage.
This happens due to negligence or because we forgot to turn lights off or when we
are in a hurry.

1.3 Objective of the Project


1.3.1 General objective:
To design a controlling mechanism that prevents wastage of electric energy by
ensuring lights are only ON when needed, in class rooms and meeting halls.

1.3.2 Specific objective


❖ To design a system that automatically controls room lighting based on
occupancy.

❖ To create a user-friendly system that provides a reliable solution for


managing lighting in various environments, including homes, offices, and
public buildings.

2
❖ To make a controller-based model to count the number of persons visiting a
particular room.

1.4 Significance of the Project


The design and simulation of an automatic room light controller with visitor counter is
used to develop a smart system which provides energy efficient and automatically
controlled room lighting, in addition, it helps us to count the number of persons present
in the room, open and close the door without human involvement. This project up on
completion and successful implementation play a crucial role in:

Various rooms like seminar hall, conference hall where the capacity of room is limited
and should not be exceeded by displaying the actual number of persons inside the room
A. Classrooms, study rooms in colleges, to take count the accurate number of
students in the classroom and control the room light accordingly.
B. Our homes because many times we come out of our bedroom or any other room
and we forgot to turn off the room light.
C. Cinema halls to count the number of persons entering inside. So that these places
should not get overcrowded to avoid congestion.

1.5 Limitation of the Project


Listed below are client-specified limitations:

a. It is used when only single person enters to the sensitivity region of the sensor
hence if two persons are crossing simultaneously it detects as one person.

b. The only person who can communicate with the control module is the person
who is in the receptionist and security units.

c. Only devices with electrical controlling input ports will be possible targets
for the project.

3
1.6 Organization of Project
In this project a clear outline has been provided with descriptions of each chapter are
given below: This project consists of 6 chapters. Chapter 1 gives an overview of the
entire project including a statement of the problem, project objective, and project scope.
Chapter 2 reviews and related works with compression with the system have been
discussed. Chapter 3 covers the descriptions of system components. chapter 4 discusses
the design and development of the system selected to construct an automatic room light
controller, and interfacing of materials with Arduino and working operation of the
design. Chapter five, the result of each module displayed on LCD will be shown in
picture and the software of embedded system design of the final design’s program flow
is explained in detail and Chapter six, summarizes Conclusion and recommendations.

Figure1: flow chart of project methodology

4
Chapter Two
Literature Review
This chapter reviews some references from previous projects, journals, articles, and book and
data sheets. A brief discussion of each work has been discussed and critiques and limitations
of each work are also explained. It highlights briefly some of the light control designs that have
been made using different control modules that have been made previously.

2.1 Microcontroller Based Systems


A microcontroller is a computer integrated on a single chip. It has the processor, memory and
input/output devices on one chip unlike for a microprocessor whereby these elements are
provided as separate chips and are linked through bus connections. Since the inception of
microcontrollers, many researchers have come up with various systems with single dedicated
functions or embedded applications.
In [3] system proposes that switch control operations of devices like lights, fans, air
conditioners, etc. can be handled using PIR Sensor depending on environmental conditions. The
system uses Arduino Uno and WAGO PLC (Programmable Logic Controller) to make it
happen. Practically sensor data does the automatic control and manual control is done by
android apps. But the drawback of this “Implementation of Smart classrooms using Arduino
and WAGO PLC” system is that it uses both Arduino and WAGO PLC for control whereas the
operations can be performed by only using Arduino Uno. “Smart Lighting system using
raspberry pi” by Maslekar et al [4] suggests the monitoring of fans and lights simultaneously
using Raspberry pi. About 50 % of energy can be conserved using this system. The room lights
and fan will go OFF on their own. The drawback of this paper is that the system becomes
expensive as raspberries are costlier. Instead we can use Arduino Uno which is cheaper
comparatively.
Suresh et al [5], has proposed Automatic lighting and control system for Classroom where in
classroom lights are operated using PIR sensor, Bluetooth and Relay. The Bluetooth module
sends voice commands from Arduino Uno by using an android application. The Bluetooth
module is connected to Arduino Uno. But this system can also be implemented without
Bluetooth.
Pradnya Prabhakar Powar et al [6] proposed the design of a project called “Automatic
room light controller” where in classroom lights are operated using PIR sensor, Arduino,
5|Page
relay and visitor counter is to measure and display the number of persons entering in any
room like seminar hall, conference room. And when the number of persons inside the room
is zero, power supply inside the room can be cut using a relay interface. This will help to
save electricity. An LCD display placed outside the room displays the number of persons
inside the room. But this proposed system switches ON even in the day if there is
occupancy in the room.

All of the journal only viewed that automation of the room which has systems switch ON
even in day if there is occupancy in the room, but we modified this using LDR sensor to
turn OFF during day time even if there is occupancy.

This project uses a visitor counter and PIR sensor to detect human presence and operate
room lights. Human presence is detected using a PIR sensor at the entrance. When the
LDR sensor’s output becomes low and a person enters the room there is an increment in
the visitor counter which leads to turn ON action of lights controlled by a microcontroller
program. And when the person leaves room lights go OFF following decrement in counter.

6|Page
Chapter Three
System components description
3.1 Introduction
This chapter covers all parts of ARLC from the system overview to the individual components
required to assemble the visitor counter to provide effective crowd management as in
monitoring and controlling. The design in its sense has four main sections and circuits as
shown in Figure 3.1. These include Detection section (IR sensor circuitry), microcontroller
section, alerting section (LCD and relay) and power supply circuit. The description of these
components is also illustrated as follows

3.2 components used


The hardware part mainly consists of a digital computer, an Arduino Uno board, Infrared
Sensor module, LM358, 16x2 LCD, and a command register that stores the command
instructions given to the LCD. The basic block diagram of Automatic Room light controller
with bidirectional visitor counter is shown in figure3.1 above.
List of components
A. Power Supply
B. Arduino UNO microcontroller

C. Entry and Exit PIR sensors

D. Relay

E. Liquid crystal display (LCD)

F. Light dependent resistor (LDR)

G. Load (Lamp)

H. jumper Wires

7|Page
A, Power Supply:

Here we used +12V dc power supply. The main function of this block is to provide the
required amount of voltage to essential circuits. +12V is given to the relay driver. There are
different ways to power our Arduino board. The most common way is through the USB
connector available on every board. we use USB connector method,

B, Arduino UNO as a processing unit:


The microcontroller is the heart of the frequency controller. There are several types of
microcontrollers used in embedded control systems. Arduino controllers are famous among
control engineers. The Arduino UNO is microcontroller in which ATmega328 microprocessor
has 32-pin, including 14 digital I/O pins, 6 analog input pins, and power pins is shown in the
figure bellow.

Figure2: Arduino UNO microcontroller

8|Page
Below is a specification of Arduino UNO

Microcontroller ATmega328P – 8-bit AVR family microcontroller

Operating Voltage 5V

Recommended Input Voltage 7-12V

Input Voltage Limits 6-20V

Analog Input Pins 6 (A0 – A5)

Digital I/O Pins 14 (Out of which 6 provide PWM output)

DC Current on I/O Pins 40 mA

DC Current on 3.3V Pin 50 mA

Flash Memory 32 KB (0.5 KB is used for Bootloader)

SRAM 2 KB

EEPROM 1 KB

Frequency (Clock Speed) 16 MHz

9|Page
C, Passive Infrared sensor as a sensing unit:

This is one of the main parts of our project. The main intention of this block is to sense the
person. For sensing the person, we use a TSOP 1738 (PIR) sensors. By using this sensor and
its related circuit diagram we can count the number of persons.

Figure3: PIR sensor


A PIR is a passive infrared sensor used to detect motion, so a PIR is a passive motion
detector that waits for infrared temperature from body heat to trigger an activity. In other
words, it can sense motion through changes in temperature.
So, when a person walks into the detection area of a PIR sensor, it detects the radiation
emitted from that person and triggers the relay switch or turns on the light. However, these
sensors wouldn’t be practical if they could be activated by small animals or insects so most
passive sensors can be adjusted to pick up motion of humans with certain levels of emitted
radiations rather than anything and everything that moves.
D, Light dependent resistor (LDR) as a sensing unit:
LDR is a device which senses the intensity of light. It generates an analog signal up on sensing
light intensity. Light dependent resistors or LDRs are often used in circuits where it is necessary
to detect the presence or the level of light.
An LDR or photo resistor is made of any semiconductor material with a high resistance. It has
a high resistance because there are very few electrons that are free and able to move. The vast
majority of the electrons are locked into the crystal lattice and unable to move. Therefore, in
this state there is a high LDR resistance. As light falls on the semiconductor, the light photons
are absorbed by the semiconductor lattice and some of their energy is transferred to the
electrons. This gives some of them sufficient energy to break free from the crystal lattice so
that they can then conduct electricity. This results in a lowering of the resistance of the
semiconductor and hence the overall LDR resistance. The process is progressive, and as more

10 | P a g e
light shines on the LDR semiconductor, so more electrons are released to conduct electricity
and the resistance falls further. LDRs are very useful components that can be used for a variety
of light sensing applications.

Figure4: light dependent resistor

E, LCD Display as a display unit:


LCD screen is an electronic display module with a wide range of applications. A 16x2 LCD
means it can display16 characters per line and there are 2 such lines. In this LCD each
character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command
and Data. The command register stores the command instructions given to the LCD.

Figure5: Pictorial view of LCD Display

A command is an instruction given to LCD to do a predefined task like initializing it,


clearing its screen, setting the cursor position, controlling display etc. The data register
stores the data to be displayed on the LCD. The LCD screen displays the present the exact
number of persons in a building, and operates in 4-bit 'nibble' mode to save I/O pins. For
this project, the LCD is connected directly to the output Port of the microcontroller.

11 | P a g e
The LCD screen will display “Capacity Full” when the microcontroller detects that the
required number of visitors supposed to occupy a particular building is exceeded.

Figure 6: schematic view of an LCD screen

F, Relay as a controlling unit:


Relay is an electromagnetic device which is used to isolate two circuits electrically and connect
them magnetically. They are very useful devices and allow one circuit to switch another one
while they are completely separate. They are often used to interface an electronic circuit
(working at a low voltage) to an electrical circuit which works at very high voltage. A relay
switch can be divided into two parts: input and output. The input section has a coil which
generates a magnetic field when a small voltage from an electronic circuit is applied to it. This
voltage is called the operating voltage. Commonly used relays are available in different
configurations of operating voltages like 6V, 9V, 12V, 24V etc. But, we want to use a 12v
relay. The output section consists of switches which connect or disconnect mechanically. In a
basic relay there are three contactors: normally open (NO), normally closed (NC) and common
(COM). At no input state, the COM is connected to NC. When the operating voltage is applied
to the relay, the coil gets energized and the COM changes contact to NO. By using the proper
combination of contactors, the electrical circuit can be switched on or off.

RL
RLY-SPNO

Figure7: relay switch

G, Load

In this intelligent energy saving system we are using a lamp.


According to the sensor's output signal the lamp will be ON/OFF.

12 | P a g e
Figure 8: lamp

H, Resistors
The property of a material which opposes the flow of the electrons is resistance or the element
is called resistor. The unit of resistance is Ohms. There are two types of resistor.
These are variable resistors and fixed resistors.

Figure 9: resistor

Variable Resistors

There are two general ways in which variable resistors are used. One is the variable resistor
whose value is easily changed, like the volume adjustment of Radio. The other is a semi-fixed
resistor that is not meant to be adjusted by anyone but a technician. It is used to adjust the
operating condition of the circuit by the technician. Semi-fixed resistors are used to compensate
for the inaccuracies of the resistors, and to fine-tune a circuit. Some variable resistors must be
turned many times to use the whole range of resistance they offer.
This allows for very precise adjustments of their value.
These are called "Potentiometers" or "Trimmer Potentiometers." The symbol of resistor is
shown in figure below.
I, jumper Wires: It is a wire or a group of wire that contains connector pins at both the ends
which are used to connect different elements or devices with the breadboard. Jumper wires
can be used to connect Arduino devices without soldering.

Fig10: jumper wires

13 | P a g e
Chapter Four
System design procedure
4.1 The Design
This project aimed at designing an Arduino-based room light control and visitor counter control
system where human movement was to be under continuous surveillance. To achieve this,
sensors that produced digital output were employed. In this project, two types of sensors
namely; LDR sensors and PIR sensors were used. These sensors were connected directly to the
Arduino pins and acted as an input to the system. For notification purposes, LCD was employed
to indicate room occupancy. The display was connected to the output pin of the ARDUINO
microcontroller. A complete block diagram for the system is shown in Figure 4.1. It is made
up of a personal counter circuitry, Arduino microcontroller, LDR light sensor, LCD and a relay
circuitry. The sensor’s outputs are interfaced to the input port of the Arduino which under the
control program stored in its memory displays the room occupancy on the LCD and decides on
when to switch on/off the lights through a relay.

4.1.1 Block Diagram

Power supply

Power supply Light

Entrance IR Arduino
sensor Micro Relay

Controller
Exit IR sensor
LCD Display
LDR Sensor

Figure 11: Block diagram of the automatic room light controller


14 | P a g e
4.2 Interfacing with Arduino Microcontroller
4.2.1 Arduino Microcontroller
The microcontroller is the heart of the frequency controller. There are several types of
microcontrollers used in embedded control systems. Arduino controllers are famous among
control engineers. The Arduino microcontroller has 28-pin, including digital I/O pins, analog
input pins, and power pins. Below is a detailed description of the pin functions.
Pin 6 and pin 7 are used as digital inputs of the Arduino microcontroller. these pins are
connected to the outputs of PIR sensor1 and PIR sensor2 respectively to receive signal coming
from these sensors either they detect a person or not. Pin A0 of Arduino is connected with LDR
To detect the light intensity of the surrounding. Pin 5 of the Arduino is used as digital output
and it is connected with the relay. this pin controls the relay based on the information coming
from the PIR sensors and LDR sensor. And Pin 8, pin 9, pin 10, and pin 11 of Arduino are
connected with pin D7, pin D6, pin D5, and pin D4 of LCD respectively. finally pin 12 of
Arduino is connected to the Enable E port of LCD display to activate the LCD. pin 13 is
connected to pin RS (register select) pin of LCD display. This controller is widely used for
experimental and modern applications because of its low price, wide range of applications,
high quality, and ease of availability. Thus, Arduino microcontroller is selected.

4.2.2 Liquid Crystal Display (LCD) Interface


The alphanumeric 16character X 2line LCD requires 8data lines and also 3 control signals. By
using 2 ports, port 0&3 data pins are connected to LCD as data bus. Port0 can be basically used
as I/O port i.e. it can be programmed as an input or as an output port. That means if it is
programmed as output port, suppose if it is required to read data from LCD immediately it is
not possible. Before reading the data, it is required to make the port as an input port.
Data reading from LCD gives an erroneous reading & should not be implemented. Because of
this port5 is made as input / output port depending on the situation. The control signals are
connected to port 3 pins. They are EN bar & RS bar, RW bar. At different instance such as data
write / command write / data read etc. Various signals are to be provided as indicated by the
by the LCD manufacturers. To interface the LCD, to the Micro controller it require an 8 bit and
also three control signals differentiate the data from the control words send to the LCD.
The Microcontroller has to send the necessary control words followed by the data to be
displayed. Depending on the operation to be performed the control words are selected and
passes to the LCD. The data to be displayed on the LCD is to be sent in the ASCII format. Thus

15 | P a g e
all the character to be displayed are converted into ASCII form and then sent to the LCD along
with different control words.
The control word differentiated the various operations and is executed. It is also possible to
read the LCD data if required. The control signals to the LCD are also provided by the Micro
controller.

Pin Description
VCC/VDD is connected to the +5V supply. VEE/VSS and RW is connected to the ground, Vee
is used for controlling LCD contrast. RS, register select. There are two very important registers
inside the LCD. The RS pin is used for their selection as follows. If RS=0, the instruction
command code register is selected, allowing the user to send a command such as clear display,
cursor at home, etc., If RS=1 the data register is selected, allowing the user to send data to be
displayed on the LCD.
R/W, read/write R/W input allows the user to write information to the LCD or read information
from it. R/W=1 when reading; R/W=0 when writing. EN, Enable the LCD to latch information
presented to its data pins uses the enable pin. When data is supplied to data pins, a high-to-low
pulse must be applied to this pin in order for the LCD to latch in the data present at the data
pins. The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents
of the LCD’s internal registers. To display letters and numbers, we send ASCII codes for the
letters AZ, a-z, and numbers 0-9 to these pins while making RS=1.There are also instruction
command codes that can be sent to the LCD to clear the display or force the cursor to the home
position or blink the instruction command codes. We also use RS=0 to check the busy flag bit
to see if the LCD is ready to receive information.

LCD2
LM041L

Figure12: character LCD

16 | P a g e
4.2.3 Relay to microcontroller interface circuit
A relay is an electromagnetic switch that opens and closes under the control of another
electrical circuit. Since the relay can control an output circuit of higher voltage than the input
circuit it can be considered as a form of an electrical amplifier.
When the microcontroller pin connected to the relay circuit goes high i.e. logic-1, current flows
through the relay coil and the resulting magnetic field attracts an armature that is mechanically
linked to a moving contact. This movement either makes or breaks a connection with a fixed
contact. On the contrary, when the Arduino microcontroller pin goes to logic-0, the current to
the coil is switched OFF and the armature is returned by a force approximately half as strong
as the magnetic force to its relaxed position. Since in this case the coil is energized with DC,
IN4001 diode was connected across the coil to dissipate the energy from the collapsing
magnetic field at deactivation, which would otherwise generate a spike of voltage and may
cause damage to circuit components. The relay switch connections are usually labeled COM,
NC, NO whereby: i, COM - Common, is the moving part of the switch. ii, NC- Normally
Closed, COM is connected to this when the relay coil is off. iii. NO- Normally Open, COM is
connected to this when the relay coil is on
Arduino Microcontroller can only provide 25 mA on its pins hence we need an external DC
power supply to provide the current required for the operation of the relay. When the pin P5 of
the Arduino microcontroller goes high, the relay coil energizes. The switched circuit in this
design was to be ON when the relay coil is energized hence the COM was connected to No
contact otherwise the COM should be connected to NC. Therefore, the relay controls the lamp
connected to it based on the status of the PIR and LDR sensors.

4.2.4 Infrared Sensor interface to microcontroller


The Infrared Sensor (IR) works by the piezoelectricity principle whereby certain crystalline
materials have the property to generate a surface electric charge when exposed to thermal
infrared radiation. Human body radiates heat in the form of infrared radiation which is a
maximum at a frequency of about 9.4 μm. The presence of human beings creates a sudden
change in the surrounding that is sensed by the piezoelectricity sensor. The IR sensor requires
an initial stabilization of about 10 to 60 seconds in order to get familiar with the surrounding
environment and also function properly. Most of the motion sensor modules have three pins
namely: i) VCC which is connected to positive power. ii) Output is the sensors output and in
this case was connected to a microcontroller pin to serve the purpose of an input. The sensor’s

17 | P a g e
output pin goes high when motion is sensed and low if no motion is detected. iii) Ground
connected to the negative power.
The output of the IR sensor module is monitored through the digital port of the microcontroller.
When motion is sensed, this output is high at about 3.33 V as depicted by the 3.33 V regulator
IC on board in the IR detector module used. This voltage was used as a valid logic high for the
microcontroller. However, in order to get a full swing of the logic voltages, the sensor output
was employed to Arduino. The microcontroller here monitors the voltage at the collector of the
transistor. During normal condition, the transistor is cut off and the collector output is at logic
high i.e. +5 V. On sensing motion, the high output from the sensor saturates the transistor and
the voltage at the collector drops down to logic low (0.4 V).
A single pole double throw (SPDT) relay is connected to port D, pin 5 of the microcontroller
through a driver transistor. The relay requires 12 volts at a current of around 100mA, which
cannot provide by the microcontroller. So, the driver transistor is added. The relay is used to
operate the external solenoid forming part of a locking device or for operating any other
electrical devices. Normally their relay remains off. As soon as pin of the microcontroller goes
high, the relay operates which lead to control the bulb if the output of LDR is low.

4.3 Working operation of the system


The room to be controlled has one entrance and exit, so the counter works based on the direction
of movment.to detect the direction of motion we place
two IR sensors at intervals on the entrance of the room. In this case the counter will increase or
decrease depending on the direction of movement of the person and this is determined by which
of the two sensors detects the person first.

18 | P a g e
Figure13: system design

Also, the counter will not change if both the sensors have not detected the person which helps
to solve the situation that we were facing earlier of the counter increasing or decreasing even
when the person was just standing in one position without entering or leaving the room. When
a person is entering the room the output of the PIR sensor1 goes high and the output of the PIR
sensor2 goes HIGH after some time delay, Then the number of people (count) will be increased
and displayed on the LCD display. When a person is leaving the room the output of the PIR
sensor2 goes high and the output of the PIR sensor1 goes HIGH after some time delay, Then
the number of people (count) will be decreased and displayed on the LCD display.to turn ON
the lamp using the relay module, there must be a person in the room and the room should be
dark. which means the lamps must not turned ON in a day. When it is night and no person is
in the room the lamps must turned OFF.

19 | P a g e
4.4 Flow diagram of the system

YES If NO
LCD>0

YES If LDR NO Relay off


LOW

Relay on

Figure 14: flow diagram of automatic room light controller.

20 | P a g e
Chapter Five

Simulation and Result


We use two most known software for simulation of our project; that compatible to design
component of automatic load sharing of power transformer. For construction of the schematic
diagram of the project we applied proteus8 pro and compile our code by Arduino IDE. Also it
have coding for the system to transmit securely. Every aspects of order to control the device is
written in the program.

5.1 Software design


The project simulation is designed through two types of software’s.

These are: -

1. The Arduino IDE to compile our c-code and

2. The ISIS Proteus-8 software to build and run our circuit.

5.1.1 Arduino IDE


The Arduino IDE (Integrated Development Environment) is a software application used for
programming Arduino microcontrollers. It provides a user-friendly interface for writing,
compiling, and uploading code to Arduino boards.
The Arduino IDE is a powerful, feature-rich development tool for Arduino microcontrollers. It
is designed to provide the programmer with the easiest possible solution to developing
applications for embedded systems, without compromising performance or control.

5.1.2 Proteus 8
Proteus 8 is a single application with many service modules offering different functionality
(schematic capture, PCB layout, etc.). The wrapper that enables all of the various tools to
communicate with each other consists of three main parts.
Application Framework

Proteus 8 consists of a single application (PDS.EXE). This is the framework or container which
hosts all of the functionality of Proteus. ISIS, ARES, 3DV all open as tabbed windows within
this framework and therefore all have access to the common database [6].

21 | P a g e
Common Database: The common database contains information about parts used in the
project. A part can contain both a schematic component and a PCB footprint as well both user
and system properties.
Live Net list: Together with the common database the maintenance of a live net list allows all
open modules to automatically reflect changes. The most obvious example of this is wiring in
ISIS producing rats nest connections in ARES but it goes much further than that. The new Bill
of Materials module contains a live viewer and the 3D Viewer and Design Explorer are also
linked into the live net list.

Figure15: final circuit of automatic room light controller using Arduino microcontroller

5.2 Testing
The software realization of the system is very vital. This is where the fantasy of the whole idea
meets reality. The designer seen their work not just on paper but also evaluated well by using
the appropriate software. After carrying out all the paper design and analysis, the project was
tested to ensure its working ability. Simulation using Proteus virtual system modelling (VSM)
22 | P a g e
whereby the source code file obtained from the development environment was added to
Arduino microcontroller program memory and the simulation initiated. By pressing entrance
switch followed by exit switch the status of the counter incremented and this count was
displayed on the LCD display. On the contrary, pressing exit switch followed by the entrance
switch the status of the counter decreased which displayed on the LCD. Micro controller reads
data from LDR and activates the relay according to the intensity of light. When light intensity
detected is more it de-energized the relay, which turn the light OFF while, light intensity
detected is less the microcontroller activate relay thus, the lamp turned ON. The overall result
can be generalized in the following four cases which are discussed below.
Case 1

When the entrance switch was pressed first followed by the exit switch, and LDR have good
light, the microcontroller understand that someone want to enter the room and the intensity of
light is sufficient in the room. Which results the count which displayed on the LCD was
incremented by one also relay was deactivated thus, the light in the room deactivate as shown
in figure 16 bellow.

Figure16: system response schematic of the designed system when LDR lighted.

Case 2

When the entrance switch was pressed first followed by exit switch, and LDR haven’t light,
the microcontroller understand that someone want to enter the room and the intensity of light

23 | P a g e
inside the room is in efficient. Which results the count to be incremented and the relay was
activated which turn ON the room light as shown in figure 17 bellow.

Figure 17: system response schematic of the designed system when LDR no lighted and
there is occupancy.

Case 3

When the exit switch was pressed first followed by entrance switch, and LDR haven’t light,
the microcontroller understand that someone want to leave the room Which results the count
to be decremented and if the count isn’t dropped to zero, that means there is someone in the
room then relay will be stay activated which takes no action on the room light as shown in
figure 18 bellow.

24 | P a g e
Figure18: system response schematic of the designed system when LDR no lighted and leaves
one person, but still there is occupancy

Case 4

When the exit switch was pressed for the first time followed by entrance switch, and LDR
haven’t light, the microcontroller understand that someone want to leave the room Which
results the count to be decremented and if the count drops to zero, that means there is no one
in the room then relay will be deactivated which turns OFF the room light as shown in figure19
bellow.

25 | P a g e
Figure19: system response schematic of the designed system when LDR no lighted and there is no
occupancy

26 | P a g e
Chapter Six

Conclusion and Recommendation


6.1 Conclusion
A simple, cheap, portable and microcontroller-based automatic room light controller required
for energy waste and to change the manual system to automatic has been designed and
simulated. An entry/exit sensing unit that uses two sets of PIR sensors for determining the
number of people accessing the controlled room has also been designed. The system integrates
PIR sensors, light intensity detector (LDR), Arduino microcontroller, Relay control circuit and
LCD as output module. The designed system managed to acquire three inputs from sensors and
based on the code stored in the microcontroller`s program memory, count displayed on LCD
was incremented or decremented with activation or deactivation of relay driver. If the first PIR
sensor detects and followed by the second PIR sensor and there is insufficient light intensity,
this was processed by the microcontroller and registered on the LCD as an inward count. Upon
which the controlled lights go ON. When the second PIR sensor detects and followed by the
first PIR sensor an outward count is registered, With the counter being equal or greater than
one, the status of the IR sensor output pin is monitored. Finally, if no one present in the room
LCD show zero value and relay driver was deactivated. The time delay transitions for the
designed system can also be modified in the program code for it to suit different user
preferences. With achievement of all the objectives of this project, we can conclude that the
system is reliable, compact and portable hence can be employed in light energy control
operations to help limit electric energy wastage and to count number of persons in a room
automatically and accurately.

6.2 Recommendation
The control system available in our country is manually operated switch. These systems are
designed to operate the user at the desired time. But this way is not good and it has disadvantage
that the user may lazy or forget to switch OFF the light at the day time. The other disadvantage
is in some rooms such as Meeting halls and libraries we look many people enter and they leave
it due to the absence of vacant space to sit and disturbing the activity’s performing in that room.
To overcome these, dis advantages we recommend to Mekelle Institute of Technology (MIT)
department of EEE to motivate the next generation students to bring this design in to practical
application which opens and closes a door automatically.
27 | P a g e
References

[1] Sheriff Matta, Syed Masud Mahmud, "An intelligent light control system for power saving," in
IECON 2010 - 36th Annual Conference on IEEE Industrial Electronics Society, Glendale, AZ,
USA, November 2010.
[2] R. Gunturkun, " Feedforward and Elman Feedback Harmonics Compensation," in PhD thesis,
Graduate School of Natural and Applied science, Turkey, 2003.
[3] Vibhuti and S.L Shimi, "Implementation of Smart classroom Using WAGO PLC,," in in
proceedings of the second international conference on inventive system and control(ICISC)
Coimbatore,, 2018.
[4] A, Maslekar, k.Aparna, k.mamatha and T.Shivakumara,, "Smart Lighting system using
Raspberry pi," international journal of innovative research in science and technology,, vol. 04,
no. 1, p. 7, 2015.
[5] Suresh s., H.N.S Anusha ,T.Rajath ,P.soundarya and S.V.pratyusha Vudatha,, "Authomatic
Lighting and control system for classroom," in international conference on ICT in Bussiness
industry and Government(ICTBIG), 2016.
[6] Pradnya Prabhakar Powar, Sheetal Arun Patkure,Madhura Pramod Walvekar,Vaishnavi
Aravind Patil,Tejaswini Ulhas Pati,, "Automatic Room Light controller," international journal
of creative research thoughts(IJCRT), vol. 2, no. 10, pp. 2-5, 2022.

28 | P a g e
Appendix
The software program loaded into the micro controller

//Program Name: AUTOMATIC ROOM LIGHT CONTROLLER USING ARDUINO

//MICROCONTROLER */

// ELECTRICAL AND ELECTRONICS ENGINEERING DEPARTEMENT*/

// MEKELE UNIVERSITY _MIT

// the code displays status of room occupancy in a controlled room. Based on the count and
//status of the infrared sensor output, the lights are switched on and off automatically and the
//status of the room occupancy is shown on the LCD and also open-close the door.

//-------------------------------------------------------------------------------------------------/

#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
#define PIRsensor1 6 //define the arduino pins to connect with PIR sensor1
#define PIRsensor2 7 //define the arduino pins to connect with PIR sensor2
#define relay 5 //define the arduino pins to connect with relay
#define LDRsensor A0 //define the arduino pins to connect with LDR sensor
int sensorState1 = 0; //intialise the PIRsensor state
int sensorState2 = 0; //intialise the PIRsensor state
int count=0;
float LDRvalue=0; //intialise the LDRsensor state
void setup()
{
pinMode (PIRsensor1,INPUT );
pinMode (PIRsensor2, INPUT);
pinMode (LDRsensor,INPUT);
pinMode(relay, OUTPUT);
Serial.begin(9600);
lcd.begin(16,2);
lcd.setCursor(4,0);
29 | P a g e
lcd.print("COUNTER");
lcd.setCursor(0,1);
lcd.print("No Person In ");
delay(200);
}

void loop()
{
sensorState1 = digitalRead(PIRsensor1);
sensorState2 = digitalRead(PIRsensor2);
LDRvalue = analogRead(LDRsensor);
LDRvalue = (3.3*LDRvalue)/1023;
Serial.print(LDRvalue); //read th value from the sensor ,then
// print the values comming from the sensor on the screan.

// Check if Sensor 1 is triggered first

if (sensorState1 == HIGH && sensorState2 == LOW) {


delay(10); // Debounce delay
if (digitalRead(PIRsensor2) == HIGH) { // Check if Sensor 2 is triggered next
count++;

delay(1000); // Wait before checking again to avoid multiple counts


}
}
// Check if Sensor 2 is triggered first
if (sensorState2 == HIGH && sensorState1 == LOW) {
delay(10); // Debounce delay
if (digitalRead(PIRsensor1) == HIGH) { // Check if Sensor 1 is triggered next
count--;

delay(1000); // Wait before checking again to avoid multiple counts


}
}
30 | P a g e
if(count<=0)
{
lcd.setCursor(0,1);
lcd.print("No person In ");
}
else if (count>0 && count<10){

lcd.setCursor(0,1);
lcd.print("persons In: ");
lcd.setCursor(12,1);
lcd.print(count);
lcd.setCursor(13,1);
lcd.print(" ");

}
else {
lcd.setCursor(0,1);
lcd.print("persons IN: ");
lcd.setCursor(12,1);
lcd.print(count);
}

if(LDRvalue < 1.5 && count > 0){

digitalWrite(relay, HIGH);
}
else{
digitalWrite(relay, LOW);
}
}

31 | P a g e

You might also like