Download chapter 1 - Caritas University

Document related concepts

Ground (electricity) wikipedia , lookup

Power engineering wikipedia , lookup

Heterodyne wikipedia , lookup

Electronic engineering wikipedia , lookup

Spark-gap transmitter wikipedia , lookup

Variable-frequency drive wikipedia , lookup

Mercury-arc valve wikipedia , lookup

Capacitor wikipedia , lookup

Power inverter wikipedia , lookup

Pulse-width modulation wikipedia , lookup

History of electric power transmission wikipedia , lookup

Islanding wikipedia , lookup

Stray voltage wikipedia , lookup

Ohm's law wikipedia , lookup

Electrical ballast wikipedia , lookup

Electrical substation wikipedia , lookup

Two-port network wikipedia , lookup

Schmitt trigger wikipedia , lookup

TRIAC wikipedia , lookup

Distribution management system wikipedia , lookup

Voltage optimisation wikipedia , lookup

Current source wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Voltage regulator wikipedia , lookup

P–n diode wikipedia , lookup

History of the transistor wikipedia , lookup

Power electronics wikipedia , lookup

Power MOSFET wikipedia , lookup

Diode wikipedia , lookup

Surge protector wikipedia , lookup

Mains electricity wikipedia , lookup

Alternating current wikipedia , lookup

Buck converter wikipedia , lookup

Transistor wikipedia , lookup

Rectifier wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Current mirror wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
TITLE PAGE
DESIGN AND CONSTRUCTION OF
MICROCONTROLLER BASED DOMESTIC REMOTE
CONTROL SYSTEM
BY
EKWEZE CHIJIOKE IKECHUKWU
EE/2005/121
THE DEPARTMENT OF ELECTRICAL/ELECTRONICS
ENGINEERING
FACULTY OF ENGINEERING, CARITAS UNIVERSITY
AMORJI-NIKE, ENUGU.
SUBMITTED IN PARTIAL FULFILLMENT OF
REQUIREMENT FOR THE AWARD OF BACHELOR OF
ENGINEERING (B.ENG)
AUGUST, 2010.
CERTIFICATION
This is to certify that this project was written by Ekweze Chijioke Ikechukwu
with
Registration
Number
EE/2005/121
of
the
department
of
Electrical/Electronics Engineering faculty of Engineering Caritas University,
Amorji-Nike Enugu State. In partial fulfillment of the requirement for the award
of bachelor of Engineering (B.ENG) Degree in Electrical/Electronic Engineering.
…………………………
Engr. Eze M.O
Project Supervisor
…………………………….
Date
……………………………..
Engr. Prof. G.C Ochiaghia
Head of Department
…………………………….
Date
DEDICATION
I dedicate this project report to God Almighty for his infinite mercy that he has
granted to me through my studies and I also dedicate this work to my parents Mr
& Mrs E.A Ekweze Akwugo Alaoma for their financial and moral supports
throughout my day in school May God bless them and sustain their help to reap
the fruit of their labour.
ACKNOWLEDGMENTS
All glory goes to our Almighty God who led me to this extent May all
glory, honour and Adoration be unto thy Name…..Amen. my special thanks go to
my supervisor Engr. M.O Ezeh for his guide line in achieving a successful report
and also to my lecturers Engr. P.N Mbah, Engr. Nnaji, Engr. Emesoba, my head
of Department (HOD) Engr. Prof G.C Ochiaghia.
I wish to thank my lovely parents Mr & Mrs E.A Ekweze who contributed
immensely through their financial support and guidance during my project
research.
I’ll also use this measure to acknowledge my beloved ones brother, sisters
and friends Mrs. Amaka Alaoma, Mr. Obinna Emma, Barr. Obinna Ajoku, Engr.
Kelechi Ajoku, Engr. Joseph Njoku your further was of great aid to me.
ABSTRACT
The need for a remote control system that can control domestic appliances
and various lighting points and sockets has often been a concern for uses at times
uses find it inconvenient and time they are leaving the house for work it has also
often led to damage of appliances due to the fact that an appliances was not timed
off before leaving the house.
The objective of putting up. This project therefore is to design equipment
that can facilitate a convenient and easy way of controlling our domestic
appliances lighting points and sockets especially in powering by ourselves. This
objective will be accomplished using various components which include a
microcontroller project together with other component.
TABLE OF CONTENT
Title Page
=
=
=
=
=
=
=
=
=
i
Certification
=
=
=
=
=
=
=
=
ii
Dedication =
=
=
=
=
=
=
=
=
iii
=
=
=
=
=
=
=
iv
=
=
=
=
=
=
=
v
Acknowledgement
Abstract
=
=
CHAPTER ONE: INTRODUCTION
1.1
Objective of Project
=
=
=
=
=
=
1
1.2
Justification of Project
=
=
=
=
=
=
1
1.3
Scope of Diagrams in Project
=
=
=
=
=
10
CHAPTER ONE
INTRODUCTION
1.1
OBJECTIVE OF PROJECT
The need for a remote control alert system that can control domestic
appliances and various lighting points and sockets has often been a concern for
users. At times users find it inconvenient and time consuming to go around
turning their appliances on or off each time there is power outage or each time
they are leaving the house for work. It has also often led to damage of appliances
due to the fact that an appliance was not turned off before leaving the house.
The Objective of putting up this project, therefore, is to design an
equipment that can facilitate a convenient and easy way of controlling our
domestic appliances, lighting points and sockets especially in powering them,
without always going to appliances physically by ourselves.
This objective will be accomplished using various components which
include a Microcontroller (AT89C51) which acts as the backbone of the project
together with other components.
1.2
JUSTIFICATION OF PROJECT
The ease of putting our appliances, lighting points and sockets on or off
has made it necessary to develop this system in order to control our appliances,
lighting points and sockets from a central point using a remote control. The issues
of always forgetting our appliances ON when leaving the house has often caused
fire outbreak and explosion in homes and this is another reason that led to
designing and construction of this project.
1.3
SCOPE OF DIAGRAMS IN PROJECT
In this project report, the diagrams will range from simple block
diagrams to complex circuit diagrams which will comprise mostly of common
electrical and electronics symbols. Some of the diagrams that will feature in this
report will be used as the main block on which certain parameters will be
explained upon. Relevant electronic components will also be shown and
described.
This project report will also contain an outline of the circuit diagram as it
is seen physically. The package design diagram will be included showing the
width, height in millimeter (mm).
1.4
BLOCK DIAGRAM OF PROJECT
POWER
SUPPLY
CONTROL 1
INFRARED
RECIEVER
CONTROL 2
CONTROL 3
CONTROL 3
MICRCONTROLLER
CONTROL 3
INFRARED
TRANSMITTER
POWER
SUPPLY
Fig 1.0: Block diagram
1.5
MICROCONTROLER
PUSH
BUTTONS
PROJECT REPORT ORGANIZATION
Chapter 1 serves as the introductory chapter where I try to relay the
concept and acceptable reasons why the project should be implemented for the
intending user of the work. Thus, showing the block diagram of the design and a
scope of diagram for the entire project design.
Chapter 2 deals with the literature review where it will be discussing the
origin of this project design. In the origin of the project, we will be looking at
what brings about the three phase selector in our day to day activity and how the
idea of designing this project comes about.
A description of the Project is also given where the 2 sections of the
project are discussed and the various components contained in the sections also
mentioned.
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 that
will help in the actualization of this project design.
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, data analysis; the components and devices used in the course
of designing this project will be analysis to know their 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 using only digital logic, and
also the data flow arrangement and system flow chart.
In chapter 4, the detail design work will be presented. It will include the
schematic of the design of the various sections of the design and the source code
(in C language) used in programming the microcontroller.
Chapter 5 will be discussing the system testing, Expected results, and
Performance evaluation.
Summary and conclusion of the design will be presented in Chapter 6. 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.
CHAPTER TWO
LITERATURE REVIEW
2.1
REVIEW OF REMOTE CONTROL SYSTEMS
One of the earliest examples of remote control alert was developed in 1893
by Nikola Tesla. With the invention of Relays previously in 1835 by Joseph
Henry it became possible to use remote controls to drive other devices. This is
because of the ability or relays to serve as a switch that can control devices when
energized by electricity. Again with the invention of Integrated Circuits like 555
timers and Microcontrollers, more functionality was added to whole concept of
Remote control alert.
The first remote intended to control a television was developed by Zenith
radio Corporation in the early 1950’s and made use of wire to connect to the
television set. The remote — unofficially called "Lazy Bones" — used a wire to
connect to the television set. To improve the cumbersome setup, a wireless
remote control alert was created in 1955. The remote called "Flashmatic" worked
by shining a beam of light onto a photoelectric cell. Unfortunately, the cells did
not distinguish between light from the remote and light from other sources. The
Flashmatic also required that the remote control be pointed accurately at the
receiver. In 1956 Robert Adler developed "Zenith Space Command", a wireless
remote. It was mechanical and used ultrasound to change the channel and
volume. When the user pushed a button on the remote control it clicked and
struck a bar, hence the term "clicker". Each bar emitted a different frequency and
circuits in the television detected this noise. The invention of the transistor made
possible cheaper electronic remotes that contained a piezoelectric crystal that was
fed by an oscillating electric current at a frequency near or above the upper
threshold of human hearing, though still audible to dogs. The receiver contained a
microphone attached to a circuit that was tuned to the same frequency. Some
problems with this method were that the receiver could be triggered accidentally
by naturally occurring noises, and some people, especially young women, could
hear the piercing ultrasonic signals. There was even a noted incident in which a
toy xylophone changed the channels on these types of TVs since some of the
overtones from the xylophone matched the remote's ultrasonic frequency.
The impetus for a more complex type of television remote control alert came in
the late 1970s with the development of the Ceefax teletext service by the BBC.
Most commercial remote controls at that time had a limited number of functions,
sometimes only four: next station, previous station, increase or decrease volume.
This type of control did not meet the needs of teletext sets where pages were
identified with three-digit numbers. A remote control to select teletext pages
would need buttons for each number from zero to nine, as well as other control
functions, such as switching from text to picture, and the normal television
controls of volume, station, brightness, colour intensity and so on. Early teletext
sets used wired remote controls to select pages but the continuous use of the
remote control alert required for teletext quickly indicated the need for a wireless
device. So BBC engineers began talks with one or two television manufacturers
which led to early prototypes in around 1977-78 that could control a much larger
number of functions. ITT was one of the companies and later gave its name to the
ITT protocol of infrared communication. In the early 1980s, when
semiconductors for emitting and receiving infrared radiation were developed,
remote controls alert gradually switched to that technology which, as of 2006, is
still widely used. Remotes using radio technologies, such as Bose Audio Systems
and those based on Bluetooth also exist.
By the early 2000s, the number of consumer electronic devices in most homes
greatly increased. According to the Consumer Electronics Association, an
average American home has four remotes. To operate a home theater as many as
five or six remotes may be required, including one for cable or satellite receiver,
VCR or digital video recorder, DVD player, TV and audio amplifier. Several of
these remotes may need to be used sequentially, but, as there are no accepted
interface guidelines, the process is increasingly cumbersome. Many specialists,
including Jakob Nielsen [2], a renowned usability specialist and Robert Adler,
the inventor of the modern remote, note how confusing, unwieldy and frustrating
the multiplying remotes have become.
Most modern remote control alert systems for appliances use infrared
diode to emit a beam of light that reaches the device or equipment.
Therefore the concept of remote control is further expanded in another
form by applying it in a circuit that is used to power many appliances
automatically by pressing buttons on the remote control.
2.2
DESCRIPTION OF PROJECT
This project is basically a device used to control our domestic appliances,
lighting points and sockets. It is a remote control alert based system which is
used to power our appliances, lighting points and sockets ON or OFF.
The project consists of two sections which are; the Transmitting side and
the Receiving side. The receiving side consists of a power supply section, a
microcontroller and Relays. It also houses the Infrared Receiving Sensor circuit.
The transmission side is a smaller component which is inform of a hand
held component. It has a power supply section that is powered using a 9v battery.
The transmission side also has a microcontroller which coordinates the various
button inputs. The last major component contained in the transmitter side id the
Infrared emitter/sender which transmits signals received from the input buttons to
the receiving side of the system. This transmission is accomplished wirelessly
through the Infrared emitter/sender on the Transmitter section.
2.3
USE OF PROJECT
This Project is intended generally for everyone and especially for users of
various domestic appliances including lights, fans, televisions etc. This project
will be used to power any of these appliances at any desired time.
CHAPTER THREE
METHODOLOGY
3.1
INFORMATION GATHERING
The source of information used in putting up this design includes:
o the information super-highway (Internet)
o the electronics data sheet
o textbooks
o previous works and
o general intuition
They play a major role in the actualization of this design by providing
ready and accessible information at any time.
3.2
HARDWARE COMPONENTS ANALYSIS
In this section, we have to discuss the principal electronic
components and devices that were put together in designing the
hardware of this project. There functions, m ode of operation and
other features that they have will be compared against other
electronic component that could do the same job in the design.
3.2.1
Transformers
A transformer is a device consisting of two closely coupled
coils (called primary and se condary). An ac voltage applied to the
primary
appears
across
the
secondary,
with
a
voltage
multiplication proportional to the turns ratio of the transformer
and a current multiplication inversely proportional to the turns
ratio. Power is conserved. Figs 3 .1 shows the circuit symbol for a
laminated-core transformer (the kind used in this design - 50Hz ac
power conversion).
Figs 3.0 . Circuit symbol of a Transformer
Transformers are quite efficient (output power is very nearly
equal to input power); thus, a step -up transformer gives higher
voltage at lower current. A transformer of turns ratio n increases
the impedance by n 2 . There is very little primary current if the
secondary is unloaded.
Transformers serve two important functions in electronic
instruments:
 they change the ac line voltage to a useful (usually lower)
