Professional Documents
Culture Documents
COLLEGE OF TECHNOLOGY
DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINNERING
DESIGN AND SIMULATION OF AUTOMATIC ROOM LIGHT CONTROLLER
WITH VISITOR COUNTER
SEMESTER PROJECT
Industrial control stream
By
Member Name:
ID Number
1. Yeshituaf Assabu..TER/3444/04
2. Yezebalem MeketeTER/2639/04
3. Yibeltal MossuTER/2853/04
4. Yimenu Belay..TER/2474/04
5. Zemen Guadye.TER/2749/04
Advisor: Mr.Joefel
Declaration
This is to certify that the project report entitled design and simulation of automatic
room light controller with visitor counter being submitted by
Member Name:
ID Number
1. Yeshituaf Assabu..TER/3444/04
2. Yezebalem MeketeTER/2639/04
3. Yibeltal MossuTER/2853/04
4. Yimenu Belay..TER/2474/04
5. Zemen Guadye.TER/2749/04
in partial fulfillment for semester project the requirement for awarded of the fourth year
second semester project in electrical engineering. Which is recorded of our own work
carried by us during the academic year 2015 G. C under the supervision and guidance of
Mr. Jofel?
The result embodied in this project report have not been submitted to any other
university or institute for the award of any degree or diploma.
Advisor Name
Head of department
Signature
Acknowledgement
First of all we would like to thank Almighty GOD for his inspiration, indescribable
support to open the way how to work and healthy for us. It's a matter of fact without the
grace of GOD and our parents; we wouldn't have been able to complete the project.
Secondly we would like to thank and take an opportunity to express our sincerest
gratitude to our advisor Mr. Jofel for his encouragement, support, and guidance during
the process of our project staring from up to final submission of project.
Thirdly we would like to express our deepest appreciation and gratitude to our senior
Mr. Abathun Assefa for his indispensable support from motivation up to end of paper.
Our special thank goes to Mis. Andusumilli Lakshmi for her indescribable support
during the documentation. All in all, we found her not only as an academic instructor
but as good mother.
Finally we would like to thank our best friends who motivated while doing this project
by offering their laptop and those who are direct or indirect helps us to complete this
project.
Abstract
This project Automatic room light controller with visitor counter is a reliable
circuit that takes over the task of controlling the room light as well as counting number
of persons /visitors in the room very accurately which is installed in the entry of a room
or building to restrict access, provide ease of opening a door. As a result of enhanced
civilization and modernization, the human nature demands more comfort to his life.
The man seeks ways to do things which saves time. So thus, the automatic room are
one of the easily examples that human nature invent to bring comfort and ease in its
daily life. To this end, the researchers design and develop an automatic door with a
room light control system to provide the mentioned needs. This system works on the
principle of breaking an infrared beam of light, sensed by a photodiode. It consists of
two transmitting infrared diodes and two receiving photodiodes. The first one is for
someone coming in and the second one is for someone going out of the room. The
photodiodes are connected to the microcontroller, which give a lower output when the
beam is broken and high output when transmitting normally and the total number of
person in the room is displayed on the seven segments. The general operation of the
work and performance is dependent on the presence of an intruder entering through the
room.
Table of Contents
Declaration..................................................................................................... 1
Acknowledgement.......................................................................................... 2
Abstract.......................................................................................................... 3
CHAPTER ONE................................................................................................ 7
INTRODUCTION.............................................................................................. 7
1.1 Background of the study..........................................................................7
1.3 Objective of the study.............................................................................. 8
1.3.1 General objective...............................................................................8
1.3.2 Specific objective.................................................................................. 8
1.6 Significance of the project........................................................................8
1.7 Framework of the study............................................................................8
Figure 1: Control system frame work..........................................................9
1.8 Scope of the study................................................................................... 9
1.9 Limitations of the project.........................................................................9
1.10 Organization of project.........................................................................10
CHAPTER TWO.............................................................................................. 10
LITERATURE REVIEW..................................................................................... 10
2.1 Introduction........................................................................................... 10
2.2 Detector based control systems............................................................11
2.3 Microprocessor based systems..............................................................11
2.4 Microcontroller based systems..............................................................11
CHAPTER THREE........................................................................................... 11
MATERIALS AND METHODOLOGY..................................................................11
Introduction.................................................................................................. 11
3.1 The design.............................................................................................. 12
Figure 3.1: Block diagram of the automatic room light controller.............12
3.1.1 Hard ware component description......................................................12
3.1.1.1 Power Supply.................................................................................... 13
Figure 3.2 schematic illustrating bridge rectifier......................................13
3.1.1.2 Micro-controller................................................................................14
.................................................................................................................. 14
List of figures
Figure 1: Control system frame work............................................................................... 7
Figure 3.1: Block diagram of the automatic room light controller................................. 16
Figure 3.2 schematic illustrating bridge rectifier............................................................ 17
Figure 3.3 AT89C51 microcontroller.............................................................................. 19
Abbreviations
ADC
CMOS
COM
common
CPU
IDE
INTCON
interrupt control
IR
infrared radiation
LCD
NO
normally open
NC
normally close
PWM
RAM
ROM
TSOP
VSM
MCU
microcontroller unit
CHAPTER ONE
INTRODUCTION
1.1 Background of the study
The need for automation has come to stay and this date back to 1500 years when the
first water pump for metal working rolling mills for coinage strips was developed from
then till date the automation world has continued to grow extremely. Automation is the
art of making processes or machines self-acting or self-moving, it also pertains to the
technique of making a device, machine, process or procedure more fully automatic, it is
a self-controlling or self- moving processes. In todays 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 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]. The cost of investment made for generation,
transmission and distribution of electrical energy is quite high. For this reason it has
gained significant importance to use the electrical energy efficiently so as to minimize
the existing losses, to reduce the generation costs and to protect the environment by
reducing the consumption [3]. In most cases, energy waste does not occur because the
lamps are not fitted with energy efficiency systems but mainly because these devices
require manual operation, for instance the use of on/off switches to control the lights.
Energy efficiency systems have thus been a subject of interest to many researchers.
Many of these researchers have made great attempts in automating the energy efficiency
systems to be independent of human support. A few systems have been automated but
use microprocessors which require extra peripherals for the systems to work as
expected. The additional peripherals require more design space making these systems
bulky and more expensive. Microcontrollers have traditionally been programmed using
the low-level assembly language of the target processor [4]. This consists of a series of
instruction in the form of mnemonics. The disadvantage of assembly language is that
microcontrollers from different manufacturers have different assembly languages and
the user is forced to learn a new language every time a new processor is chosen.
Assembly language is also difficult to work with especially during the development,
testing and maintenance of complex projects. The solution to this is to use the high level
In our home, school, colleges or industry we see that lights are kept on even if there are
nobody in the room or area / passage. This happens due to negligence or because we
forgot to turn lights off or when we are in hurry. To avoid all such situations we are
motivated to design project called Automatic room light controller with visitor
counter. This project has two modules, first one is known as Digital Visitor counter
and second module is known as Automatic room light controller. Main concept
behind this project is known as Visitor counter which count the number of persons
entering in any room like seminar hall, conference room, classroom.
1.2 Statement of the problem
Nowadays the wastage of electricity has become a routine thing for us, and the problem
has become frequent at homes, schools, and colleges and even in industries. Sometimes
we notice lights keep on working even in the absence of people in that area. This often
happens in homes, offices and public places due to negligence or by other problem.
Many times we need to monitor the person/people visiting some place like Seminar hall,
conference room or Shopping mall or museum. The we want to address the
aforementioned problem by doing a micro-controller based project that control the room
light and count the number of persons automatically. The study therefore seeks to
address the following question.
What parameters should be considered in the circuitry design part to meet the
specified aim?
To design a circuitry for an automatic On-Off switching device for the lighting
load ON/OFF in order to save electrical energy.
To develop and implement a C based program to control AT89C51 microcontroller using the kiel software.
To integrate the design circuitry and software in order to simulate the function of
a basic automatic room light controller with visitor counter
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
Hotel rooms to monitor the number of persons that enters the room when a
guest lodges, so to make sure they dont exceed number of visitors that are
allowed to lodge in a room
Class rooms, study rooms in colleges, to take count the accurate number of
students in the classroom and control the room light accordingly
Our homes because many times we come out of our bedroom or any other room
and we forgot to turn off the room light
Cinema halls to count the number of person entering inside. So that these places
should not get over crowded to avoid congestion.
To avoid locking in a person inside the room since it can display the number of
person in the LCD display.
Process
Micro-controller
Output
Relay
programming
seven segment
must be
It is used only when one single person, cuts the rays of the sensor hence it
cannot be used when two person crossing simultaneously
The only person who can communicate with the control module is the person
who is in the receptionist and security units
Only devices with electrical controlling input ports will be possible targets for
the project
If someone goes out from the entrance it would count as one, also if someone
goes comes in through the exit it would decrement one
CHAPTER TWO
LITERATURE REVIEW
2.1 Introduction
This chapter reviews some reference from previous project, journal, articles, and
book and data sheets. A brief discussion of each work has been discussed and
critiques and limitation 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.2 Detector based control systems
It has been reported that lighting consumes more than 2000 terawatt-hours of
electricity globally and 48% of lighting electricity is attributed to the commercial
sector [5]. Various lighting control technologies have been developed for increased
energy efficiency, including daylight harvesting, occupancy sensing and light level
tuning. An excellent way of reducing lighting energy waste while enhancing lighting
quality is through the use of controls; Passive Infrared sensors (PIR) have been used
to eliminate wasted lighting in unoccupied spaces. In addition, manual dimmers
which allow occupants to adjust light levels to their preference are becoming more
affordable and can thus be incorporated into these lighting systems. Lighting
controls have shown to reduce lighting consumption by 50% in existing buildings
and by at least 35% in new construction [6]. It presented a lighting optimization
approach for open plan offices capable of tuning lighting to each occupants
preference. Each luminary was dynamically actuated at different levels to realize
various lighting configurations without any physical rewiring. The study used two
novel features: a versatile `plug and play` wireless networked sensing and actuation
system together with a control method incorporating multiple management
strategies to provide occupantspecific lighting. Although wireless technology has
been identified as promising, this system has exorbitant initial costs, including unit
price and installation. Wayne and Steve studied digital systems and noted that they
can perform the same lighting automation functions that independent, stand-alone
systems perform. They can override the set schedule to match the changes in
operating schedules and monitor occupancy patterns in an area and adjust the
designed an intelligent
controller with dual functions including timing control and automatic photoelectric
control. The proposed system allowed street lamps to be automatically lit in the
evening, lighting the road for a few hours which was adjustable. After midnight,
when a few vehicles or pedestrians go past, it turned off automatically. It had a
terminal controller that had wake-up function. When the vehicles or pedestrians pass
through, the street lights are switched on by the terminal controller. The waste of
for light intensity detection and control using both microprocessor and light sensors.
In this design, the home light control module (HLCM) made up of four blocks; the
Passive Infrared (PIR) sensor circuit, microprocessor and radio frequency module
was installed in every light fixture.
efficiently [6]. A few of the LED street lighting systems have intelligent control;
however, they can neither automatically detect the illumination management
systems nor adjust the systems manually. This phenomenon had been further
developed to home automation. In Ciubotaru-Petrescu, B., Chiciudean, D., Cioarga,
R., & Stanescu, D. , work problem with the implementation of home automation
systems were considered. Furthermore the possible solutions were devised through
various network technologies. Several issues affecting home automation systems
such as lack of robustness, compatibility issue and acceptability among older and
disabled people were also discussed. Besides, much were treated in papers by
Zungeru which consider the use of infrared rays to count the number of passengers
in a car and also remotely control home appliances via short message services.
Listed above literature review has some sort of drawback and also they have
advantaged technology which will incur cost. All of the journal only viewed that
automation of the room which have bidirectional door and they have limitation on
checking the presence of sufficient light in the room. To overcome this problem
further investigation is necessary. We modify the existing system by adding LDR
which differentiate the presence of sufficient light intensity in the room and great
attention had given to arrangement of the IR sensor. This system has advantages of
incurring low cost and suitable for any room which have either single door or more.
CHAPTER THREE
MATERIALS AND METHODOLOGY
Introduction
This chapter describes the methodologies used for the design of the hardware and
software parts. It begins by giving an overview of the automatic room light controller
and then describes how the specific hardware and the software for the system were
designed.
Power Supply
Entry and Exit sensor circuit
AT 89C51 micro-controller
Relay driver circuit
Buzzer
Seven segment display
Filter
Capacitors are used as filter. The ripples from the DC voltage are removed and pure DC
voltage is obtained. And also these capacitors are used to reduce the harmonics of the
input voltage.
Regulator Unit
Regulator regulates the output voltage to be always constant. The output voltage is
maintained irrespective of the fluctuations in the input AC voltage. As and then the AC
voltage changes, the DC voltage also changes. Thus to avoid this Regulators are used.
3.1.1.2 Micro-controller
Micro-controller is a general purpose device, which integrates a number of components
on to single chip. It has inbuilt central processing unit, both read only memory and
random access memory, parallel digital I/O peripherals to make it as a mini computer.
Micro-controllers are available in different configurations, low cost and Compacts. The
significant part of embedded system development is the designing of hardware and
software for the specific application. Microcontroller AT89C51 is the brain of this
system which takes input from the sensors, make decision based on the stored program
on its memory, control the output unit and having special features like 4KB of Flash
programmable and erasable read only memory (PEROM) and 128 bytes of RAM, 32
programmable I/O lines and eight interrupt sources. The microcontroller consists of a
timer module and an analog to digital converter to accept analogue input for data
processing. To make the data flow between controllers to other devices the serial I/O
port is used. It can be erased and program to a maximum of 1000 times.
AT89C51 microcontroller
The AT89C51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K
bytes of In-System Programmable Flash memory. The device is manufactured using
Atmels high-density nonvolatile memory technology and is compatible with the
industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional nonvolatile
memory programmer. By combining a versatile 8-bit CPU with In-System
Programmable Flash on a monolithic chip, the Atmel AT89C51 is a powerful
microcontroller which provides a highly-flexible and cost-effective solution to many
embedded control applications. The AT89C51 provides the following standard features:
4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers,
two 16-bit timer/counters, a five-vector two-level interrupt architecture, a full duplex
serial port, on-chip oscillator, and clock circuitry. In addition, the AT89C51 is designed
with static logic for operation down to zero frequency and supports two software
selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM,
timer/counters, serial port, and interrupt system to continue functioning. The Powerdown mode saves the RAM contents but freezes the oscillator, disabling all other chip
functions until the next external Interrupt or hardware reset.
Pin configuration:
assigned for Port 1 pins; thus they are used solely for interfacing to external devices.
Exceptions are the 8032/8052 ICs. Which use P1.0 and P1.1 either as I/O lines or as
external in outs to the third timer.
Port 2: (pints 21-28) is a dual purpose port serving as general purpose I/O, or as the
high byte of the address bus for designs with external code memory or more than 256
bytes of external data memory.
Port 3: is a dual purpose port on pins 10-17. As well as general purpose I/O, these
pins are multifunctional with each having an alternate purpose related to special features
of the 8051
PSEN: This is an output pin. PSEN stands for program store enable. In an 8031based system in which an external ROM holds the program code, this pin is connected
to the OE pin of the ROM.
VCC: Pin 40 provides supply voltage to the chip. The voltage source is +5V.
GND: Pin 20 is the Ground pin.
XTAL1 and XTAL2: The 8051 has an on-chip oscillator but requires an external clock
to run it. Most often a quartz crystal oscillator is connected to inputs XTALI (pin 19)
and XTAL2 (pin 18). The quartz crystal oscillator connected to XTAL1 AND XTAL2
also needs two capacitors of 30 pF value. One side of each capacitor is connected to the
ground as shown in this figure;
Figure 3.5 schematic diagram and pin configuration of seven segment display
A seven segment display is the most basic electronic display device that can display
digits from 0-9. They find wide application in devices that display numeric information
like digital clocks, radio, microwave ovens, electronic meters etc. The most common
configuration has an array of eight LEDs arranged in a special pattern to display these
digits. They are laid out as a squared-off figure 8. Every LED is assigned a name from
'a' to 'h' and is identified by its name. Seven LEDs 'a' to 'g' are used to display the
numerals while eighth LED 'h' is used to display the dot/decimal. A seven segment is
generally available in ten pin package. While eight pins correspond to the eight LEDs,
the remaining two pins (at middle) are common and internally shorted. These segments
come in two configurations, namely, Common cathode (CC) and Common anode (CA).
In CC configuration, the negative terminals of all LEDs are connected to the common
pins. The common is connected to ground and a particular LED glows when its
corresponding pin is given high. In CA arrangement, the common pin is given a high
logic and the LED pins are given low to display a number.
Features:
1. Common Anode
2. 0.52 Inch Digit Height
3. Continuous Uniform Segments
4. Low power Requirement
5. Excellent Characters Appearance
band pass filter, an integrator stage and an automatic gain control are used to suppress
such disturbances. SOP module has an inbuilt control circuit for amplifying the coded
pulses from the IR transmitter. A signal is generated when PIN photodiode receives the
signals. This input signal is received by an automatic gain control (AGC). For a range
of inputs, the output is fed back to AGC in order to adjust the gain to a suitable level.
The signal from AGC is passed to a band pass filter to filter undesired frequencies. After
this, the signal goes to a demodulator and this demodulated output drives an NPN
transistor. The collector output of the transistor is obtained at pin 3 of TSOP module.
Features:
falls further. LDRs are very useful components that can be used for a variety of light
sensing applications.
Type: NPN
3.1.1.8 Relay
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. For example, a relay can make a 5V DC battery circuit to switch a 230V
AC mains circuit. Thus a small sensor circuit can drive, say, a fan or an electric bulb
a relay switch can be divided into two parts: input and output. The input section has a
coil which generates 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 configuration of operating voltages like 6V, 9V, 12V, 24V etc.
But, we want to use 12v relay .The output section consists of contactors 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 the relay coil gets energized
and the COM changes contact to NO. Different relay configurations are available like
SPST, SPDT, and DPDT etc., which have different number of changeover contacts. By
using proper combination of contactors, the electrical circuit can be switched on or off.
CPU Models available for popular microcontrollers such as the PIC and 8051
series.
Interactive peripheral models include LED and LCD displays, a universal matrix
keypad, an RS232 terminal and a whole library of switches, pots, lamps, LEDs
etc.
Virtual Instruments include voltmeters, ammeters, a dual beam oscilloscope and
a 24 channel logic analyzer
Graph Based Analysis types include transient, frequency, noise, distortion, AC
and DC sweeps and Fourier transform. An Audio graph allows playback of
simulated waveforms.
To start the ISIS program, click on the Start button and select Programs,
Proteus 8 Professional and then the ISIS 8 Professional option. The ISIS
schematic editor will then load and run. Along the top of the screen is
left button
Having selected the parts we need the next thing is to actually place
them on the drawing area the Editing Window and wire them
together
Animation: Interactive simulations are controlled from a simple VCR like panel that
behaves just like a normal remote control. This control is situated at the bottom right of
the screen.
Press the PLAY button to run the simulation
The STOP button to stop doing a real time simulation. All animation is stopped
and the simulator is unloaded from memory.
PAUSE button suspends the animation which can then be resumed either by
clicking the PAUSE button.
Micro-processor source code can be brought under the control of PROTEUS VSM
using the commands on the Source menu or imported via an object file from favourite
compiler to assign the object code (HEX) to the micro-processor component on the
schematic.
applications,
Dialogs for all development tool settings,
True integrated source-level Debugger with high-speed CPU and peripheral
simulator,
Advanced GDI interface for software debugging in the target hardware and for
connection to Kiel LINK,
.
The Vision3 IDE offers numerous features and advantages that help quickly and
successfully develop embedded applications. A program has been developed according
to the connections given by the micro controller and required operation of the system is
converted to assembly language from embedded C language using Kiel Vision3. Steps
to Generate Hex File From .C File
Create Project File Folder and Specify Project Name:
To create a new project file select from the Vision3 menu Project New Vision
Project. This opens a standard Windows dialog that asks you for the new project file
name. You should you use a separate folder for each project.
Select Microcontroller from Device Database:
When you create a new project Vision3 asks you to select a CPU for your project. The
Select Device dialog box shows the Vision3 device database. Just select the
microcontroller you use.
Create New Source Files:
You may create a new source file with the menu option File New. This opens an
empty editor window where you can enter your source code. Vision3 enables the C
color syntax highlighting when you save your file with the dialog File Save As
under a filename with the extension *.C.
Add Source Files to Project:
Once you have created your source file you can add this file to your project.
Build Project:
You may translate all source files and link the application with a click on the Build
Target toolbar icon. When you build an application with syntax errors, Vision3 will
display errors and warning messages in the Output Window Build page. A double
click on a message line opens the source file on the correct location in a Vision3 editor
window.
Create HEX File:
Once you have successfully generated your application you can start debugging. After
you have tested your application; it is required to create an Intel HEX file to download
the software into an EPROM programmer or simulator. Vision3 creates HEX files with
each build process when Create HEX files under Options for Target Output is enabled.
iii. NO- Normally Open, COM is connected to this when the relay coil is on
AT89C51 microcontroller can only provide 25 mA on its pins hence the need of a
transistor to switch larger currents. The BC547 NPN transistor, Figure 3.10 was wired
as a switch and carries the current required for the operation of the relay. When the pin
P1.7 of the microcontroller goes high, the transistor BC547 turns on and current flows
through the relay. The diode connected across the relay contacts is used to protect the
transistor and microcontroller from back electromotive force generated in the relay coil.
The IN4001 also known as freewheeling diode was used as it is a fast switching diode
having a peak forward current of 450 mA (Horowitz, 1989). 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.
of the microcontroller goes high, the relay operates which lead to control the bulb if the
output of LDR is low.
3.3 Software design development
3.3.1 Proteus development
By using proteus the simulator model this project was designed and the appropriate
design code was loaded to run the simulation. It is possible to simulate the complete
micro-controller systems and thus to develop the software for them without access to a
physical prototype. The schematics in figure bellow was created using Labcenter ISIS
which is a component of Proteus VSM. Once the application has been installed and
opened, an edit screen appears whose main applications are:
1) Select components from library
2) Place and connect up components
3) Write a test program for the MCU
4) Attach to the MCU and simulate
5) Debug the program if necessary
Figure 3.12 final circuit for automatic room light controller with visitor counter
3.3.2 Kiel Vision3
The Vision3 IDE offers numerous features and advantages that help quickly and
successfully develop embedded applications. This program has been developed
according to the connections given by the micro controller and required operation of the
system is converted to assembly language from embedded C language using Kiel
Vision3.The program code was written in C using killer micro vision. The code
enables the output signals to be received, processed and a message sent to the output. In
the proposed circuit the lines 1, 2 and 3 of PORT1 were configured to act as inputs to
the system while PORT2, PORT3 and line 8 of PORT1 was used for output purposes.
iv) The project is then given a name and a project directory selected where the
necessary files needed for the project are stored.
v) A new file is opened from the file menu where the program code is then written and
saved with .c file extension. A new window with .uvproj file extension opens and
the c file created earlier on is added to the source file on this window.
vi) Once this is complete the project is built by selecting Build option from the
project menu or by pressing F10. If there are no errors in the code a message Build
Successful is displayed. Here the compiler generates a hex file which is burned to the
memory using the micro-controller. Once the application has been installed and opened,
an edit screen appears whose main applications are:
1) Select components from library
2) Place and connect up components
3) Write a test program for the MCU
4) Attach to the MCU and simulate
5) Debug the program if necessary
CHAPTER FOUR
RESULT AND DISCUSSION
Automatic room light controller with visitor counter system is an application
specific project, which is used to control room light and it also count the number of
visitors. An embedded system is designed which consist of an AT89C51, IR sensor
(transmitter and receiver,) Display, transistor, LDR and relay.
4.1 Automatic On-Off Switching device for Lighting Load
Case 1. When there is no person inside the room
When neither the entrance nor exit sensor is pressed the micro-controller
understand that no one has entered the room which results the seven segment value to
be zero and the relay is off.
Case 2. When the light Intensity is High.
When the entrance switch was pressed for the first time and LDR switch was
OFF ,the micro-controller understand that someone want to enter the room and the
intensity of light is sufficient in the room. Which results the motor to rotate clockwise to
open then anticlockwise to close the door with in some time delay and count which
displayed on the seven segments was incremented by one also relay was deactivated
thus, the light in the room deactivate as shown in figure 4.1 bellow.
Figure 4.1 system response schematic of the designed system when LDR off
Case 3 When the Light Intensity is Low
When the entrance switch was pressed for the first time and LDR switch was
ON, the micro-controller understand that someone want to enter the room and the
intensity of light inside the room is in efficient . Which results the motor to rotate
clockwise to open then anticlockwise to close the room with some time delay, count to
be incremented and the relay was activated which turn ON the room light as shown in
figure 4.2 bellow.
Figure 4.2 System response schematic of the designed system when LDR ON
count is shown on the seven segment display as shown in figure 4.3. On the contrary,
when Exit sensor is traversed, then the counter decremented by one which is also shown
on the 7 segment display as shown in figure 4.4.
CHAPTER FIVE
CONCLUSION AND RECOMMENDATION
5.1 Conclusion
Reference
[1] Matta S. and Mahmud S. (2010). An intelligent light control system for power
saving,in the proceedings of the 36th Annual Conference on IEEE Industrial Electronics
Society, 3316-3321. Glendale. (USA)
[2] Gunturkun, R. (2003). Feedforward and Elman Feedback Harmonics Compensation
Using Artificial Neural Networks. PhD thesis, Graduate School of Natural and Applied
Sciences, Sakarya. Turkey
[3] Dermikol, O. (2006). Measurement and Compensation in with Harmonic and
unbalanced Network. Master thesis, Graduate school of Natural and Applied Sciences,
Sakarya. Turkey
[4] Dogan, I. (2006). Microcontroller Projects in C for the 8051: Newness. Oxford.
[5] Changhong S., Wu Y., Zhang X. and Yang W. (2010). Design of new intelligent
street light control system. 8th IEEE International Conference on Robotics & Control
Systems: 1423-1427, Xiamen.
[6] Niu M. and Qin H. (2012). Design of LED street lamps intelligent control system
based on PIC microcontroller, Hangzou.
Appendices
The software program loaded into the micro controller
/*--------------------------------------------------------------------------------------------------*/
/* Program Name: AUTOMATIC ROOM LIGHT CONTROLLER */
/* Name of Author: INDUSTRIAL CONTROL GROUP 10*/
/* ELECTRICAL AND COMPUTER ENGINEERING DEPARTEMENT*/
/* DEBRE MARKOUS UNIVERSITY */
/* JUNE 2015 */
/*--------------------------------------------------------------------------------------------------*/
/* 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 seven segment
*/
/*-------------------------------------------------------------------------------------------------*/
#include <reg51.h>
// header file
sbit SENIN=P1^0;
sbit SENOUT=P1^1;
sbit LDR=P1^2;
sbit RELAY=P1^7;
sbit open=P1^4;
sbit close=P1^5;
/*-----------------------------------DELAY FUNCTION--------------------------*/
void delay (int a)
{
unsigned int i,j;
for(i=0;i<a;i++)
for(j=0;j<1275;j++);
}
/*-----------------------------------MAIN FUNCTION---------------------------*/
void main ()
{
int m,n,o;
while(1)
{
n=0;
while(n<10)
{
m=n/10;
o=n%10;
P2=array[m];
//data pin of P2 are connected to seven segment 1 pin
P3=array[o];
// data pin of P3 are connected to seven segment 2 pin
delay(150);
//open motor
close=0;
//close motor
delay(60);
open=0;
//open motor
close=1;
//close motor
delay(60);
open=1;
//stop motor
close=1;
}
//code when person exit from in side
else if(SENIN==1&&SENOUT==0)
{
if(n>0)
{
}
else
//when person enter as well as exit from the gate no change happen
{
n=n;
open=1;
close=1;
}
}
if(n>0&&LDR==0)
{
/*relay ON when light intensity is low and count
RELAY=1;
}
else if(n>0&&LDR==1)
{
RELAY=0;
}
else if(n==0)
{
RELAY=0;
}
else if(n>=10)
{
open=1;
close=1;
}