Development of Micro Controller Based Water Pump Controller Reviewed
Development of Micro Controller Based Water Pump Controller Reviewed
1.0 INTRODUCTION
The need for a device that can automatically control the lightening system of a room and capability
of taking count of number of people in a room on its own has been long overdue. Fire outbreaks that
occur in various homes originate when the occupant are either sleeping or not even at home at all.
In big environments such as petrochemical industries, whenever there is fire outbreak, it turns out
to be so fierce that people run away for the sake of their lives.
Wastage of electricity is one of the main problems which we are facing now a days. In our home,
school, colleges or industry we see that fan and lighting point are kept on even if there are nobody
in the room or area and passage. This happens due to negligence or because we forgot to turn lights
off or we are in a hurry. To avoid all such situations this project called “Automatic room light
controller with visitor counter” is designed. 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 measures the number of persons
entering in any room like seminar hall, conference room, hotel rooms. This function is implemented
using a pair of Infrared sensors. The microcontroller does the above job. It receives the signals from
the sensors, and this signal is operated under the control of software which is stored in the ROM.
LCD display placed outside the room displays this value of person count. This person count will be
incremented if somebody enters inside the room and at that time lights are turned on. And in reverse
way, person count will be decremented if somebody leaves the room. When number of persons
inside the room is zero, lights inside the room is turned off using a relay interface. In this way Relay
1
does the operation of “Automatic room light controller”. Since this project uses 2 infrared sensors,
1. This project can be used in various rooms like seminar hall, conference hall where the
capacity of room is limited and should not be exceeded. This Project will display the actual
2. This design and project can be used in Hotel rooms to monitor the number of persons that
enters the room when a guest lodges, so to make sure they don’t exceed number of visitors
3. “Automatic Room light Controller with Visitor Counter” can be used in class rooms,
study rooms in colleges, to take count the accurate number of students in the classroom.
4. This project can also be used in our homes because many times we come out of our
bedroom or any other room and we forgot to turn off the room light.
5. This project can be used in Cinema halls, multiplex, malls as well as in temples to count
the number of person entering inside. So that these places should not get over crowded to
avoid congestion.
6. This project helps to ascertain the exact number of people in a particular room
7. It would be very difficult to lock in someone in a room, airplane when trying to evacuate a
place. Man falls asleep on flight making connection in Houston; wakes up in dark, empty
plane.
2
Advantages:
1. Main advantage of this project is that it helps in energy conservation. Because when there is
2. Human efforts to count the number of person is eliminated. Since this project does the automatic
person counting with the help of two sensors installed on door frame.
3. In terms of Security it helps to check unauthorized entrances and exits. The display helps to alert
Future Development:
1. Voice alarm system can be added to indicate that room is full & persons can’t enter inside.
2. We can increase the maximum number of persons that can be counted by implementing the
The sensors must be active to count whenever an obstruction of the Infrared light is blocked
The receiver and the transmitting sections, i.e. the entrance and exit must be in
The controlled appliances will have to have an electrical interface in order to be controlled
by microcontroller
The audience reading this document will have a familiarity with engineering terms
All measurements for frequency, voltage and temperature will be in the standard scale
3
1.4 LIMITATIONS OF 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. So entrance and exit doors must strictly be abided.
It is used only when one single person, cuts the rays of the sensor hence it cannot be used
The only person who can communicate with the control module is the person who is in the
Only devices with electrical controlling input ports will be possible targets for control
The receiver must have a power source (220V) attached at all times
Chapter 1 serves as the introductory chapter where we try to relay the concept and acceptable
reasons why the project should be implemented for the intending user of the work.
Chapter 2 deals with the literature review of all possible related or closely related work of
the design. The evolutionary trend in automatic room light controller operations and design,
specification will also be looked at. The use and importance of this project design will also be
mentioned here. It will be looking at the best place where this project design can be use and where
it cannot. This chapter will also make room for adding additional information on past works in the
Chapter 3 treats the methodology of this project design. It comprises of the information
gathering, the source of the materials used in designing and writing the project report. The
components and devices used in the course of designing this project will be analyzed to know their
4
basic means of operation and how they will help in putting up this design, system design approach;
the possible way to tackled the project design from scratch, bottom-up; it will treat how the practical
detail was gotten before considering about the general principle of the system design, choice of
design system; it focuses on why the project design was done using a microcontroller rather than
In chapter 4, it presents the detail design work and discusses the system, test carried out,
Expected results, and Performance evaluation. The schematic diagram of the design and the source
code (in Assembly language) used in programming the microcontroller were also outlined.
Summary and conclusion of the design will be presented in Chapter 5. It will be looking at
the problems encountered in designing the project and possible solutions to them. From the problems
and solutions of this work, the suggestion for further improvement will be stated.
5
CHAPTER TWO
CONTROLLER
As a result of the fast growing trend in instrumentation engineering, a good number of electronic
instruments that exists in advanced countries should also exist in our country Nigeria.
Industrial electronics is a holistic aspect of modern world technology; as such, most of the
electronically advanced countries like USA, Japan, Russia, etc cannot sustain their technological
The advent of microelectronics in 1959 by jack kilby, gave rise to the birth of both linear and
digital circuits like Operational Amplifiers, Voltage Regulators, IC Timers, Combinational Logic,
Structural and Sequential Logic ICs among a host of other digital system components.
The control and automation of human counters for hotel room processes can be realized using a
microcontroller integrated with an infrared sensor which senses the passage of human beings and
The discovery of the microcontroller in 1972 marked the beginning of micro program control in
electronics. Microprocessors like 8080, 8086, 8088; Pentium, etc were employed for micro program
control of batch counters in the 20th century but microcontrollers became more preferable for such
embedded applications for control systems in contrast to the microprocessors which are better for
general purpose applications. Other devices which may be similarly used for such control operations
are programmable logic devices (PLDs) such as Complex Programmable Logic Devices (CPLDs),
Field Programmable Gate Array (FPGA) among a host of other devices. This automatic room light
6
controller with digital counter contains a Sensor–TSOP 1738 (Infrared Sensor) formed with a
combination of infrared diode and photo diode, while the digital readout was formed with three de-
multiplexed 7-segment display. The control mechanism of this automatic room light controller with
digital counter is realized through a micro program control. The micro program which is the driving
software is written in assembly language and flashed into the 89c51 microcontroller. I have
succeeded in replacing the random logic with microcontroller control logic for sensing the person
and light we are using the light dependent register (LDR). By using this sensor and its related circuit
diagram can count the persons in a given area, put ON/OFF lights automatically, during this project
research.
The system designed was based on fundamental and principles of electromagnetism, electronic
The basic architectural structure of the 8051 is given in figure 2.3 .The block diagram gives a good
picture of the hardware included in the 8051 IC. For internal memory it has a 4kx8 ROM and
128x8RAM .It has two 16-bit counter /timer and interrupt control for five interrupt sources. Serial
I/O is provided by TxD and RxD (transmitter and receiver ), and it also has four 8-bit parallel I/O
ports(p0 p1 p2 p3).there is an 8052 series of microcontroller available that has an 8k ROM, 256
Other version of the 8051 are the 8751 ,which has an internal EPROM for program storage in place
of the ROM, and the 8031 which has no internal ROM ,but instead accesses an external ROM or
EPROM for program instructions. Table 2.3 has an extra 4k of program space (except the 8032),
7
double the RAM area, an extra timer /counter, and one additional interrupt source. All parts use
the same CPU instruction set .The ROM-less version (8031 and 8032) are the least expensive parts
but requires an external ROM or EPROM such as a 2732 or 2764 for program storage
In other to integrate so many function on a single chip, the designers had to develop an architecture
that uses the same address space and external pins for more than one function. The technique is
similar to that used by the 8085A for the multiplexed AD0 –AD7 lines.
Microcontrollers have different manufacturers such as Atmel, Intel, Dallas Semiconductor, Hitachi
Semiconductor, etc. The first microcontroller manufactured was the 8051 by Intel Corporation
known as MCS-51. Later, Atmel Corporation manufactured other microcontrollers which include
8
INTERNAL MEMORY
Number
The 8051 is a 40-pin IC .thirty two pins are needed for the four I/O ports. To provide for the other
microcontroller control signal, most of the pins have alternate functions, which are described in
this section. Also in the section, we see how the 8051 handles the overlapping address space used
by the internal memory, external memory and the special function registers.
Port 0 is dual–purpose, serving as either an 8-bit bidirectional I/O port (P0.0-P0.7) or the low-
order multiplexed address/data bus (AD0-AD7).As an I/O port, it can sink up to 8 LS TTL load in
the low condition and is a float for the the HIGH condition (lol-3.2MA).The alternate port
designation, AD0-AD7 are used to access external memory .They are activated automatically
whenever reference is made to external memory. The AD lines are demultiplexed into A0-A7 and
D0-D7 by using the Address Latch Enable (ALE) signal, the same way it was done with 8085A
Port 1 is an 8-bit bidirectional I/O port that can sink or source up to 4 LS TTL loads (lol=1.6MA
9
Figure 2.2 8051 pin configuration
Port2 is a dual purpose, serving a either an 8-bit bidirectional I/O port (p2.0-p2.7) or as the high
order address bus (A8-A15) for access to external memory. As an I/O port it can sink or source up
to 4LS TTL loads. The port becomes active as the high order address bus whenever reference to
Port 3 is a dual purpose, serving as an 8 bit bidirectional I/O port that can sink or source up to 4LS
TTL load
Address Latch Enable output pulse for latching the low order byte of the address during accesses
to external memory. This pin is also the program pulse input (PROG) during programming of the
EPROM parts.
Program Store Enable is a read strobe for external program memory. It will be connected to the
10
External Access (EA) is tied LOW to enable the micro controller to fetch its program code from
an external memory IC. This pin also receives the 21-V programming supply voltage (VPP) for
Up to 64k of code memory (ROM/EPROM) and 64K of data memory (RAM) can be added to any
of the 8051 family member. If you are using the 8031(ROMless) part, then you have to use external
code memory for storing you program instructions. As mentioned earlier, the alternative function
of port 2 is to provide the high –order addresses byte (A8-A15) and the alternate function of port
If you are interfacing to a general –purpose EPROM like the 2732, then the ALE signal provided
by the 8031 is used to demultiplex the AD0-AD7 lines that are output on port 0 are demultiplexed
by the ALE signal and the address latch, the same way as they were in the 8084A circuits studied
earlier. The PSEN signal is asserted at the end of each instruction fetch cycle to enable the EPROM
outputs to put the addressed code byte on the data bus to be read by port 0.The EA line is tied
LOW so that the 8031 knows to fetch all program code from external memory.
The 8155 RAM accepts the ADO-AD7 lines directly and uses the ALE signal to internally
demultiplex, eliminating the need for an address latch IC. We have to use 11 of the 8051 pins to
interface to the 8155, but the 8155 provides an additional 22 I/O lines, giving us a net gain of 11.
The addresses of the external RAM locations are 0000H to 00FFH, overlapping the addresses of
the internal data memory. There is not a conflict ,however ,because all instruction ignores internal
memory and instead ,activates the appropriate control signal ,RD or WR via port 3 .The LOW
RD or WR signal allows the 8155 to send or receive data to or from port 0 of the 8051.
11
The I/O port on the 8155 are accessed by making the I/OM line HIGH .this is done by using
memory–mapped I/O and specifying an address whose bit A15 is HIGH(800H or higher).
All the members of the 8051 family use the same instruction set. Several new instructions in the
8051 make it especially well-suited for control application. The discussion that follows assumes
Hand assembly of the 8051 instructions into executable machine code is very difficult and misses
out on several of the very useful features available to the ASM51 programmer
The instruction set provides several different means to address data memory locations
We will use the MOV instruction to illustrate several common addressing modes. For example, to
move data into the accumulator, any of the following instructions could be used:
MOV A, Rn: Register addressing, the contents of register Rn (where n=0-7) is moved to the
accumulator.
MOV A, @ Ri: Indirect addressing, the contents of memory whose address is in Ri(where I=0 or
1) is moved to the accumulator.(Note: only registers RO and R1 can be used to hold addresses for
MOV A 20H; Direct addressing ,move the content of RAM location 20H to the accumulator .I/O
ports can also be accessed as a direct addresses as shown in the following instruction.
MOVA, P3: Direct addressing, move the contents of port 3 to the accumulator .Direct addressing
allows you to specify the addresses by giving it actual hex address (e.g. BOH) or by giving its
12
MOV A, #64H: Immediate constant, move the number 64h into the accumulator
In each of the instruction, the destination of the above was the accumulator. The destination in any
of those instructions could also have been registered a direct address location, a direct address
A resistor is a device that restricts the flow of electricity. It opposes the low of current. Resistors
can limit or divide the current, reduce the voltage, protect an electric circuit, or provide large
amount of heat or light. Its unit is ohm. Alternatively, ohm can be defined as the resistance of a
circuit in which a current of 1 ampere generates heat at a rate of 1 watt. If V represents the potential
difference in volts across the circuit having resistance R ohm, carrying a current in amperes, the
relationship is thus;
V = IR………………………………… (1)
Where; R is resistance
Resistors can be connected either in series or parallel in an electrical circuit. When resistors are
connected in series, their combined resistance is equal to the sum individual resistors connected
13
Resistors connected in series
Then effective resistance R = R1 + R2. This can be applied for any number of resistors connected
Note that the combined resistances in series will always be greater than any of the individual
resistances connected together. For example, if R1 and R2 are connected in parallel as shown
below
R1 R2
Fig2.3: Resistor Connected In Series
R= R1 x R2
R1 + R2 ……………………………… (4)
If more than two resistors are connected in parallel, then the following formular can be applied for
R1
R2
14
The inverse of the reciprocal of the effective resistance is the effective resistance R.
Note that the combined resistance in parallel will always be less than any individual resistance.
SYMBOL REPRESENTATION
Fixed resistor
Variable resistor
Current
Potentiometer
Table 2.2 Symbols of some different resistors and what they represent.
The resistance of a resistor is linear, if the resistor is proportional to the potential difference (PD)
across its terminal. For linear resistors, their resistance remains constant provided the temperature
is constant. All resistors have power rating as a result of the heat they give out when operating.
The values of resistors are normally shown using colour bands. Each of the colour represents a
COLOR NUMBER
REPRESENTATION
BLACK 0
BROWN 1
RED 2
15
ORANGE 3
YELLOW 4
GREEN 5
BLUE 6
VIOLET 7
GREY 8
WHITE 9
A capacitor is an electrical device that stores electrical charges. It’s a passive electronic component
difference (voltage) across the conductors, a static electric field develops in the dielectric that
stores energy and produces mechanical force energy and produces a mechanical force between the
in farads (f). This is the ratio of the electric charge on each conductor to the potential difference
between them.
C = QV………………………….. (6)
Q = charge (coulombs)
V = Voltage (volts)
16
One farad can be defined as the charge of one coulomb developed when a potential difference of
one volt is passed through two parallel plates. Capacitors can be connected either in series or in
parallel, this combined capacitance is equal to the sum of individual resistors connected together.
C2
C3
C = C1 + C2…………………………. (7)
C = C1 + C2 + …….Cn…………………………. (8)
Note the combined capacitance in parallel will always be greater than any of the individual
capacitance. When capacitors are connected in series, their combined capacitance is less than any
individual resistances connected together. For example, if C1 and C2 are connected in series as
shown below;
C1 C2
If more than two capacitors are connected in series, then the following formular can be for numbers
17
1 1 1
C =𝐶1 + 𝐶2 + ⋯ 𝐶𝑛…………………………….. (9)
The inverse of the reciprocal of the effective capacitance is the effective capacitance R.
The combined resistance in series will always be less than any individual capacitance.
A diode is a two- terminal electronic component that conducts electric current in only one
direction. The term usually refers to a semiconductor diode, the most common type today. This is
a crystalline piece of semiconductor material connected to two electrical terminals. A vacuum tube
diode (now little used except in some high-power technologies) is a vacuum tube with two
The most common function of a diode is to allow an electric current to pass in one direction (i.e.
the forward direction being that it is forward biased) while blocking current in the opposite
direction (i.e. the reverse direction). Thus, the diode can be thought as an electronic version of a
check valve. This unidirectional behavior is called rectification and is used in converting an
alternating current to a direct current and to extract modulation from radio signal to radio receivers.
However, diode can have more complicated behavior than this simple on-off action.
This is due to their complex non-linear electrical characteristics, which can be tailored by varying
the construction of their p-n junction .these are exploited in special purpose diode that performs
many different function .For example ,specialized diode are used as voltage regulators (zener
diode),to electronically tune radio as TV receives (Varactor diode),to generate radio frequency
18
oscillation (tunnel diode),and to produce light (light emitting diodes ).Tunnel diodes exhibit
negative resistance ,which makes them useful in some types of circuits .diode were the first
The first diode in fig 2.7 is a light emitting diode (LED) which is a diode formed a direct band-
gap semiconductor ,such as gallium arsenide ,carriers that cross the junction emit photons when
they recombine with the majority carrier on the other side .depending on the material wavelength
(or colors)from the infrared to the near ultraviolet may be produced. The forward potential of these
diode depends on the wavelength of the emitted photon: 1.2 v corresponds to red, 2.4 v to violet
.The first LED were red and yellow and higher frequency diodes have been developed over time.
All LED produce incoherent ,narrow-spectrum light “white “LED are actually combination of
three LEDS of different colour ,or a blue LED with a yellow scintillated coating. LEDs can also
be used as low –efficiency photodiodes in signal applications .A LED may be paired with a
The second of diodes in the schematic is the varactor or tuning diode .depicted here is actually two
varactor diode mounted back to back with the dc control voltage applied at the common junction
of the cathodes .these cathodes have the double bar appearance of capacitor to indicate a Varactor
diode .when a D.C control voltage is applied to the common junction of the cathode, the
19
capacitance exhibited by the diode (all diode and transistor exhibit some degree of capacitance )
The third of the diodes is a Zener diode, which is fairly popular for the voltage regulation of low
current power supplies .whilst to obtain high current Zener diode most regulation today is done
electronically with the use of dedicated integrated circuits and pass transistors.
Finally a semiconductor diode could be a small signal diode of the type 1N914 type commonly
used in switching applications, a rectifying diode of the 1N4001 type or even one of the high
power, high current stud mounting type .you will notice the straight bar end has the letter “K” this
donate the cathode while the “A” denotes anode .current can only flow from the anode to the
cathode and not in reverse direction hence the “arrow” appearance .This is one importance
characteristics of diodes.
A transformer is a device that transfers electrical energy from one circuit to another through
inductively coupled conductors (the transformer’s coils). A varying current in the first or primary
winding creates a varying magnetic field through the secondary winding. This varying magnetic
field induces a varying electromotive force (EMF) or voltage in the secondary winding. This effect
If a load is connected to the secondary, an electric current will flow in the secondary winding and
electrical energy will be transferred from the primary circuit through the transformer to the load
.in an ideal transformer, the induced voltage in the secondary winding (Vs) is in proportion with
to the primary voltage (Vp), and is giving by the ratio of the number of turns in the secondary (Ns)
20
By appropriate selection of the ratio of turns, a transformer thus allows an alternating current (AC)
voltage to be stepped up by making ns greater than Np or stepped down by making Ns less than Np
.in the vast majority of transformers, the winding are coils wound around a ferromagnetic core
Transformers ranges in size from a thumbnail –sized coupling transformer hidden inside a stage
microphone to huge unit s of weighing hundreds of tons used to interconnect portions of power
grid .All operate with the basic principles ,although the range of designs is wide .while new
technologies have eliminated the need for transformers in some electronic circuits ,transformers
are still found in nearly all electronic device designed for household (‘’mains’’) voltage
.transformers for high voltage power transmission which makes long distance economically
practical .Transformers can be classified in many different ways ,some of which include
By cooling type: Air cooled, oil filled, fan cooled or water cooled
By application: Such as power supply, impedance matching output voltage and current
By winding turn ratio: step up, step down isolating with equal or near equal ratio, variable
A transistor is a semiconductor device used to amplify and switch electronic signals .it is made of
a solid piece of semiconductor material, with at least three terminals for connection to external
21
circuit. A voltage or current applied to one pair of the transistor terminal changes the current
through another pair of terminals. Because the controlled(output) power can be much more than
the controlling (input)power, the transistor provides amplification of a signal .they are used in a
Varity of circuits and you will you will find that it is rare that a circuit built in a school technology
department does not contain one transistor. They are central to electronics and there are two types;
Small size and minimal weight allowing the development of miniaturized electronic
devices
Extremely long life .some transistorized devices have been in service for more than 50
years
Insensitivity to mechanical shock and vibration, thus avoiding the problems of micro
22
Some limitations are:
Silicon transistors does not operate at voltage higher than about 1000volts (SiC devices can
be operated as high as high 3000 volts ).In contrast electron tubes have been developed that
High power, high frequency operation, such as that used in over the air television
vacuum
Silicon transistors are much more vulnerable than electron tubes to an electromagnetic
The bipolar transistor is the commonly used switch in digital electronic circuits .It is a three-
terminal semiconductor component that allows an input signal at one of its terminal to cause the
other two terminals to become short or an open circuit .the transistors is most commonly made of
silicon that has been altered into N-type material and P-type materials. N-type silicon is made by
bombarding pure silicon with atoms having structures with one more electrons that the silicon
does. The P-type silicon is made by bombarding pure silicon with atoms having structures with
Three distinct region makes up a bipolar transistor: emitter, base and collector .they can be a
combination of N-P-N type material or P-N-P type material bounded together as a three
23
dimensional device .the figure below shows the physical layout and symbol for an N-P-N transistor
.In a PNP transistor, the emitter arrow point the other way.
In an electronic circuit, the input signal (0 or 1) is usually applied to the base of the transistor,
which causes the collection –emitter junction to become a short or an open circuit .The rules of
1. In an NPN transistor, applying a positive voltage from base to emitter causes the collector
Applying a negative voltage or 0V from the base to the emitter causes the collector –to-emitter
2. In a PNP transistor, applying a negative voltage from the base to emitter turns it ON.
Inn electronics , a linear regulator is a voltage regulator based on an active device (such as a bipolar
junction transistor ,field effect transistor or vacuum tubes)operating in its linear region ‘’(in
contrast , a switching regulator is based on transistor forced to act n on/off switch)or passive
device like zener diode operated in their breakdown region .the resulting device is made to act like
a variable resistor, continuously adjusting a voltage network to maintain a constant output voltage
.it is very inefficient compared to a switched mode power supply since it sheds the difference
The transistor (or other devices) is used as one half of a potential divider to control the output
voltage and a feedback circuit compares the output voltage to a reference voltage in other to adjust
the input to the transistor, thus keeping the output voltage reasonably constant, this is inefficient:
24
since the transistor is acting like a resistor, it will waste electrical energy by converting it to heat.
In fact the power loss due to heating in the transistor is the current times the voltage dropped across
the transistor .the same function can be performed more effectively by a switched mode power
supply (SMPS), but it is more complex and the switching current in it tends to produce
electromagnetic interference .An SMPS can easily provide more than 30A of current at voltages
as low as 3v, while for the same voltage and current, a linear regulator would be very bulky and
heavy.
Linear regulators exist in two basic forms; Series regulators and Shunt regulators
Series regulator are the more common form .the series regulator works by providing a path from
the supply voltage to the load through a variable resistance (the main transistor is in the “top half”
of the voltage divider).The power dissipated by the regulating device is equal to the power supply
The shunt regulator works by providing a path from the supply voltage to the ground through a
variable resistance (the main transistor is the’ ’bottom half’ of the voltage divider).The current
through the shunt regulator is diverted away from the load and flows uselessly to the ground
,making this form even less efficient than the series regulator .it is ,however ,simpler sometimes
consisting of just a voltage-reference diode , and it is used in very low-powered circuits were the
wasted current is too small to be of concern .This form is very common for voltage reference
circuit.
All linear regulators require an input voltage at least some minimum amount higher than the
desired output voltage. That minimum amount is called the drop out voltage .for example; a
common regulator such as the 7805 has an output voltage of 5v, but can only maintain this if the
output voltage remains above about 7v, before the output voltage begins sagging below the rated
25
output. Its dropout voltage is therefore 7v-5v =2v .When the supply voltage is less than about 2v
above the desired output voltage ,as the case in low voltage microprocessor power supplies ,so
The 555 timer is a semiconductor integrated circuit containing two blocks of buffers with three-
state non inverted output and common output controlling inputs for all four discrete circuits. The
555 timer is for general purpose use for example in industrial and consumer equipment.
Hysteresis provided(=400mv.typical)
The use of PNP transistors in the input circuit has enabled the achievement of all input load factors
.with hysteresis characteristics; it has a three state non inverted output with the high noise margin.
When output control OC is low the output Y is low if input A is low and Y is high if A is high
.when OC is high all of Y1, Y2, Y3, and Y4 are in the high-impedance state, irrespective of the
status of A. By connecting 1OC with 2OC, it becomes possible to control the output of all 8 circuits
26
CHAPTER THREE.
3.1 METHODOLOGY
Systems Analysis is the process of investigation of a system’s operation with a view to changing
A block diagram of the envisaged circuit was achieved by the use of a methodological approach
known as “TOP DOWN approach “of the development process of microcontroller-based systems.
This phase constitutes an essential step of the development process and one of the critical issues
that determines the quality of the final product. The analysis phase sets the stage for the whole
project. The necessary groundwork for understanding what the project is all about is completed in
this phase. We take the strong position that the more effort you put into planning, the smoother the
rest of the project will go and the better the quality will be of your final product.
The total design and development of any microcontroller based system typically involves three.
Details of the procedure working principles of the various stages are briefly described. The
hardware part consist of the biscuit details, design and calculation of various components used in
the work including the values of the ones assumed too. While the software part is mainly the
programming implementation on the PIC. Summary details are contained in the flowchart block
27
diagram as show below in all, a total of twelve (12)geometrical block shapes were assembled
The existing system makes use of manual controllers, like switches, manual changeovers. This
system can only work as ON/OFF and cannot accertain the number of people in a particular room
A lot of research work consultations were carried out before and during this project. The research
telecommunication and research papers gathered from the libraries and internet as well as
As mentioned ealier, all collected data were used to verify whether the goal has been achieved and
if not, the kind of corrective actions to introduce for the system development.
Energy conservation and safety like prevention of fireoutbreaks from electronical appliances, in
this case where there is no automation of there are so many chances of having our electrical
apliances like the water heater, this can be very disastous, thereby causing fire outbreaks and
energy waste.
The existing system doesnot have counter, which can lead to so many security loopholes and
28
3.3 DESCRIPTION OF THE SYSTEM’S BLOCK DIAGRAM
The microcontroller based automatic room light controller with digital counter is designed with
the aid of a block diagram which serves as a guideline for the development of system’s circuit
schematic diagram.
Enter Exit
5
Signal Light
Conditioning
1
Power Supply
7-Segment
Display
29
Transmission Circuit:-
1. Transmission Circuit:
This circuit diagram shows how a 555 timer IC is configured to function as a basic monostable
multivibrator. A monostable multivibrator is a timing circuit that changes state once triggered, but
returns to its original state after a certain time delay. It got its name from the fact that only one of
R1. At the same time, the flip-flop brings the output (pin 3) level to 'high'. When capacitor C1 as
charged up to about 2/3 Vcc, the flip-flop is triggered once again, this time making the pin 3 output
'low' and turning on pin 7's discharge transistor, which discharges C1 to ground. This circuit, in
effect, produces a pulse at pin 3 whose width t is just the product of R1 and C1, i.e., t=R1C1.
IR Transmission circuit is used to generate the modulated 36 kHz IR signal. The IC555 in the
transmitter side is to generate 36 kHz square wave. Adjust the preset in the transmitter to get a 38
kHz signal at the o/p. around 1.4K we get a 38 kHz signal. Then you point it over the sensor and
2. Receiver Circuit
The IR transmitter will emit modulated 38 kHz IR signal and at the receiver we use TSOP1738
(Infrared Sensor). The output goes high when the there is an interruption and it return back to low
32
after the time period determined by the capacitor and resistor in the circuit. I.e. around 1 second.
CL100 is to trigger the IC555 which is configured as monostable multivibrator. Input is given to
the Port 1 of the microcontroller. Port 0 is used for the 7-Segment display purpose. Port 2 is used
for the Relay Turn On and Turn off Purpose. LTS 542 (Common Anode) is used for 7-Segment
display. And that time Relay will get Voltage and triggered so light will get voltage and it will turn
on. And when counter will be 00 that time Relay will be turned off. Reset button will reset the
microcontroller
Hardware Design
Infrared
33
Fig 3.6 SIMULATED CIRCUIT DIAGRAM
The system circuit was designed with DIPTRACE software. Dip trace is a circuit
designing software. After completion of the designing the circuit layer was prepared.
hex file.
Then soldering process was done. After completion of the soldering process the circuit was
tested.
Still the desired output was not obtained and so troubleshooting was done. In the process
of troubleshooting it was noticed that the circuit aptly soldered and connected and hence came
to conclusion that there was error in programming section which was later rectified and the
34
3.5.2 List of Components:
Following is the list of components that are necessary to build the assembly the project.
Microcontroller – 8051
LM555C(555 Timer)
Resistors
12v Relay
Infrared transmitter
Diode
7-Segment Display
Microcontroller 8051:
The 8051 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-
system programmable Flash memory. The device is manufactured using Atmel’s 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
35
by a conventional nonvolatile memory pro- grammar. By combining a versatile 8-bit CPU with in-
system programmable Flash on a monolithic chip, the Atmel AT8051 is a powerful microcontroller
applications.
The AT8051 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32
I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level
interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition,
the AT89S52 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 Power-down mode
saves the RAM con- tents but freezes the oscillator, disabling all other chip functions until the next
FEATURES:-
8 KB Reprogrammable flash.
16 bit Timer/Counter—3.
8 Interrupt sources.
36
Low power idle and power down modes
Description:
The TSOP17-Series are miniaturized receivers for infrared remote control systems. PIN
diode and preamplifier are assembled on lead frame, the epoxy package is designed as IR filter.
The demodulated output signal can directly be decoded by a microprocessor. TSOP17, Is the
standard IR remote control receiver series, supporting all major transmission codes.
37
Features:
Block Diagram:
38
Application Circuit:
Description:
The LM555 is a highly stable device for generating accurate time delays or oscillation. Additional
terminals are provided for triggering or resetting if desired. In the time delay mode of operation,
the time is precisely controlled by one external resistor and capacitor. For astable operation as an
oscillator, the free running frequency and duty cycle are accurately controlled with two external
39
resistors and one capacitor. The circuit may be triggered and reset on falling waveforms, and the
Features:
Applications:
Precision timing
Pulse generation
Sequential timing
40
3.5.6 LTS 542 (7-Segment Display)
Description:
The LTS 542 is a 0.52 inch digit height single digit seven-segment display. This device utilizes
Hi-eff. Red LED chips, which are made from GaAsP on GaP substrate, and has a red face and red
segment.
Features:
Common Anode
Description:
The KA78XX/KA78XXA series of three-terminal positive regulator are available in the TO-
220/D-PAK package and with several fixed output voltages, making them useful in a wide range
of applications. Each type employs internal current limiting, thermal shut down and safe operating
area protection, making it essentially indestructible. If adequate heat sinking is provided, they can
deliver over 1A output current. Although designed primarily as fixed voltage regulators, these
devices can be used with external components to obtain adjustable voltages and currents.
Features:
Output Current up to 1A
42
3.5.8 RELAY CIRCUIT:
A single pole dabble throw (SPDT) relay is connected to port RB1 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
the relay remains off. As soon as pin of the microcontroller goes high, the relay operates. When
the relay operates and releases. Diode D2 is the standard diode on a mechanical relay to prevent
back EMF from damaging Q3 when the relay releases. LED L2 indicates relay on.
43
3.6 DESIGN CALCULATIONS
𝑅.𝑀.𝑆 𝐷𝑐 𝑉𝑜𝑙𝑡𝑎𝑔𝑒
Kr = 𝐷𝑐 𝑂𝑢𝑡𝑝𝑢𝑡 𝑉𝑜𝑙𝑡𝑎𝑔𝑒 …………………………….… (2)
500mV ≡ 500mA
500×103
Kr = 10
= 50× 10−3
1
CF = 2√2×100×50×10−3 ×200
CF= 3500µF
44
3.6.1 Analysis and Design of Seven Segment Display
The design display interface is a seven segment display (SSP) the calculation is obtained as
follows:
VS=VCC-VF
IS=IF
3.5
RS = 15𝑋1000
VCC = 15V
VF = 2V
IF = 20MA
5−2
R1 = 20𝑋1000
300
R= 20
= 150Ω
45
3.6 PROCESS FLOW CHART
Start
Infrared
Signal
Relay Turn
Counter set Off
to 0
Turn Off
Light
Fig 3.14 Process Flow chart
46
3.7 PRINCIPLE OF OPERATION
If the sensor 1 is interrupted first then the microcontroller will look for the sensor
2. And if it is interrupted then the microcontroller will increment the count and
If the sensor 2 is interrupted first then the microcontroller will look for the sensor
When the last person leaves the room then counter goes to 0 and that time the relay
47
CHAPTER FOUR
4.0 INTRODUCTION
This chapter discusses the design implementation of the system which is the hardware
structure which comprises the infrared receiver, microcontroller and the electromechanical relay
circuit.
The software structure is using the assembly language where a set of program based on
security system is assembled using ASEM 51 assembler. The ASEM 51 assembler takes an
assemble language source file created with a text editor and translate it into a machine language
object file. This translation process is done in two passes over the source file.
During the first pass, the assembler builds a symbolic table and labels that is used in the
source file while in the second pass, the assembler translate the source file into machine language
object file.
4.2 TESTING
Testing is a vital process in the development and realization of any design, be it hardware based,
software based or both. The various components and their circuitry have to be tested to ensure that
all the components on board are certified okay and in good working condition. The components that
did not give the required output specification where isolated and troubleshoot to determine the nature
and cause of the component failure through careful analysis, that is examination of the working
48
4.3 EXPECTED TEST RESULTS
The design of the microcontroller based automatic room light controller with bidirectional
counter is meant to be a system that is used to take the number of people in a particular room on
entrance and exist, so that when there is no one in the room the lights, fans and gadgets are turned
off automatically. With this system the user do not need to press any button, once he/she enters the
room, the room the light turns on. To effectively carry out an intensive test, it is a good practice to
run or retest the project as many times as possible to make sure that the desired design specification
is met. The result that is expected is for the system, when the infrared rays is blocked, the infrared
sensor sends signals which will activate the relay and power the lights. The expected test results
were obtained as the infrared transmitter (entrance) communicated successfully with the receiver on
The signal received was then able to activate the relay and control the lighting point successfully.
The performance of the automatic room light controller with bidirectional counting system proved
In the course of the design and implementation of this project, some problems were encountered.
They are -
49
Component Failures
Short Circuitry
I had issues with better or correct result, which I desired. And also the software problem.
I also had some soldering issues which were resolved using continuity checks performed on
the hardware.
I had issues with better or correct result, which we desired. And also the software problem.
I also had some soldering issues which were resolved using continuity checks performed on
the hardware.
I started testing the circuit from the power supply. There we got over first trouble. After
getting 9V from the transformer it was not converted to 5V and the circuit received 9V.
As the solder was shorted IC 7805 got burnt. So we replaced the IC7805.also the circuit part
around the IC7805 were completely damaged. With the help of the solder we made the
necessary paths.
Construction of the circuit like this needs patient and diligence. The act of soldering must be
mastered and judiciously applied. It requires absolute concentration. Little mistake could jeopardize
the operation of the circuit. And it is usually difficult when one does not have troubleshooting skills.
It is refreshing as well as tedious. The connection of wires interwoven to each other sometimes can
50
4.6 PACKAGING
During the packaging of the system, the size of the case was determined after the consideration of
The space for envisaging modification and easy accessibility to the circuit board or
Consequently, the following materials were considered for packaging of the system which
includes:
Plastic packaging
For this project, the packaging was done using plastic packaging because of its durability,
portability, availability and adjustability. With the metal pack, the positioning and screwing for
51
4.7 BILL OF QUANTITY
BILL OF QUANTITY
The table below shows the list of components purchased and their various price per
unit and quantity purchased:
14 D438 Transistor 60 1 60
52
CHAPTER FIVE
5.1 SUMMARY
For a project to be executed, one has to reason out what the design is and how the design can be
carried out and also be able to implement the design in order to achieve the aims and objectives of
the project.
In the design and implementation of this project, the 89C51 microcontroller is programmed to
coordinate the whole function of the design from the entrance when the infrared light is blocked, the
processing and sending of signals to the exit sensor from where this signals are processed
appropriately and transferred to the relay which are connected to outputs inform of our domestic
appliances, lighting points, etc. This project is designed primary to automatically switch on/off lights
once there is someone in the room and off when the counter counts zero, i.e no one is in the room,
but it could also be tailored so as to be able to control our domestic appliances using a central
controller.
5.2 CONCLUSION
The automated state of the system gives the product certain flexibility and the potential to be
integrated with some of the other household systems into a universal household and industrial
appliance. Eventually, one simple system like this has the capability to control air conditioners,
televisions, CCTV, lighten system, sockets, washing machine, and other home appliances. This
design began the framework for a more complex and more functional product. The concept of an
automatic room light controller and bidirectional counter can be built upon not just for household
usage but for such settings as hotels, schools, hospitals, industrial purpose or businesses.
53
Eventually this designed product can be built using less expensive components thus making it an
affordable alternative for consumers. It is a simple upgrade to an existing standard product and it
In conclusion, this project is a design which should be encouraged and put into large scale
This project is a viable one in the sense that it will go a long way in making it more convenient
easier for users to easily control their appliances, lighting points and even sockets automatically in
their homes, hotel, conference rooms, and classrooms. Because of its importance as a household
need, efforts must be geared towards designing a viable project like this one. I strongly recommend
that the department should see this project as a priceless possession and should endeavor to provide
financial assistance and more research works relating to this project to support and encourage
students embarking on this type of project so as to be used to be used not only in homes but also in
With the level of advancement of design and technology, it is suggested that future works can be
voice activated. This can reduce the convenience of having a control point closely related to the
user.
• By using this circuit and proper power supply we can implement various applications Such
54
• By modifying this circuit and using two relays we can achieve a task of opening and closing
55
REFRENCES
Collins, J.; Pymm, P, “Replacement of the station data logger at Hunterston B nuclear power
Engel berg, S.; Kaminsky, T.; Horesh, M.; “Instrumentation notes - A USB-Enabled, FLASH-
Disk-Based DAS”Vol. 10, Issue 2, (April 2007) Page(s):63 – 66. , Instrumentation &
Erdem, H, “Design and implementation of data acquisition for fuzzy logic controller” ‘Industrial
Technology, (2002). IEEE ICIT ('02. 2002) IEEE International Conference’ on (11-14
Kuchta, R.; Stefan, P.; Barton, Z.; Vrba, R.; Sveda, M, “Wireless temperature data logger”,
Biomedical Research, (2005) Asian Conference’on 5-7 (Sept. 2005) Page(s):208 – 212.
Lee Tat Man, “Recording power demand characteristics and harmonic pollution by a general-
purpose data logger”, ‘Advances in Power System Control, Operation and Management,
743 vol.2.
Luharuka, E.; GAO, R.X., “A microcontroller-based data acquisition for physiological sensing”,
Proceedings of the 19th IEEE’, 21-23 May 2002 Page(s):175 - 180 vol.1
WEBSITES
www.atmel.com
www.seimens.com
56
www.philipsemiconductors.com
www.howstuffworks.com
www.alldatasheets.com
www.efyprojects.com
www.thomson.com/learning
57