value that can be used by the circuit, and
 they “isolate” the electronic device from actual connection
to the power line, because the windings of a transformer are
electrically insulated from each other.
Power transformers (meant for use from the 220V power line)
come in an enormous variety of secondary voltages and currents:
output as low as 1 volt or so up to thousand volts, current ratings
from a few milliamps to hundreds of amps.
3.2.2
Bridge Rectifier
A bridge rectifier can be made using four individual diodes,
but it is also available in special packages (like the one used in
this design) containing the four diodes required. It is called a
full -wave rectifier because it uses all the AC wave (both positive
and negative sections). 1.4V is used up in the bridge rectifier
because each diode uses 0.7V when conducting and there are
always two diodes conducting, as shown in the diagram below.
Bridge rectifiers are rated by the maximu m current they can pass
and the maximum reverse voltage they can withstand (this must
be at least three times the supply RMS voltage so the rectifier
can withstand the peak voltages).
By contrast, rectifier diodes and bridges for use in power
supplies are hefty objects with current ratings going from 1 to 25
amps or more and breakdown voltages going from 100 volts to
1000 volts. They have relatively high lea kage currents (in the
range of micro amps to milliamps) and plenty of junction
capacitance.
Figs 3.1: Circuit symbol for bridge rectifier
Fig 3.2: Output: full -wave varying DC
Current Flow in the Bridge Rectifier
For both positive and negative swings of the transformer, there is
a forward path through the diode bridge. Both conduction paths
cause cu rrent to flow in the same direction through the load
resistor, accomplishing full -wave rectification.
While one set of diodes is forward biased , the other set is reverse
biased and effectively eliminated from the circuit.
`
Figs 3.3
(a) Positive swing of rectification
(b) Negative swing of rectification
3.2.3
Diodes
Diodes are semiconductor devices which might be described as passing
current in one direction only. The latter part of that statement applies equally to
vacuum tube diodes. Diodes however are far more versatile devices than that.
They are extremely versatile in fact.
Diodes can be used as voltage regulators, tuning devices in rf tuned
circuits, frequency multiplying devices in rf circuits, mixing devices in rf circuits,
switching applications or can be used to make logic decisions in digital circuits.
There are also diodes which emit "light", of course these are known as lightemitting-diodes or LED's. As we say diodes are extremely versatile.
Schematic symbols for Diodes
A few schematic symbols for diodes are:
Figure 3.4 - schematic symbols for diodes
Types of Diodes
The first diode in figure 1 is a semiconductor diode which could be a small
signal diode of the 1N914 type commonly used in switching applications, a
rectifying diode of the 1N4001 (400V 1A) type or even one of the high power,
high current stud mounting types. You will notice the straight bar end has the
letter "k", this denotes the "cathode" while the "a" denotes anode. Current can
only flow from anode to cathode and not in the reverse direction, hence the
"arrow" appearance. This is one very important property of diodes.
The second of the diodes is a zener diode which are fairly popular for the
voltage regulation of low current power supplies. Whilst it is possible to obtain
high current zener diodes, most regulation today is done electronically with the
use of dedicated integrated circuits and pass transistors.
The next of the diodes in the schematic is a varactor or tuning diode.
Depicted here is actually two varactor diodes 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 capacitors to indicate a varactor diode. When a
DC control voltage is applied to the common junction of the cathodes, the
capacitance exhibited by the diodes (all diodes and transistors exhibit some
degree of capacitance) will vary in accordance with the applied voltage. A typical
example of a varactor diode would be the Philips BB204G tuning diodes of
which there are two enscapsulated in a TO-92 transistor package. At a reverse
voltage Vr (cathode to anode) of 20V each diode has a capacitance of about 16
pF and at Vr of 3V this capacitance has altered to about 36 pF. Being low cost
diodes, tuning diodes have virtually replaced air variable capacitors in radio
applications today.
The next diode is the simplest form of vacuum tube or valve. It simply has the
old cathode and anode. These terms were passed on to modern solid state
devices. Vacuum tube diodes are mainly only of interest to restorers and tube
enthusiasts.
The last diode depicted is of course a light emitting diode or LED. A led actually
doesn't emit as much light as it first appears, a single LED has a plastic lens
installed over it and this concentrates the amount of light. Seven LED's can be
arranged in a bar fashion called a seven segment LED display and when decoded
properly can display the numbers 0 - 9 as well as the letters A to F.
Rectifying Diodes
The principal early application of diodes was in rectifying 50 / 60 Hz AC
mains to raw DC which was later smoothed by choke transformers and / or
capacitors. This procedure is still carried out today and a number of rectifying
schemes for diodes have evolved, half wave, full wave and bridge rectifiers.
Figure 3.5 - rectifying diodes
As examples in these applications the half wave rectifier passes only the
positive half of successive cycles to the output filter through D1. During the
negative part of the cycle D1 does not conduct and no current flows to the load.
In the full wave application it essentially is two half wave rectifiers combined
and because the transformer secondary is centre tapped, D1 conducts on the
positive half of the cycle while D2 conducts on the negative part of the cycle.
Both add together. This is more efficient. The full wave bridge rectifier operates
essentially the same as the full wave rectifier but does not require a centre tapped
transformer.
A further application of rectifying diodes is in the conversion or detection of Rf
modulated signals to audio frequencies. Typical examples are AM modulated
signals being detected and early detection schemes for FM also used diodes for
detecting modulation.
Voltage Regulating Diodes
For relatively light current loads zener diodes are a cheap solution to
voltage regulation. Zener diodes work on the principle of essentially a constant
voltage drop at a predetermined voltage (determined during manufacture). An
example is a Philips BZX79C12 type with a regulation range between 11.4V and
12.7V but typically 12V and a total power dissipation of 500 mW in a DO-35
package. The dissipation can be extended by using a series pass transistor. Notice
in figure 3 there is a resistor to minimize current drawn but mainly as an aid to
dropping the supply voltage and reducing the burden on the zener diodes.
Fig 3.6 - zener voltage regulation diodes
In the second schematic of figure 3 we have three zener diodes in series
providing voltages of 5V, 10V, 12V, 22V and 27V all from a 36V supply. This
configuration is not necessarily recommended especially when the current being
drawn is seriously mismatched between voltages.
Varactor or Tuning Diodes
These types of diodes work on the principle that all diodes exhibit some
capacitance. Indeed the zener diode BZX79C12 quoted above has, according to
the data book, a capacitance of 65-85 pF at 0V and measured at 1 Mhz.
For AM Radio band applications a specific diode has been devised. The
Philips BB212 in a TO-92 case is one such type. Each of the diodes has a
capacitance of 500 - 620 pF at a reverse bias of 0.5V and <22 pF at 8V. This
diode's capacitance ratio is quoted at 22.5:1 which could not be achieved easily if
at all with an air variable capacitor. This type of diode is depicted in figure 1
above.
Several obvious advantages come immediately to mind, a small transistor
type package, very low cost, ease of construction on a circuit board, can be
mounted away from heat generating devices, frequency determining circuitry
entirely dependent upon resistor values and ratios, DC voltage control can be
either from frequency synthesiser circuits or perhaps a multi-turn potentiometer.
Such a potentiometer aids band spreading and fine tuning if two potentiometers
are used. The only real limitation is your imagination and the calculations
involved.
Diodes as frequency multipliers
Just one more example of the versatility of diodes is the frequency
doubling circuit depicted in Figure 4. Now if that looks a lot like the full wave
rectifier from figure 2 above you would be correct. That is why the ripple
frequency for 50 / 60 Hz always comes out at 100 / 120 Hz.
Fig 3.7 - diodes as frequency multipliers
Here the input is a wide band transformer and the signal passes to a full
wave rectifier comprising two 1N914 diodes. The DC component caused by the
rectification passes to ground through RFC which of course presents a high
impedance to the rf portion of the signal but essentially a short circuit for DC.
The original signal should be down about 40 dB and with this type of circuit
there would be a loss of somewhere around 7.5 dB so the 2 X signal would
require further amplification to restore that loss.
Diodes as mixers
With some subtle re-arrangement to figure 4 we can get the circuit to
function as a two diode frequency mixer. Note that there are other diode
arrangements as well in this application. See mixers.
Figure 3.8 - diodes as frequency mixers
The diodes here act as switches and it can be mathematically shown that
only the sum and difference signals will result. For example, if F1 was 5 Mhz and
F2 was 3 Mhz then the sum and difference signals from the diodes would be 8
Mhz and 2 Mhz. None of the original signals appear at the output and this is a
most important property of using diodes as mixers.
It should be noted that although 1N914 diodes are depicted you would
normally use hot carrier diodes in any serious application and the diodes need to
be well matched.
Applications of switching Diodes
Similar types of diodes have been developed specifically for band
switching purposes. Although a typical 1N914 type switching diode can be used
for such purposes it is preferable to use diodes which have been optimised for
such purposes because the Rd on is much lower. This means the diode resistance
Rd can have a serious affect on rf circuits in particular the "Q" of a tuned circuit.
One example of a low Rd device is the Philips BA482 diode used for band
switching in television tuners. It has a typical Rd of 0.4 ohms at a forward current
of 10 mA.
In figure 5 we have one application where switching diodes operate. All
diodes serve to switch in or out capacitors in the diagram which is presented here
just to illustrate one single application of switching diodes, many, many more
applications exist. Again the limit is your imagination.
Figure 3.9 - applications of switching diodes
The switching diodes in figure 4 switch in or out successively higher
values of capacitors as each control select line is "grounded". The voltage from
the +5V feed line proceeds through the diode at DC thus opening the diode and
making it appear "transparent" for rf purposes. The capacitor with the value
attached is then "switched" into circuit. Other components marked RFC and Cbp
are chokes and bypass capacitors for "clean" switching. The bypass capacitors
and choke values would be determined by the frequency of operation.
We could just have easily have switched inductors instead of capacitors.
Note why Rd is quite important on overall circuit performance. If we were using
inductors the diode resistance Rd would have a significant affect on inductor "Q"
which in turn would affect filter performance, if it was in fact an LC filter
application.
Switching Diodes in Logic Circuits
There are a whole range of digital building blocks available and just by
way of one illustration of using diodes we have presented the 74HC4040 twelve
stage binary ripple counter (there are others with varying number of stages).
In the schematic of figure 7 we have this counter which divides by
successive division of two for twelve stages. Initially because there is no voltage
drop across the resistor a high appears on all anodes as well as on pin 4 the
master reset causing the counter to reset forcing all outputs low and in turn a
voltage drop across each diode and across the resistor and a low on reset.
Progressively each of the outputs change from low to high for a certain period of
time and without unduly complicating matters when all outputs as selected by our
diode combination (in this particular case 1 + 2 + 32 + 64 = 99) are
simultaneously high the voltage drop across the resistor will cease and cause pin
11 (reset which was formerly low) to go high and reset all the internal ripple
counters.
Fig 3.10 - applications of switching diodes in digital logic circuits
At the same time pin 4 changes state also with reset. It can been shown this
happens once every 99 periods. Simply by placing diodes on the right outputs we
can select to divide by any number up to 4095 using this particular counter.
3.2.4
Capacitors
A capacitor is an electrical device that can store energy in the electric field
between a pair of closely spaced conductors (called 'plates'). When voltage is
applied to the capacitor, electric charges of equal magnitude, but opposite
polarity, build up on each plate.
Capacitors are used in electrical circuits as energy-storage devices. They can also
be used to differentiate between high-frequency and low-frequency signals and
this makes them useful in electronic filters.
Capacitors are occasionally referred to as condensers.
The capacitor's capacitance (C) is a measure of the amount of charge (Q) stored
on each plate for a given potential difference or voltage (V) which appears
between the plates:
C = Q/V
In SI units, a capacitor has a capacitance of one farad when one coulomb of
charge causes a potential difference of one volt across the plates. Since the farad
is a very large unit, values of capacitors are usually expressed in microfarads
(µF), nanofarads (nF) or picofarads (pF).
The capacitance is proportional to the surface area of the conducting plate and
inversely proportional to the distance between the plates. It is also proportional to
the permittivity of the dielectric (that is, non-conducting) substance that separates
the plates.
Stored energy
As opposite charges accumulate on the plates of a capacitor due to the separation
of charge, a voltage develops across the capacitor owing to the electric field of
these charges. Ever-increasing work must be done against this ever-increasing
electric field as more charge is separated. The energy (measured in joules, in SI)
stored in a capacitor is equal to the amount of work required to establish the
voltage across the capacitor, and therefore the electric field. The energy stored is
given by:
E stored =1/2cv2 = 1/2(Q2/C) = 1/2VQ
where V is the voltage across the capacitor.
The maximum energy that can be (safely) stored in a particular capacitor is
limited by the maximum electric field that the dielectric can withstand before it
breaks down. Therefore, all capacitors made with the same dielectric have about
the same maximum energy density (joules of energy per cubic meter).
Circuits with DC sources
Electrons cannot easily pass directly across the dielectric from one plate of the
capacitor to the other as the dielectric is carefully chosen so that it is a good
insulator. When there is a current through a capacitor, electrons accumulate on
one plate and electrons are removed from the other plate. This process is
commonly called 'charging' the capacitor -- even though the capacitor is at all
times electrically neutral. In fact, the current through the capacitor results in the
separation of electric charge, rather than the accumulation of electric charge. This
separation of charge causes an electric field to develop between the plates of the
capacitor giving rise to voltage across the plates. This voltage V is directly
proportional to the amount of charge separated Q. Since the current I through the
capacitor is the rate at which charge Q is forced through the capacitor (dQ/dt),
this can be expressed mathematically as:
I = dQ2/dT = C dV/dt
For circuits with a constant (DC) voltage source, the voltage across the capacitor
cannot exceed the voltage of the source. (Unless the circuit includes a switch and
an inductor, as in SMPS, or a switch and some diodes, as in a charge pump).
Thus, an equilibrium is reached where the voltage across the capacitor is constant
and the current through the capacitor is zero. For this reason, it is commonly said
that capacitors block DC current.
Circuits with AC sources
The capacitor current due to an AC voltage or current source reverses direction
periodically. That is, the AC current alternately charges the plates in one
direction and then the other. With the exception of the instant that the current
changes direction, the capacitor current is non-zero at all times during a cycle.
For this reason, it is commonly said that capacitors 'pass' AC current. However,
at no time do electrons actually cross between the plates, unless the dielectric
breaks down or becomes excessively 'leaky'. In this case it would probably
overheat, malfunction, burn out, or even fail catastrophically possibly leading to
an explosion.
Since the voltage across a capacitor is the integral of the current, as shown above,
with sine waves in AC or signal circuits this results in a phase difference of 90
degrees, the current leading the voltage phase angle. It can be shown that the AC
voltage across the capacitor is in quadrature with the AC current through the
capacitor. That is, the voltage and current are 'out-of-phase' by a quarter cycle.
The amplitude of the voltage depends on the amplitude of the current divided by
the product of the frequency of the current with the capacitance, C.
Capacitor networks
Series or parallel arrangements
Capacitors in a parallel configuration each have the same potential difference
(voltage). Their total capacitance (Ceq) is given by:
Ceq = C1 + C2 + …..+ Cn
The reason for putting capacitors in parallel is to increase the total amount of
charge stored. In other words, increasing the capacitance also increases the
amount of energy that can be stored. Its expression is:
Estored = 1/2CV2
The current through capacitors in series stays the same, but the voltage across
each capacitor can be different. The sum of the potential differences (voltage) is
equal to the total voltage. Their total capacitance is given by:
In parallel the effective area of the combined capacitor has increased, increasing
the overall capacitance. While in series, the distance between the plates has
effectively been increased, reducing the overall capacitance.
In practice capacitors will be placed in series as a means of economically
obtaining very high voltage capacitors, for example for smoothing ripples in a
high voltage power supply. Three "600 volt maximum" capacitors in series, will
increase their overall working voltage to 1800 volts. This is of course offset by
the capacitance obtained being only one third of the value of the capacitors used.
This can be countered by connecting 3 of these series set-ups in parallel, resulting
in a 3x3 matrix of capacitors with the same overall capacitance as an individual
capacitor but operable under three times the voltage. In this application, a large
resistor would be connected across each capacitor to ensure that the total voltage
is divided equally across each capacitor and also to discharge the capacitors for
safety when the equipment is not in use.
Another application is for use of polarized capacitors in alternating current
circuits; the capacitors are connected in series, in reverse polarity, so that at any
given time one of the capacitors is not conducting.
3.2.5
Voltage Regulator
A Voltage Regulator (also called a "regulator") has only
three legs and appears to be a comparatively simple device but it
is actually a very complex integrated c ircuit. A regulator converts
varying input voltage and produces a constant "regulated" output
voltage. Voltage regulators are available in a variety of outputs,
typically 5 volts, 9 volts and 12 volts. The last two digits in the
name indicate the output vo ltage. The "LM78XX" series of
voltage regulators are designed for positive input.
Table 1: Voltage regulators and their voltages
Name
Voltage
LM7805
+ 5 volts
LM7809
+ 9 volts
LM7812
+ 12 volts
LM7905
- 5 volts
LM7909
- 9 volts
LM7912
- 12 volts
Figs 3.11: Block diagram of internal configuration of LM 7805
Voltage regulator
Fig 3.12: Circuit symbol of a Voltage Regulator
Fig 3.13: Physical appearance of a 5V Voltage
Regulator
Voltage regulators are very robust. They can withstand over current draw due to short circuits and also over -heating. In both
cases the regulator will shut down before damage occurs. The only
way to destroy a regulator is to apply reverse vo ltage to its input.
Reverse polarity destroys the regulator almost instantly. To
avoid this possibility, a diode is connected across the power
supply. This is especially important when using nine volt battery
supplies as it is common to 'test' the batte ry by connecting it one
way and then the other. Even this short 'test' could destroy the
regulator if a protection diode is not used.
As a general rule the input voltage should be limited to 2 to 3
volts above the output voltage. The LM78XX series can ha ndle up
to 30 volts input, but the power difference between the input
voltage/current ratio and output voltage/current ratio appears as
heat. If the input voltage is unnecessarily high the regulator will
get very hot. Unless sufficient heat -sinking is prov ided the
regulator will shut down.
The 7805’s has a quiescent current of 5mA and 78L05’s
quiescent current is 3mA. It regulates with 2 volts dropout from
unregulated input to regulated output.
3.2.6
Light Emitting Diode
Light emitting diodes , common ly called LED’s are real
unsung heroes in the electronics world. They do dozens of
different jobs and are found in all kinds of devices. Among other
things,
they
form
the
numbers
on
digital
clocks ,
transmit
information from remote controls , light up watches and tell you
when your appliances are turned on. Collected together, they can
form images on a jumbo television screen or illuminate a traffic
light .
Basically, LED’s are just tiny light bulbs that fit easily into an
electrical circui t. But unlike ordinary incandescent bulbs , they
don't have a filament that will burn out, and they don't get
especially hot. They are illuminated solely by the movement of
electrons in a semiconductor material, and they last just as long as
a standard transistor.
Many circuits use a LED as a visual indicator of some sort even if
only as an indicator of power supply being turned on.
Most LED’s operate at 1.7V although this is not always the case
and it is wise to check. The dropping resistor is simply the net of
supply voltage minus the 1.7V led voltage then divided by the led
brightness current expressed as "amps" ( ohms law). Note the
orientation of both cathode and anode with respect to the ground
end and the supply end. Usually with a led the longer lead is the anode
3.2.7
Resistors
Resistance is the property of a component which restricts the flow of
electric current. Energy is used up as the voltage across the component drives
the current through it and this energy appears as heat in the component.
Resistance is measured in ohms, the symbol for ohm is an omega
1
is quite small for electronics so resistances are often given in k
1 k = 1000
.
and M .
1 M = 1000000 .
Resistors used in electronics can have resistances as low as 0.1 or as high as 10
M .
Resistors connected in Series
Fig 3.14: Resistors connected in Series
When resistors are connected in series their combined resistance is equal to
the individual resistances added together. For example if resistors R1 and R2 are
connected in series their combined resistance, R, is given by:
Combined resistance in series: R = R1 + R2
be extended for more resistors: R = R1 + R2 + R3 + R4 + ...
This can
Note that the
combined resistance in series will always be greater than any of the individual
resistances.
Resistors connected in Parallel
When resistors are connected in parallel their combined resistance is less
than any of the individual resistances. There is a special equation for the
combined resistance of two resistors R1 and R2:
For more than two resistors connected in parallel a more difficult equation must
be used. This adds up the reciprocal ("one over") of each resistance to give the
reciprocal of the combined resistance, R:
The simpler equation for two resistors in parallel is much easier to use!
Note that the combined resistance in parallel will always be less than any of the
individual resistances.
Resistor values - the resistor colour code
Resistance is measured in ohms, the symbol of ohm is an omega
1
is quite small so resistor values are often given in k
1 k = 1000
Resistor
.
and M .
1 M = 1000000 .
values
are
normally
shown
using
colored
bands.
Each color represents a number as shown in the table.
Most resistors have 4 bands:

The first band gives the first digit.

The second band gives the second digit.

The third band indicates the number of zeros.

The fourth band is used to shows the tolerance (precision) of the resistor,
this may be ignored for almost all circuits but further details are given
below.
Fig 3.15: Resistor color codes
This resistor has red (2), violet (7), yellow (4 zeros) and gold bands.
So its value is 270000 = 270 k .
On circuit diagrams the is usually omitted and the value is written 270K.
Small value resistors (less than 10 ohm)
The standard colour code cannot show values of less than 10 . To show
these small values two special colours are used for the third band: gold which
means × 0.1 and silver which means × 0.01. The first and second bands represent
the digits as normal.
For
example:
red,
violet,
gold
bands
represent
27 × 0.1 = 2.7
blue, green, silver bands represent 56 × 0.01 = 0.56
Tolerance of resistors (fourth band of colour code)
The tolerance of a resistor is shown by the fourth band of the colour code.
Tolerance is the precision of the resistor and it is given as a percentage. For
example a 390 resistor with a tolerance of ±10% will have a value within 10%
of 390 , between 390 - 39 = 351 and 390 + 39 = 429 (39 is 10% of 390).
A
special
silver
colour
±10%,
code
gold
is
used
±5%,
for
the
red
fourth
±2%,
band
tolerance:
brown
±1%.
If no fourth band is shown the tolerance is ±20%.
Tolerance may be ignored for almost all circuits because precise resistor values
are rarely required.
3.2.8 MICROCONTROLLER
A microcontroller (or MCU) is a computer-on-a-chip used to control
electronic devices. It is a type of microprocessor emphasizing self-sufficiency
and cost-effectiveness, in contrast to a general-purpose microprocessor (the kind
used in a PC). A typical microcontroller contains all the memory and interfaces
needed for a simple application, whereas a general purpose microprocessor
requires additional chips to provide these functions.
A microcontroller is a single integrated circuit with the following key
features:

central processing unit - ranging from small and simple 8-bit processors to
sophisticated 32- or 64-bit processors

input/output interfaces such as serial ports

peripherals such as timers

RAM for data storage

ROM, EEPROM or Flash memory for program storage

clock generator - often an oscillator for a quartz timing crystal, resonator or
RC circuit
This integration drastically reduces the number of chips and the amount of wiring
and Printed Circuit Board (PCB) space that would be needed to produce
equivalent systems using separate chips.
The Atmel AT89 series is an Intel 8051-compatible family of 8 bit
microcontrollers (µCs) manufactured by the Atmel Corporation. Based on the
Intel 8051 core, the AT89 series remains very popular as general purpose
microcontrollers, due to their industry standard instruction set, and low unit cost.
This allows a great amount of legacy code to reused without modification in new
applications.
3.2.9 CRYSTAL OSCILLATORS
A crystal oscillator is an electronic circuit that uses the mechanical resonance of
a vibrating crystal of piezoelectric material to create an electrical signal with a
very precise frequency. This frequency is commonly used to keep track of time
(as in quartz wristwatches), to provide a stable clock signal for digital integrated
circuits, and to stabilize frequencies for radio transmitters.
Using an amplifier and feedback, it is an especially accurate form of an electronic
oscillator. The crystal used therein is sometimes called a "timing crystal". On
schematic diagrams a crystal is sometimes labeled with the abbreviation XTAL
Crystals and frequency
Fig 3.16 :Schematic symbol and equivalent circuit for a quartz crystal in an
oscillator
The crystal oscillator circuit sustains oscillation by taking a voltage signal from
the quartz resonator, amplifying it, and feeding it back to the resonator. The rate
of expansion and contraction of the quartz is the resonant frequency, and is
determined by the cut and size of the crystal.
A regular timing crystal contains two electrically conductive plates, with a slice
or tuning fork of quartz crystal sandwiched between them. During startup, the
circuit around the crystal applies a random noise AC signal to it, and purely by
chance, a tiny fraction of the noise will be at the resonant frequency of the
crystal. The crystal will therefore start oscillating in synchrony with that signal.
As the oscillator amplifies the signals coming out of the crystal, the crystal's
frequency will become stronger, eventually dominating the output of the
oscillator. Natural resistance in the circuit and in the quartz crystal filter out all
the unwanted frequencies.
One of the most important traits of quartz crystal oscillators is that they can
exhibit very low phase noise. In other words, the signal they produce is a pure
tone. This makes them particularly useful in telecommunications where stable
signals are needed, and in scientific equipment where very precise time
references are needed.
The output frequency of a quartz oscillator is either the fundamental resonance or
a multiple of the resonance, called an overtone frequency.
A typical Q for a quartz oscillator ranges from 104 to 106. The maximum Q for a
high stability quartz oscillator can be estimated as Q = 1.6 × 10 7/f, where f is the
resonance frequency in MHz.
Environmental changes of temperature, humidity, pressure, and vibration can
change the resonant frequency of a quartz crystal, but there are several designs
that reduce these environmental effects. These include the TCXO, MCXO, and
OCXO (defined below). These designs (particularly the OCXO) often produce
devices with excellent short-term stability. The limitations in short-term stability
are due mainly to noise from electronic components in the oscillator circuits.
Long term stability is limited by aging of the crystal.
Due to aging and environmental factors such as temperature and vibration, it is
hard to keep even the best quartz oscillators within one part in 10 −10 of their
nominal frequency without constant adjustment. For this reason, atomic
oscillators are used for applications that require better long-term stability and
accuracy.
Although crystals can be fabricated for any desired resonant frequency, within
technological limits, in actual practice today engineers design crystal oscillator
circuits around relatively few standard frequencies, such as 10 MHz, 20 MHz and
40 MHz. Using frequency dividers, frequency multipliers and phase locked loop
circuits, it is possible to synthesize any desired frequency from the reference
frequency.
Care must be taken to use only one crystal oscillator source when designing
circuits to avoid subtle failure modes of meta stability in electronics. If this is not
possible, the number of distinct crystal oscillators, PLLs, and their associated
clock domains should be rigorously minimized, through techniques such as using
a subdivision of an existing clock instead of a new crystal source. Each new
distinct crystal source needs to be rigorously justified, since each one introduces
new, difficult to debug probabilistic failure modes, due to multiple crystal
interactions, into equipment.
3.2.10
TRANSISTOR
Transistors can be regarded as a type of switch, as can many electronic
components. They are used in a variety of circuits and you will find that it is rare
that a circuit built in a school Technology Department does not contain at least
one transistor. They are central to electronics and there are two main types; NPN
and PNP. Most circuits(e.g. this project design) tend to use NPN. There are
hundreds of transistors which work at different voltages but all of them fall into
these two categories.
Types of transistor
There are two types of standard transistors, NPN and PNP, with different
circuit symbols. The letters refer to the layers of semiconductor
material used to make the transistor. Most transistors used today are NPN
because this is the easiest type to make from silicon. This page is mostly about
NPN transistors.
Fig 3.17: Transistor circuit symbols
The leads are labeled base (B), collector (C) and emitter (E).
These terms refer to the internal operation of a transistor but they are not much
help in understanding how a transistor is used, so just treat them as labels!
A Darlington pair is two transistors connected together to give a very high
current gain.
In addition to standard (bipolar junction) transistors, there are field-effect
transistors which are usually referred to as FETs. They have different circuit
symbols and properties.
Transistor currents
The diagram shows the two current paths through a transistor. The small
base current controls the larger collector current. When the switch is closed a
small current flows into the base (B) of the transistor. It is just enough to make
LED B glow dimly. The transistor amplifies this small current to allow a larger
current to flow through from its collector (C) to its emitter (E). This collector
current is large enough to make LED C light brightly.
Fig 3.18 : Transistor Currents
When the switch is open no base current flows, so the transistor switches off the
collector current. Both LEDs are off. A transistor amplifies current and can be
used as a switch.
This arrangement where the emitter (E) is in the controlling circuit (base current)
and in the controlled circuit (collector current) is called common emitter mode. It
is the most widely used arrangement for transistors.
Functional model of an NPN transistor
Fig 3.19: Functional Model of a transistor
The operation of a transistor is difficult to explain and understand in terms of
its internal structure. It is more helpful to use this functional model:

The base-emitter junction behaves like a diode.

A base current IB flows only when the voltage VBE across the base-emitter
junction is 0.7V or more.

The small base current IB controls the large collector current Ic.

Ic = hFE × IB
(unless the transistor is full on and saturated)
hFE is the current gain (strictly the DC current gain), a typical value for h FE
is 100 (it has no units because it is a ratio)

The collector-emitter resistance RCE is controlled by the base current IB:
o
IB = 0 RCE = infinity transistor off
o
IB small RCE reduced transistor partly on
o
IB increased RCE = 0 transistor full on ('saturated')
Additional notes:

A resistor is often needed in series with the base connection to limit the
base current IB and prevent the transistor being damaged.

Transistors have a maximum collector current Ic rating.

The current gain hFE can vary widely, even for transistors of the same type!

A transistor that is full on (with RCE = 0) is said to be 'saturated'.

When a transistor is saturated the collector-emitter voltage VCE is reduced
to almost 0V.

When a transistor is saturated the collector current Ic is determined by the
supply voltage and the external resistance in the collector circuit, not by
the transistor's current gain. As a result the ratio Ic/IB for a saturated
transistor is less than the current gain hFE.

The emitter current IE = Ic + IB, but Ic is much larger than IB, so roughly IE
= Ic.
The Transistor as a Switch
Because a transistor's collector current is proportionally limited by its base
current, it can be used as a sort of current-controlled switch. A relatively small
flow of electrons sent through the base of the transistor has the ability to exert
control over a much larger flow of electrons through the collector.
Suppose we had a lamp that we wanted to turn on and off by means of a
switch. Such a circuit would be extremely simple:
Fig 3.20: Transistor as switch
For the sake of illustration, let's insert a transistor in place of the switch to show
how it can control the flow of electrons through the lamp. The controlled current
through a transistor must go between collector and emitter. Since it's the current
through the lamp that we want to control, we must position the collector and
emitter of our transistor where the two contacts of the switch are now. We must
also make sure that the lamp's current will move against the direction of the
emitter arrow symbol to ensure that the transistor's junction bias will be correct:
Fig 3.21
In this example I happened to choose an NPN transistor. A PNP transistor could
also have been chosen for the job, and its application would look like this:
Fig 3.22
The choice between NPN and PNP is really arbitrary. All that matters is that the
proper current directions are maintained for the sake of correct junction biasing
(electron flow going against the transistor symbol's arrow).
Going back to the NPN transistor as in former circuit above, we are faced with
the need to add something more so that we can have base current. Without a
connection to the base wire of the transistor, base current will be zero, and the
transistor cannot turn on, resulting in a lamp that is always off. Remember that
for an NPN transistor, base current must consist of electrons flowing from emitter
to base (against the emitter arrow symbol, just like the lamp current). Perhaps the
simplest thing to do would be to connect a switch between the base and collector
wires of the transistor like this:
Fig 3.23
If the switch is open, the base wire of the transistor will be left "floating" (not
connected to anything) and there will be no current through it. In this state, the
transistor is said to be cutoff. If the switch is closed, however, electrons will be
able to flow from the emitter through to the base of the transistor, through the
switch and up to the left side of the lamp, back to the positive side of the battery.
This base current will enable a much larger flow of electrons from the emitter
through to the collector, thus lighting up the lamp. In this state of maximum
circuit current, the transistor is said to be saturated.
Fig 3.24
Of course, it may seem pointless to use a transistor in this capacity to control the
lamp. After all, we're still using a switch in the circuit, aren't we? If we're still
using a switch to control the lamp -- if only indirectly -- then what's the point of
having a transistor to control the current? Why not just go back to our original
circuit and use the switch directly to control the lamp current?
There are a couple of points to be made here, actually. First is the fact that
when used in this manner, the switch contacts need only handle what little base
current is necessary to turn the transistor on, while the transistor itself handles the
majority of the lamp's current. This may be an important advantage if the switch
has a low current rating: a small switch may be used to control a relatively highcurrent load. Perhaps more importantly, though, is the fact that the currentcontrolling behavior of the transistor enables us to use something completely
different to turn the lamp on or off. Consider this example, where a solar cell is
used to control the transistor, which in turn controls the lamp:
Fig 3.25
Or, we could use a thermocouple to provide the necessary base current to turn the
transistor on:
Fig 3.26
Even a microphone of sufficient voltage and current output could be used to turn
the transistor on, provided its output is rectified from AC to DC so that the
emitter-base PN junction within the transistor will always be forward-biased:
Fig 3.27
The point should be quite apparent by now: any sufficient source of DC
current may be used to turn the transistor on, and that source of current need only
be a fraction of the amount of current needed to energize the lamp. Here we see
the transistor functioning not only as a switch, but as a true amplifier: using a
relatively low-power signal to control a relatively large amount of power. Please
note that the actual power for lighting up the lamp comes from the battery to the
right of the schematic. It is not as though the small signal current from the solar
cell, thermocouple, or microphone is being magically transformed into a greater
amount of power. Rather, those small power sources are simply controlling the
battery's power to light up the lamp.
3.2.11
RELAYS
Fig 3.28: Relay
A relay is an electrically operated switch. Current flowing through the
coil of the relay creates a magnetic field which attracts a lever and changes the
switch contacts. The coil current can be on or off so relays have two switch
positions and they are double throw (changeover) switches.
Relays allow one circuit to switch a second circuit which can be
completely separate from the first. For example a low voltage battery circuit can
use a relay to switch a 230V AC mains circuit. There is no electrical connection
inside the relay between the two circuits; the link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a
12V relay, but it can be as much as 100mA for relays designed to operate from
lower voltages. Most ICs (chips) cannot provide this current and a transistor is
usually used to amplify the small IC current to the larger value required for the
relay coil. The maximum output current for the popular 555 timer IC is 200mA
so these devices can supply relay coils directly without amplification.
Relays are usually SPDT or DPDT but they can have many more sets of
switch contacts, for example relays with 4 sets of changeover contacts are readily
available. For further information about switch contacts and the terms used to
describe them please see the page on switches.
Most relays are designed for PCB mounting but you can solder wires
directly to the pins providing you take care to avoid melting the plastic case of
the relay.
The supplier's catalogue should show you the relay's connections. The coil
will be obvious and it may be connected either way round. Relay coils produce
brief high voltage 'spikes' when they are switched off and this can destroy
transistors and ICs in the circuit. To prevent damage you must connect a
protection diode across the relay coil.
The animated picture shows a working relay with its coil and switch
contacts. You can see a lever on the left being attracted by magnetism when the
coil is switched on. This lever moves the switch contacts. There is one set of
contacts (SPDT) in the foreground and another behind them, making the relay
DPDT.
The relay's switch connections are usually labeled COM, NC and NO:

COM = Common, always connect to this; it is the moving part of the
switch.

NC = Normally Closed, COM is connected to this when the relay coil is
off.

NO = Normally Open, COM is connected to this when the relay coil is on.

Connect to COM and NO if you want the switched circuit to be on when
the relay coil is on.

Connect to COM and NC if you want the switched circuit to be on when
the relay coil is off.
3.2.12
INFRA RED TRANSMITTERS AND RECIEVERS
Infrared (IR) radiation is electromagnetic radiation of a wavelength
longer than that of visible light, but shorter than that of radio waves. The name
means "below red" (from the Latin infra, "below"), red being the color of
visible light of longest wavelength. Infrared radiation spans three orders of
magnitude and has wavelengths between approximately 750 nm and 1 mm.
Infra-red light is just below the red portion of the visible spectrum, and so is
invisible to the human eye.
Infrared transmitters are the devices that transmit signals through Infrared
and these signals are received by Infrared recievers. Infrared recievers are signal
sensors which are capable of receiving infrared rays and is able to transform this
rays to an intended function.
3.3 SYSTEM DESIGN APPROACH
A domestic remote control alert system is a system that should be designed
with a sense of accuracy and priciseness. This should be done so as to ensure that
the reqiured result is achieved. Again, the need to achieve a fast and well
coordinated remote control alert system resulted in designing a work that uses a
microcontroller and relays so that the various loads will be programmed and
controlled by their respective relays together with all the other components used.
Bottom-Up
It's a long-standing principle of design style that the functional elements of a
system should not be too large. If some component of a design grows beyond the
stage where it's readily comprehensible, it becomes a mass of complexity which
conceals errors as easily as a big city conceals fugitives. Such work will be hard
to read, hard to test, and hard to debug.
In accordance with this principle, a large program must be divided into pieces,
and the larger the program, the more it must be divided.
Experienced system designers divide up their design differently. As well as topdown design, they follow a principle which could be called bottom-up design-changing the design to suit the problem.
It's worth emphasizing that bottom-up design doesn't mean just building the same
circuit in a different order. When you work bottom-up, you usually end up with a
different circuit.
In typical circuit design, once you abstract out the parts which are merely
bookkeeping, what's left is much shorter; the higher you build up the language,
the less distance you will have to travel from the top down to it. This brings
several advantages:
1.
By making the circuit do more of the work, bottom-up design yields design
which are smaller and more agile. A smaller circuit doesn't have to be
divided into so many components, and fewer components means circuit
which are easier to read or modify. Fewer components also means fewer
connections between components, and thus less chance for errors there. As
industrial designers strive to reduce the number of moving parts in a
machine, experienced system designers use bottom-up design to reduce the
size and complexity of their circuit.
2.
Bottom-up design promotes component re-use. When you design two or
more circuits, many of the components you added for the first circuit will
also be useful in the succeeding ones. Once you've acquired a large
substrate of utilities, designing a new circuit can take only a fraction of the
effort it would require if you had to start.
3.
Bottom-up design makes circuits easier to interpret.
4.
Because it causes you always to be on the lookout for patterns in your
circuit, working bottom-up helps to clarify your ideas about the design of
your circuit. If two distant components of a circuit are similar in form,
you'll be led to notice the similarity and perhaps to redesign the circuit in a
simpler way.
3.4 CHOICE OF DESIGN
The benefits of a automated solution was recognized from the start. The reason
for making this choice of design is that it is programmable and can easily be
modified. This reason, thus, makes it possible to improve on its features.
3.5
THE PROCESS FLOW CHART
START
SCAN FOR
BUTTON PRESS
IS
BUTTON
PRESSED?
NO
YES
COMPUTE
ACTUAL
PIN
SEND
SIGNAL
END
Fig 3.29 : Remote Control Transmitter flow chart
START
SEARCH
FOR
SIGNAL
IS
SIGNAL
FOUND?
COMPUTE
SIGNAL
ISSUE
CONTROL
END
Fig 3.30 : Remote Control receiver side flow chart
CHAPTER FOUR
DESIGN
4.1
THE HARDWARE SUBSYSTEMS
The design of the essential interfaces and sub sections that makes the 2
sections of the project are treated here. There function and mode of operation,
which are not treated in chapter 3, will be presented here.
Let start with the power supply design. Basically, it employs a 5V
regulated power supply that powers the microcontroller which needs nothing but
a 5V and the NPN transistors used. A 12V supply is also used in the design
which is meant to power a 12V relay.
4.1.0
Basic Power Supply Design
There are many types of power supply. Most are designed to convert high
voltage AC mains electricity to a suitable low voltage supply for electronics
circuits and other devices. A power supply can by broken down into a series of
blocks, each of which performs a particular function.
For example a 5V regulated supply:
Fig 4.0: Block diagram of power supply
Each of the blocks is described in more detail below:

Transformer - steps down high voltage AC mains to low voltage AC.

Rectifier - converts AC to DC, but the DC output is varying.

Smoothing - smooths the DC from varying greatly to a small ripple.

Regulator - eliminates ripple by setting DC output to a fixed voltage.
Power supplies made from these blocks are described below with a circuit
diagram and a graph of their output:

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator
Transformer only
Fig 4.1
The low voltage AC output is suitable for lamps, heaters and special AC motors.
It is not suitable for electronic circuits unless they include a rectifier and a
smoothing capacitor.
Transformer + Rectifier
Fig 4.2
The varying DC output is suitable for lamps, heaters and standard motors. It is
not suitable for electronic circuits unless they include a smoothing capacitor.
Transformer + Rectifier + Smoothing
Fig 4.3
The smooth DC output has a small ripple. It is suitable for most electronic
circuits.
Transformer + Rectifier + Smoothing + Regulator
Fig 4.4
The regulated DC output is very smooth with no ripple. It is suitable for all
electronic circuits.
4.2
Microcontroller (AT89C51)
Description
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer
with 4K bytes of Flash programmable and erasable read only memory (PEROM).
The device is manufactured using Atmel’s high-density nonvolatile memory
technology and is compatible with the industry-standard MCS-51 instruction set
and pinout. 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 Flash on a monolithic chip, the Atmel AT89C51 is a powerful
microcomputer 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, 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 Power-down Mode
saves the RAM contents but freezes the oscillator disabling all other chip
functions until the next hardware reset.
It has the following Features:
• Compatible with MCS-51™ Products
• 4K Bytes of In-System Reprogrammable Flash Memory
– Endurance: 1,000 Write/Erase Cycles
• Fully Static Operation: 0 Hz to 24 MHz
• Three-level Program Memory Lock
• 128 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Two 16-bit Timer/Counters
• Six Interrupt Sources
• Programmable Serial Channel
• Low-power Idle and Power-down Modes
Pin Configuration of AT89C51
Fig 4.5: Microcontroller Pin Configuration
Fig 4.6 : Internal Block Diagram of AT89C51
Pin Description
VCC
Supply voltage.
GND
Ground.
Port 0
Port 0 is an 8-bit open-drain bi-directional I/O port. As an
Output port, each pin can sink eight TTL inputs. When 1s are written to port 0
pins, the pins can be used as high impedance inputs.
Port 0 may also be configured to be the multiplexed low order
Address/data bus during accesses to external program and data memory. In this
mode P0 has internal pull-ups.
Port 0 also receives the code bytes during Flash programming,
and outputs the code bytes during program verification. External pull-ups are
required during program verification.
Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups.
The Port 1 output buffers can sink/source four TTL inputs.
When 1s are written to Port 1 pins they are pulled high by the internal pull-ups
and can be used as inputs. As inputs, Port 1 pins that are externally being pulled
low will source current (IIL) because of the internal pull-ups.
Port 1 also receives the low-order address bytes during Flash programming and
verification.
Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups.
The Port 2 output buffers can sink/source four TTL inputs.
When 1s are written to Port 2 pins they are pulled high by the internal pull-ups
and can be used as inputs. As inputs, Port 2 pins that are externally being pulled
low will source current (IIL) because of the internal pull-ups. Port 2 emits the
high-order address byte during fetches
from external program memory and during accesses to external data memory that
use 16-bit addresses (MOVX @DPTR). In this application, it uses strong internal
pull-ups when emitting 1s. During accesses to external data memory that use 8bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function
Register.
Port 2 also receives the high-order address bits and some control signals during
Flash programming and verification.
Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pullups.
The Port 3 output buffers can sink/source four TTL inputs.
When 1s are written to Port 3 pins they are pulled high by
the internal pull-ups and can be used as inputs. As inputs,
Port 3 pins that are externally being pulled low will source
current (IIL) because of the pull-ups.
Port 3 also serves the functions of various special features
of the AT89C51 as listed below:
Table 2: Port pins and their alternate functions
Port 3 also receives some control signals for Flash programming
and verification.
RST
Reset input. A high on this pin for two machine cycles while
the oscillator is running resets the device.
ALE/PROG
Address Latch Enable output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input
(PROG) during Flash programming. In normal operation ALE is emitted at a
constant rate of 1/6 the oscillator frequency, and may be used for external timing
or clocking purposes. Note, however, that one ALE pulse is skipped during each
access to external Data Memory. If desired, ALE operation can be disabled by
setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a
MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting
the ALE-disable bit has no effect if the microcontroller is in external execution
mode.
PSEN
Program Store Enable is the read strobe to external program memory.
When the AT89C51 is executing code from external program memory, PSEN is
activated twice each machine cycle, except that two PSEN activations are
skipped during each access to external data memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable
the device to fetch code from external program memory locations starting at
0000H up to FFFFH.
Note, however, that if lock bit 1 is programmed, EA will be internally latched on
reset. EA should be strapped to VCC for internal program executions. This pin
also receives the 12-volt programming enable voltage (VPP) during Flash
programming, for parts that require 12-volt VPP.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier which can be configured for use as an on-chip oscillator, as shown in
Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the
device from an external clock source, XTAL2 should be left unconnected while
XTAL1 is driven as shown in Figure 2. There are no requirements on the duty
cycle of the external clock signal, since the input to the internal clocking circuitry
is through a divide-by-two flip-flop, but minimum and maximum voltage high
and low time specifications must be observed.
Idle Mode
In idle mode, the CPU puts itself to sleep while all the on chip peripherals
remain active. The mode is invoked by software. The content of the on-chip
RAM and all the special functions registers remain unchanged during this mode.
The idle mode can be terminated by any enabled interrupt or by a hardware reset.
It should be noted that when idle is terminated by a hard ware reset, the device
normally resumes program execution, from where it left off, up to two machine
cycles before the internal reset algorithm takes control. On-chip hardware inhibits
access to internal RAM in this event, but access to the port pins is not inhibited.
To eliminate the possibility of an unexpected write to a port pin when Idle is
terminated by reset, the instruction following the one that invokes Idle should not
be one that writes to a port pin or to external memory.
Fig 4.7. Oscillator Connections
Note: C1, C2 = 30 pF ± 10 pF for Crystals
= 40 pF ± 10 pF for Ceramic Resonators
4.3
THE INPUT INTERFACE DESIGN
The input interface of the system is designed to be inform of buttons.
These input buttons form part of the remote control transmitter. When this
buttons are depressed, it sends a signal inform of command to the microcontroller
on the transmitter circuit. On receiving the command, the microcontroller
interprets them and sends out the resulting interpretation to the infrared
transmitter which then communicates with the receiver on the receiver circuit.
The buttons are interfaced with the microcontroller to Port 1 while the infrared
transmitter is interfaced to Pin 0 of Port 0`.
The circuit below shows schematic representation of the Input interface.
100 ohm
9v
Battery
`
LED
2.2k
P0.0
FIG 4.8: Input Interface Schematic
4.4
THE OUTPUT INTERFACE DESIGN
The Output Interface of the system is a control circuit which receives
inputs from the remote control transmitter and transfers this control signal
received to their respective loads or outputs. The system uses an Infrared receiver
sensor through which the transmitted signals are received wirelessly. The signals
received by this infrared receiver is sent to the microcontroller which will
perform the processing of the signals according to the commands on the
microcontroller control program.
The infrared receiver is interfaced to the microcontroller on P1.0 (Port1)
The next stage of the process is the transfer of the passed signals by the
microcontroller from where the processed signals are sent to the Relay which will
perform the control operation of the loads. These signals are transferred out from
the microcontroller through P2.0-P2.4 (Pin21-Pin25) to the relays. The relays are
powered by an unregulated 12v voltage from the power supply of the transmitter.
The schematic diagram is shown below.
+12v
+5v Vcc
+5v Vcc
Infrared
Sensor
+5v Vcc
`
1k
2k
+5v Vcc
RST
9
RXD
TXD
INT0
INT1
T0
T1
WR
30pf RD
XTAL 1
GND
+5v Vcc
ATMEL
89C51
35
34
33
32
31 EA/VPP
ALE/PROG
30
29 PSEN
28
27
25
16mhz
+12v
37
36
26
XTAL 1
30pf
40
39
38
1
2
3
4
5
24
23
22
21
1k
2k
+12v
P2.4
+5v Vcc
P2.3
P2.2
P2.1
P2.0
1k
2k
+12v
+5v Vcc
1k
2k
+12v
+5v Vcc
1k
2k
Fig 4.9: Output Interface Schematic
4.5
CONTROL SOFTWARE PROGRAM DESIGN
#include <at89x51.h>
unsigned char key,x,y,m,key_buff[5],z;
//delay function:
void delay(int pause)
{
while (!(pause==0))
{
pause--;
_asm;
// 1ms assembly code(for 18Mhz crystal)
mov r6,#3
// adjust to crystal freqeuncy
mov r7,#215
00111$:
djnz r7,00111$
djnz r6,00111$
_endasm;
}
return;
}
unsigned char key_scan(void){
P2=0xfe;
delay(50);
key=P0;
delay(20);
if(key==P0){
y=key;
for(x=1;x<9;x++){
if(((y>>(x-1))&0x01)==0){
return x;
}
}
}
P2=0xfd;
delay(50);
key=P0;
delay(20);
if(key==P0){
y=key;
for(x=1;x<9;x++){
if(((y>>(x-1))&0x01)==0){
return (x+8);
}
}
}
P2=0xfb;
delay(50);
key=P0;
delay(20);
if(key==P0){
y=key;
for(x=1;x<9;x++){
if(((y>>(x-1))&0x01)==0){
return (x+16);
}
}
}
P2=0xf7;
delay(50);
key=P0;
delay(20);
if(key==P0){
y=key;
for(x=1;x<9;x++){
if(((y>>(x-1))&0x01)==0){
return (x+24);
}
}
}
P2=0xef;
delay(50);
key=P0;
delay(20);
if(key==P0){
y=key;
for(x=1;x<9;x++){
if(((y>>(x-1))&0x01)==0){
return (x+32);
}
}
}
return 0;
}
void get_key(void){
P1_0=0;
for(m=0;m<5;m++){
next:
if((key_scan())==0){
goto next;}
else{
key_buff[m]=key_scan();
P1_0=1;
delay(500);
P1_0=0;
while(key_scan()){;}
}
}
}
void transmit(void){
for(x=0;x<3;x++){
P3=P1=0;
delay(1);
P3=P1=0xff;
delay(1);
}
}
void main(void){
key=z=0; P0=P2=0xff; P1_1=0;
while(1){
if((key_scan())==33){
while(key_scan()){;}
get_key();
P1_0=1;
}
if((key_scan())==34){
while(key_scan()){;}
//
P1_1=0; delay(1000);
for(m=0;m<5;m++){
y=key_buff[m];
for(x=1;x<7;x++){
if(((y>>(x-1))&0x01)==0){
P1_1=P1_2=0; delay(200);
P1_1=P1_2=1; delay(500);
}
else{
P1_1=P1_2=0; delay(200);
P1_1=P1_2=1; delay(1000);
}
}
P1_1=P1_2=0;
delay(2000);
}
P1_1=1;delay(100);
P1_1=0;
}
}
}
CHAPTER FIVE
SYSTEM TESTING, IMPLEMETATION AND EVALUATION
5.1
SYSTEM 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 has 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 troubleshooted to determine the
nature and cause of the component failure through careful analysis, that is
examination of the working principles of the component(s).
Here also during the testing analysis, modularization and Interface design
were also tested. Each module in case of the software were tested to know
whether it performs the functions assigned to it and also to know whether each of
the module can interact as Required by transferring and returning data in form of
a signal.
5.1.0 Test Plan
The test plan specifies the steps taken in checking and testing each of the
module that constitute the whole system design. The essence of this is to check
for the functionality of the system in question for optimal performance. Some of
the steps taken are as follows:-
5.1.1 Test Data
The functionality of the system depends to some extent on the
correctness of the exact signal(s) being produced by different modules.
Here the test data includes signal that emanates from each module for
performing its intended task.
The test data are as follows:  The signal that comes out when the sensitive switches are being
pressed or activated.
 The signal that comes out from the power supply unit
 The signal coming out from the AT89C51 microcontroller module
of the transmitter and receiver units to their respective infrared
transmitters and nfrared receiver sensors.
 The signal coming out from the AT89C51 microcontroller module to the
relays.
The above-mentioned test data was used to test for the functionality
of the systems.
5.2
CHOICE OF PROGRAMING LANGUAGE
The Programming language used in programming the AT89C51
microcontroller IC is C language.
5.3
EXPECTED TEST RESULTS
The design of the microcontroller based domestic remote control for
appliances, lighting points and sockets is meant to be a system that is used to
control the powering of our domestic appliances, lighting points and sockets in
ours homes when a user presses a button on the hand held remote control
transmitter. 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 results that are expected is for the hand held
remote control to be able to send infrared signals which will activate the relays
and power our appliances. The expected test results where obtained as the
infrared transmitter communicated successfully with the receiver on the receiver
section of the remote control system.
The signal received was then able to activate the relay and control the
attached appliance and lighting points successfully.
5.4
PERFORMANCE EVALUATION
The performance of the remote control system proved satisfactory and is working
according to expectations.
CHAPTER SIX
SUMMARY AND CONCLUSION
6.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 ”domestic remote control
for fans, lighting points and sockets, the 89C51 microcontroller is programmed to
coordinate the whole function of the design from the input when the button is
pressed to the processing and sending of signals to the receiver 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 so as to be able to control our domestic appliances using
a central remote control.
6.2
PROBLEMS ENCOUNTERED
In the course of the design and implementation of this project,
some problems were encountered. They are  Low finance during Implementation.
 Difficulty when writing programs, debugging and interfacing
 Component Failures
 Short Circuitry
 Inadequate and epileptic power supply.
The aforementioned problems were later taken care of during the
design processes and implementation of this project.
6.2
RECOMMENDATION FOR FURTHER IMPROVEMENT
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 from a central point in their home using a remote control
which has buttons for controlling each appliance connected to the system.
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 offices, schools etc.
6.3 CONCLUSION
In conclusion, this project is a design which should be encouraged
and put into large scale manufacturing because of its various advantages.
REFERENCES
Wiky, J. and Sons (1977) Practical Digital Design New York.
Horowitz, P. (1986) The art of Electronics 2nd Edition.
Schuler, A.C. (1999) Elections Principles and Application. 5th Edition.
Tokhein, R.L. (1995) Digital Electronics Principles and Application 5 th
Edition.
APPENDIX A
SYSTEM COMPONENTS
1.
Vero Board
2.
12v Transformer
3.
Bridge Rectifier
4.
3300uf Capacitor
5.
7805 voltage regulator
6.
104 picofarad/0.01uf capacitor
7.
Atmel 89C51 microcontroller
8.
16mhz Crystal Oscillator
9.
30pico farad (pf) capacitors
10.
10uf capacitors
11.
1 kilo ohm resistors
12.
2 kilo ohm resistors
13.
Relays
14.
Transistors
15.
Zener Diodes
16.
LEDs
17.
220 ohms resistor
18.
Infrared Sensors
19.
Push Buttons
20.
9v battery
21.
10 kilo ohm resistor
22.
100 ohm resistor
APPENDIX B
COMPONENT COST ANALYSIS
COMPONENTS USED
COST PRICES (N)
1. Vero Board(1)
2. 12v Transformer(1)
3. Bridge Rectifier(1)
150
250
100
40
4. 3300uf Capacitor(1)
5. 7805 voltage regulator(2)
300
6. 104 picofarad/0.01uf capacitor(1)
50
7. Atmel 89C51 microcontroller (2)
1500
8. 16mhz Crystal Oscillator(2)
200
9. 30pico farad (pf) capacitors(4)
120
10.10uf capacitors(3)
60
11.1 kilo ohm resistors(5)
50
12. 2 kilo ohm resistors(5)
75
13. Relays(5)
400
14. Transistors(5)
150
15. Zener Diodes(5)
25
16. LEDs(3)
15
17. 220 ohms resistor(1)
10
18. Infrared Sensors(1)
200
19. Push Buttons(5)
50
20. 9v battery(1)
100
21. 10 kilo ohm resistor(5)
50
22. 100 ohm resistor(1)
20
APPENDICE I
89C51 INSTRUCTION SET
Instructions that Affect Flag Settings(1)
Instruction Flag Instruction Flag
C OV AC C OV AC
ADD X X X CLR C 0
ADDC X X X CPL C X
SUBB X X X ANL C,bit X
MUL 0 X ANL C,/bit X
DIV 0 X ORL C,bit X
DA X ORL C,/bit X
RRC X MOV C,bit X
RLC X CJNE X
SETB C 1
(1)Note that operations on SFR byte address 208 or bit addresses 209-215 (i.e., the
PSW or bits in the PSW) will also affect flag settings.
Notes on instruction set and addressing modes:
Rn Register R7-R0 of the currently selected Register Bank.
direct 8-bit internal data location’s address. This could be an Internal Data RAM
location (0-127) or a SFR [i.e., I/O port,
control register, status register, etc. (128-255)].
@Ri 8-bit internal data RAM location (0-255) addressed indirectly through register
R1 or R0.
#data 8-bit constant included in the instruction.
#data 16 16-bit constant included in the instruction
addr 16 16-bit destination address. Used by LCALL and LJMP. A branch can be
anywhere within the 64k-byte Program
Memory address space.
addr 11 11-bit destination address. Used by ACALL and AJMP. The branch will be
within the same 2k-byte page of
program memory as the first byte of the following instruction.
rel Signed (two’s complement) 8-bit offset byte. Used by SJMP and all conditional
jumps. Range is –128 to +127 bytes relative to first byte of the following instruction.
bit Direct Addressed bit in Internal Data RAM or Special Function Register.
MNEMONIC DESCRIPTION BYTE OSCILLATOR PERIOD
ARITHMETIC OPERATIONS
ADD A,Rn Add register to Accumulator 1 12
ADD A,direct Add direct byte to Accumulator 2 12
ADD A,@Ri Add indirect RAM to Accumulator 1 12
ADD A,#data Add immediate data to Accumulator 2 12
ADDC A,Rn Add register to Accumulator with carry 1 12
ADDC A,direct Add direct byte to Accumulator with carry 2 12
ADDC A,@Ri Add indirect RAM to Accumulator with carry 1 12
ADDC A,#data Add immediate data to ACC with carry 2 12
SUBB A,Rn Subtract Register from ACC with borrow 1 12
SUBB A,direct Subtract direct byte from ACC with borrow 2 12
SUBB A,@Ri Subtract indirect RAM from ACC with borrow 1 12
SUBB A,#data Subtract immediate data from ACC with borrow 2 12
INC A Increment Accumulator 1 12
INC Rn Increment register 1 12
INC direct Increment direct byte 2 12
INC @Ri Increment indirect RAM 1 12
DEC A Decrement Accumulator 1 12
DEC Rn Decrement Register 1 12
DEC direct Decrement direct byte 2 12
DEC @Ri Decrement indirect RAM 1 12
INC DPTR Increment Data Pointer 1 24
MUL AB Multiply A and B 1 48
DIV AB Divide A by B 1 48
DA A Decimal Adjust Accumulator 1 12
LOGICAL OPERATIONS
ANL A,Rn AND Register to Accumulator 1 12
ANL A,direct AND direct byte to Accumulator 2 12
ANL A,@Ri AND indirect RAM to Accumulator 1 12
ANL A,#data AND immediate data to Accumulator 2 12
ANL direct,A AND Accumulator to direct byte 2 12
ANL direct,#data AND immediate data to direct byte 3 24
ORL A,Rn OR register to Accumulator 1 12
ORL A,direct OR direct byte to Accumulator 2 12
ORL A,@Ri OR indirect RAM to Accumulator 1 12
ORL A,#data OR immediate data to Accumulator 2 12
ORL direct,A OR Accumulator to direct byte 2 12
ORL direct,#data OR immediate data to direct byte 3 24
XRL A,Rn Exclusive-OR register to Accumulator 1 12
XRL A,direct Exclusive-OR direct byte to Accumulator 2 12
XRL A,@Ri Exclusive-OR indirect RAM to Accumulator 1 12
XRL A,#data Exclusive-OR immediate data to Accumulator 2 12
XRL direct,A Exclusive-OR Accumulator to direct byte 2 12
XRL direct,#data Exclusive-OR immediate data to direct byte 3 24
CLR A Clear Accumulator 1 12
CPL A Complement Accumulator 1 12
RL A Rotate Accumulator left 1 12
RLC A Rotate Accumulator left through the carry 1 12
RR A Rotate Accumulator right 1 12
RRC A Rotate Accumulator right through the carry 1 12
SWAP A Swap nibbles within the Accumulator 1 12
DATA TRANSFER
MOV A,Rn Move register to Accumulator 1 12
MOV A,direct Move direct byte to Accumulator 2 12
MOV A,@Ri Move indirect RAM to Accumulator 1 12
DATA TRANSFER (Continued)
MOV A,#data Move immediate data to Accumulator 2 12
MOV Rn,A Move Accumulator to register 1 12
MOV Rn,direct Move direct byte to register 2 24
MOV RN,#data Move immediate data to register 2 12
MOV direct,A Move Accumulator to direct byte 2 12
MOV direct,Rn Move register to direct byte 2 24
MOV direct,direct Move direct byte to direct 3 24
MOV direct,@Ri Move indirect RAM to direct byte 2 24
MOV direct,#data Move immediate data to direct byte 3 24
MOV @Ri,A Move Accumulator to indirect RAM 1 12
MOV @Ri,direct Move direct byte to indirect RAM 2 24
MOV @Ri,#data Move immediate data to indirect RAM 2 12
MOV DPTR,#data16 Load Data Pointer with a 16-bit constant 3 24
MOVC A,@A+DPTR Move Code byte relative to DPTR to ACC 1 24
MOVC A,@A+PC Move Code byte relative to PC to ACC 1 24
MOVX A,@Ri Move external RAM (8-bit addr) to ACC 1 24
MOVX A,@DPTR Move external RAM (16-bit addr) to ACC 1 24
MOVX A,@Ri,A Move ACC to external RAM (8-bit addr) 1 24
MOVX @DPTR,A Move ACC to external RAM (16-bit addr) 1 24
PUSH direct Push direct byte onto stack 2 24
POP direct Pop direct byte from stack 2 24
XCH A,Rn Exchange register with Accumulator 1 12
XCH A,direct Exchange direct byte with Accumulator 2 12
XCH A,@Ri Exchange indirect RAM with Accumulator 1 12
XCHD A,@Ri Exchange low-order digit indirect RAM with ACC 1 12
BOOLEAN VARIABLE MANIPULATION
CLR C Clear carry 1 12
CLR bit Clear direct bit 2 12
SETB C Set carry 1 12
SETB bit Set direct bit 2 12
CPL C Complement carry 1 12
CPL bit Complement direct bit 2 12
ANL C,bit AND direct bit to carry 2 24
ANL C,/bit AND complement of direct bit to carry 2 24
ORL C,bit OR direct bit to carry 2 24
ORL C,/bit OR complement of direct bit to carry 2 24
MOV C,bit Move direct bit to carry 2 12
MOV bit,C Move carry to direct bit 2 24
JC rel Jump if carry is set 2 24
JNC rel Jump if carry not set 2 24
JB rel Jump if direct bit is set 3 24
JNB rel Jump if direct bit is not set 3 24
JBC bit,rel Jump if direct bit is set and clear bit 3 24
PROGRAM BRANCHING
ACALL addr11 Absolute subroutine call 2 24
LCALL addr16 Long subroutine call 3 24
RET Return from subroutine 1 24
RETI Return from interrupt 1 24
AJMP addr11 Absolute jump 2 24
LJMP addr16 Long jump 3 24
SJMP rel Short jump (relative addr) 2 24
JMP @A+DPTR Jump indirect relative to the DPTR 1 24
JZ rel Jump if Accumulator is zero 2 24
JNZ rel Jump if Accumulator is not zero 2 24
CJNE A,direct,rel Compare direct byte to ACC and jump if not equal 3 24
CJNE A,#data,rel Compare immediate to ACC and jump if not equal 3 24
CJNE RN,#data,rel Compare immediate to register and jump if not equal 3 24
CJNE @Ri,#data,rel Compare immediate to indirect and jump if not equal 3 24
DJNZ Rn,rel Decrement register and jump if not zero 2 24
DJNZ direct,rel Decrement direct byte and jump if not zero 3 24
NOP No operation 1 12
Infrared
sensor
1k
220ohm
LED transmitters
2k
10uf
1k
104pf
capacitor
7805
regulator
100 ohms
2k
AT 89C51
microcontroller
AT 89C51
microcontroller
1k
Relays
2k
Regulator
100 ohms
1k
3300uf
Capacitor
Rectifier
2k
10k resistors
9v battery
1k
2k
Push Buttons
Power
Supply
APPENDIX C: COMPONENT LAYOUT