+ All Categories
Home > Documents > The Final Report

The Final Report

Date post: 22-Oct-2014
Category:
Upload: sagnik-paul
View: 137 times
Download: 2 times
Share this document with a friend
Popular Tags:
86
Page | 1 1.INTRODUCTION 1.1 OUR OBJECTIVE AND APPROACH Objective - To design an Automatic room light controller system that automatically switches on lights in a room when a person enters the room and switch them off when the room is empty. Approach - Using infrared sensors to sense the entry or departure of a person from the room and microcontroller circuit that counts the number of persons inside the room, which is displayed on a 7-segment LED. The microcontroller operates the relay to switch on-off the lights. 1.2 What is Automatic Room Light Controller This Project “Automatic Room Light Controller with Visitor Counter using Microcontroller” is a reliable circuit that takes over the task of controlling the room lights as well us counting number of persons/ visitors in the room very accurately. When somebody enters into the room then the counter is incremented by one and the light in the room will be switched ON and when any one leaves the room then the counter is decremented by one. The light will be only switched OFF until all the persons in the room go out. The total number of persons inside the room is also displayed on the seven segment displays. The microcontroller does the above job. It receives the signals from the sensors, and this signal is operated under the control of software which is stored in ROM. Microcontroller AT89S52 continuously monitor the Infrared Receivers, When any object pass through the IR Receiver's then the IR Rays falling on the receivers are obstructed this obstruction is sensed by the Microcontroller.
Transcript
Page 1: The Final Report

P a g e | 1

1.INTRODUCTION

1.1 OUR OBJECTIVE AND APPROACH

Objective - To design an Automatic room light controller system that automatically

switches on lights in a room when a person enters the room and switch them off when

the room is empty.

Approach - Using infrared sensors to sense the entry or departure of a person from the

room and microcontroller circuit that counts the number of persons inside the room,

which is displayed on a 7-segment LED. The microcontroller operates the relay to switch

on-off the lights.

1.2 What is Automatic Room Light Controller

This Project “Automatic Room Light Controller with Visitor Counter using

Microcontroller” is a reliable circuit that takes over the task of controlling the room

lights as well us counting number of persons/ visitors in the room very accurately. When

somebody enters into the room then the counter is incremented by one and the light in

the room will be switched ON and when any one leaves the room then the counter is

decremented by one. The light will be only switched OFF until all the persons in the

room go out. The total number of persons inside the room is also displayed on the seven

segment displays. The microcontroller does the above job. It receives the signals from

the sensors, and this signal is operated under the control of software which is stored in

ROM. Microcontroller AT89S52 continuously monitor the Infrared Receivers, When any

object pass through the IR Receiver's then the IR Rays falling on the receivers are

obstructed this obstruction is sensed by the Microcontroller.

Page 2: The Final Report

P a g e | 2

1.3 How Visitors are counted by Counter?

When the 1st person enter in to the room the LED sense that and the counter increased

by one, the phenomena repeats according to that how many persons enter to the room.

And when one person leave the room the counter decrease by one. But here is a

problem that how the LEDs sense that the person enter or leave the room? To

overcome this problem we have to detect the direction of motion of the person. For

that we two pairs of LEDs, the 1st pair is attached at the front portion of the door and

the 2nd pair is attached at the rear portion of the door. So if the 1st pair if LEDs sense a

person and then the 2nd pair of LEDs sense that person then it increase the counter by

one and the criteria denoted by entering of an person. And vice versa is denoted by

leaving of a person and that time the counter is decreased by one.

1.4 How seven segment display works?

A seven-segment display is a group of light emitting diodes (LEDs) arrange in a figure 8

pattern. The understand how the display works lets investigate how an LED works.

When charge carriers flow through a diode, the electrons flow one direction, The higher

energy electrons travel in the higher energy conduction band of the diode.

The holes travel in the lower energy valance band. The negative charge of the electrons

is attracted to the positive charge of the hole. When the electron “falls” into the hole,

recombination has occurs, energy released is in the form of a photon. The higher the

energy given up, the high the frequency of the wave. We observe this energy in our eyes

as the color of light. Our eyes are only sensitive to a limited range of frequency. Lower

energy waves are perceived as red.

By using this LEDs arranged in a figure ‘8’ pattern the seven segment display made.

Page 3: The Final Report

P a g e | 3

Its operating principle is to input a four-bit BCD (Binary-Coded Decimal) value, and

energize the proper output lines to form the corresponding decimal digit on the 7-

segment LED display. The BCD inputs are designated A, B, C, and D in order from least-

significant to most-significant. Outputs are labeled a, b, c, d, e, f, and g, each letter

corresponding to a standardized segment designation for 7-segment displays. Of course,

since each LED segment requires its own dropping resistor, we must use seven 470 Ω

resistors placed in series between the 4511's output terminals and the corresponding

terminals of the display unit. Most 7-segment displays also provide for a decimal point

(sometimes two!), a separate LED and terminal designated for its operation. All LEDs

inside the display unit are made common to each other on one side, either cathode or

anode.

1.5 How Microcontroller Works?

Our project is basically a microcontroller based project. The main fundamental concept

is implemented in this project by microcontroller. Microcontroller AT89S52 is used here

for continuous monitoring the current status of the system. According to the status it

produce the output in the seven segment display and also the mechanism of the lights,

fans are also controlled by this controller.

Page 4: The Final Report

P a g e | 4

2. OUR IMPLEMENATION

2.1 DESIGN DESCRIPTION

This Project “Automatic Room Light Controller with Visitor Counter using

Microcontroller” is a reliable circuit that takes over the task of controlling the room

lights as well us counting number of persons/ visitors in the room very accurately. When

somebody enters into the room then the counter is incremented by one and the light in

the room will be switched ON and when any one leaves the room then the counter is

decremented by one. The light will be only switched OFF until all the persons in the

room go out. The total number of persons inside the room is also displayed on the seven

segment displays.

Page 5: The Final Report

P a g e | 5

The microcontroller does the above job. It receives the signals from the sensors, and this

signal is operated under the control of software which is stored in ROM. Microcontroller

AT89c2051 continuously monitor the LDR’s 1 & 2 (Light Dependent Resistor), When any

object pass through the LDR’s then the light falling on the LDR’s are obstructed , this

obstruction is sensed by microcontroller.

2.1COMPONENT LIST:

SL.NO EQUIPMENTS QTY SPECIFICATIONS MAKER’S

NAME

MAKER’S NO.

1 IC 1 AT89S52 (40 PIN) ATMEL 1D9662Aa0414B

2 7 SEGMENT LED 1 8 PIN ELECTROLITE _

3 CRYSTAL

OSCILLATOR

1 12MHz KDS 8J

4

TRANSISTOR 5 BC547 BR B E12

2 CL100 - -

5

CAPACITOR

1 10uF

KELTRON

_ 4 33pF

6 RESISTER 24 33K,8.2K,220K,1K _ _

7 VOLTAGE

REGULATOR

5 L7805 _ _

8 BREAD BOARD 5 PDC-20 PACIFIC _

9 SUPER

PROGRAMMER

1 SUPER PRO

MODEL 280U

XELTEX _

10 TIMER IC 5 NE555 _ _

Page 6: The Final Report

P a g e | 6

2.3 BLOCK DIAGRAM :

Page 7: The Final Report

P a g e | 7

3. TRANSMITTER AND RECEIVER SECTION

This section deals with the transmission of the light emitted by the two LEDs that we

have used and its reception by the sensors. The sensors that we have used are Photo

Diodes. The LEDs and the Photo Diodes are placed at the two opposite sides of the door.

The light emitted by the LEDs is continuously received by the photo diodes and once a

person enters the door the reception is hindered. Once the person crosses both sets of

LED and photo diodes present in front and back of the door, the counter is incremented

by 1. The counter gets incremented as long as people enter the door. Same thing

happens when people leave. Counter is decremented when light emitted by the LED at

the back of door is hindered first and then the one in front of the door.

LEDs Door

Page 8: The Final Report

P a g e | 8

3.1 LED

Light emitting diodes, commonly called LEDs, 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 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, LEDs are just tiny light bulbs that fit easily into an electrical circuit. 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. The lifespan

of an LED surpasses the short life of an incandescent bulb by thousands of hours. Tiny

LEDs are already replacing the tubes that light up LCD HDTVs to make dramatically

thinner televisions

.

Now the thing is that, how a diode produces light?

Light is a form of energy that can be released by an atom. It is made up of many small

particle-like packets that have energy and momentum but no mass. These particles,

called photons, are the most basic units of light.

Photons are released as a result of moving electrons. In an atom, electrons move in

orbitals around the nucleus. Electrons in different orbitals have different amounts of

energy. Generally speaking, electrons with greater energy move in orbitals farther away

from the nucleus.For an electron to jump from a lower orbital to a higher orbital,

Page 9: The Final Report

P a g e | 9

something has to boost its energy level. Conversely, an electron releases energy when it

drops from a higher orbital to a lower one. This energy is released in the form of a

photon. A greater energy drop releases a higher-energy photon, which is characterized

by a higher frequency.Free electrons moving across a diode can fall into empty holes

from the P-type layer. This involves a drop from the conduction band to a lower orbital,

so the electrons release energy in the form of photons. This happens in any diode, but

you can only see the photons when the diode is composed of certain material. The

atoms in a standard silicon diode, for example, are arranged in such a way that the

electron drops a relatively short distance. As a result, the photon's frequency is so low

that it is invisible to the human eye -- it is in the infrared portion of the light spectrum.

This isn't necessarily a bad thing, of course: Infrared LEDs are ideal for remote controls,

among other things

Visible light-emitting diodes (VLEDs), such as the ones that light up numbers in a digital

clock, are made of materials characterized by a wider gap between the conduction band

and the lower orbitals. The size of the gap determines the frequency of the photon -- in

other words, it determines the color of the light. While LEDs are used in everything from

remote controls to the digital displays on electronics, visible LEDs are growing in

popularity and use thanks to their long lifetimes and miniature size. Depending on the

materials used in LEDs, they can be built

to shine in infrared, ultraviolet, and all the

colors of the visible spectrum in between.

Page 10: The Final Report

P a g e | 10

Infrared LEDs

An infrared light-emitting diode (LED) is a type of electronic device that emits infrared

light not visible to the naked eye. An infrared LED operates like a regular LED, but may

use different materials to produce infrared light. This infrared light may be used for a

remote control, to transfer data between devices, to provide illumination for night

vision equipment, or for a variety of other purposes.

An infrared LED is, like all LEDs, a type of diode, or simple semiconductor. Diodes are

designed so that electric current can only flow in one direction. As the current flows,

electrons fall from one part of the diode into holes on another part. In order to fall into

these holes, the electrons must shed energy in the form of photons, which produce

light.

The wavelength and color of the light produced depend on the material used in the

diode. Infrared LEDs use material that produces light in the infrared part of the

spectrum, that is, just below what the human eye can see. Different infrared LEDs may

produce infrared light of differing wavelengths, just like different LEDs produce light of

different colors.

A very common place to find an infrared LED is in a remote control for a television or

other device. One or more LEDs inside the remote transmit rapid pulses of infrared light

Page 11: The Final Report

P a g e | 11

to a receiver on the television. The receiver then decodes and interprets these pulses as

a command and carries out the desired operation.

Infrared light can also be used to transfer data between electronic devices. Mobile

phones, personal digital assistants (PDAs), and some laptops may have an infrared LED

and receiver designed for short-range data transfer. Some wireless keyboards and

computer mice also use an infrared LED and receiver to replace a cable.

Although invisible to human eyes, many types of cameras and other sensors can see

infrared light. This makes infrared LED technology well-suited to applications like

security systems and night vision goggles. Many security cameras and camcorders use

infrared LEDs to provide a night-vision mode. Hunters may use similar equipment to

spot game at night, and some companies sell flashlights with an infrared LED to provide

extra illumination for night-vision cameras or devices.

Infrared LEDs can be used for a variety of other purposes. The U.S. Food and Drug

Administration has approved several products with infrared LEDs for use in medical or

cosmetic procedures. Robots may use an infrared LED to detect objects, and some utility

meters even have an infrared LED to transmit data to a tool for easy meter reading.

How are infrared LEDs different?

There are a couple key differences in the electrical characteristics of infrared LEDs

versus visible light LEDs. Infrared LEDs have a lower forward voltage, and a higher rated

current compared to visible LEDs. This is due to differences in the material properties of

the junction. A typical drive current for an infrared LED can be as high as 50 milliamps,

so dropping in a visible LED as a replacement for an infrared LED could be a problem

with some circuit designs.

IR LEDs aren’t rated in millicandelas, since their output isn’t visible (and candelas

measure light in a way weighted to the peak of the visible spectrum). They are usually

rated in milliwatts, and conversions to candelas aren’t especially meaningful.

Page 12: The Final Report

P a g e | 12

LED Characteristics & Colours

There is a wide variety of different LEDs available on the market. The different LED

characteristics include colours light / radiation wavelength, light intensity, and a variety

of other LED characteristics.

The different LED characteristics have been brought about by a variety of factors, in the

manufacture of the LED. The semiconductor make-up is a factor, but fabrication

technology and encapsulation also play major part of the determination of the LED

characteristics.

LED colours

One of the major characteristics of an LED is its colour. Initially LED colours were very

restricted. For the first years only red LEDs were available.

However as semiconductor processes were improved and new research was undertaken

to investigate new materials for LEDs, different colours became available.

The diagram below shows some typical approximate curves for the voltages that may be

expected for different LED colours.

Typical (approximate) LED voltage curves

Page 13: The Final Report

P a g e | 13

LED voltage drops

The voltage drop across an LED is different to that of a normal silicon LED. Typically the

LED voltage drop is between around 2 and 4 volts.

The actual LED voltage that appears across the two terminals is dependent mainly upon

the type of LED in question - the materials used.

As would be expected the LED voltage curve broadly follows that which would be

expected for the forward characteristic for a diode. However once the diode has turned

on, the voltage is relatively flat for a variety of forward current levels. This means that in

some cases designers have used them as very rough voltage stabilisers - zener diodes do

not operate at voltages as low as LEDs. However their performance is obviously

nowhere near as good.

LED Applications

What can you use LEDs for? Anything!

Automotive Applications With LEDs

Instrument Panels & Switches, Courtesy Lighting, CHMSL, Rear Stop/Turn/Tai, Retrofits,

New Turn/Tail/Marker Lights

Consumer Electronics & General Indication With LEDs

Household appliances, VCR/ DVD/ Stereo/Audio/Video devices, Toys/Games

Instrumentation, Security Equipment, Switches

Illumination With LEDs

Architectural Lighting, Signage (Channel Letters), Machine Vision, Retail Displays,

Emergency Lighting (Exit Signs), Neon and bulb Replacement, Flashlights, Accent

Lighting - Pathways, Marker Lights

Page 14: The Final Report

P a g e | 14

Sign Applications With LEDs

Full Color Video, Monochrome Message Boards, Traffic/VMS, Transportation -

Passenger Information,

Signal Application With LEDs

Traffic, Rail, Aviation, Tower Lights, Runway Lights, Emergency/Police Vehicle Lighting,

Mobile Applications With LEDs

Mobile Phone, PDA's, Digital Cameras, Lap Tops, General Backlighting,

Photo Sensor Applications With LEDs

Medical Instrumentation, Bar Code Readers, Color & Money Sensors, Encoders, Optical

Switches, Fiber Optic Communication,

Page 15: The Final Report

P a g e | 15

3.2 PHOTO DIODE

A photodiode is a type of photo detector capable of converting light into either current

or voltage, depending upon the mode of operation. The common, traditional solar cell

used to generate electric solar power is a large area photodiode.

Photodiodes are similar to regular semiconductor diodes except that they may be either

exposed (to detect vacuum UV or X-rays) or packaged with a window or optical fiber

connection to allow light to reach the sensitive part of the device. Many diodes

designed for use specifically as a photodiode use a PIN junction rather than a p-n

junction, to increase the speed of response. A photodiode is designed to operate in

reverse bias.

The material used to make a photodiode is critical to defining its properties, because

only photons with sufficient energy to excite electrons across the material's band gap

will produce significant photocurrents.

Materials commonly used to produce photodiodes include:

Material Electromagnetic spectrum

wavelength range (nm)

Silicon 190–1100

Germanium 400–1700

Indium gallium arsenide 800–2600

Lead(II) sulfide <1000–3500

Because of their greater band gap, silicon-based photodiodes generate less noise than

germanium-based photodiodes.

Page 16: The Final Report

P a g e | 16

Features

Response of a silicon photo diode vs wavelength of the incident light

Critical performance parameters of a photodiode include:

Responsivity

The ratio of generated photocurrent to incident light power, typically expressed in

A/W when used in photoconductive mode. The responsivity may also be

expressed as a Quantum efficiency, or the ratio of the number of photogenerated

carriers to incident photons and thus a unitless quantity.

Dark current

The current through the photodiode in the absence of light, when it is operated in

photoconductive mode. The dark current includes photocurrent generated by

background radiation and the saturation current of the semiconductor junction.

Dark current must be accounted for by calibration if a photodiode is used to make

an accurate optical power measurement, and it is also a source of noise when a

photodiode is used in an optical communication system.

Page 17: The Final Report

P a g e | 17

Noise-equivalent power

(NEP) The minimum input optical power to generate photocurrent, equal to the

rms noise current in a 1 hertz bandwidth. The related characteristic detectivity (D)

is the inverse of NEP, 1/NEP; and the specific detectivity ( ) is the detectivity

normalized to the area (A) of the photodetector, . The NEP is roughly

the minimum detectable input power of a photodiode.

When a photodiode is used in an optical communication system, these parameters

contribute to the sensitivity of the optical receiver, which is the minimum input power

required for the receiver to achieve a specified bit error rate.

Comparison with photomultipliers

Advantages compared to photomultipliers:

1. Excellent linearity of output current as a function of incident light

2. Spectral response from 190 nm to 1100 nm (silicon), longer wavelengths with

other semiconductor materials

3. Low noise

4. Ruggedized to mechanical stress

5. Low cost

6. Compact and light weight

7. Long lifetime

8. High quantum efficiency, typically 80%

9. No high voltage required

Disadvantages compared to photomultipliers:

1. Small area

2. No internal gain (except avalanche photodiodes, but their gain is typically 102–10

3

compared to up to 108 for the photomultiplier)

3. Much lower overall sensitivity

4. Photon counting only possible with specially designed, usually cooled

photodiodes, with special electronic circuits

5. Response time for many designs is slower

Page 18: The Final Report

P a g e | 18

Photodiode array

A one-dimensional array of hundreds or thousands of photodiodes can be used as a

position sensor, for example as part of an angle sensor.[8]

One advantage of photodiode

arrays (PDAs) is that they allow for high speed parallel read out since the driving

electronics may not be built in like a traditional CMOS or CCD sensor.

Principle of operation

A photodiode is a p-n junction or PIN structure. When a photon of sufficient energy

strikes the diode, it excites an electron, thereby creating a free electron (and a positively

charged electron hole). This mechanism is also known as the inner photoelectric effect.

If the absorption occurs in the junction's depletion region, or one diffusion length away

from it, these carriers are swept from the junction by the built-in field of the depletion

region. Thus holes move toward the anode, and electrons toward the cathode, and a

photocurrent is produced. This photocurrent is the sum of both the dark current

(without light) and the light current, so the dark current must be minimized to enhance

the sensitivity of the device.

Photovoltaic mode

When used in zero bias or photovoltaic mode, the flow of photocurrent out of the

device is restricted and a voltage builds up. This mode exploits the photovoltaic effect,

which is the basis for solar cells – a traditional solar cell is just a large area photodiode.

Photoconductive mode

In this mode the diode is often reverse biased (with the cathode positive), dramatically

reducing the response time at the expense of increased noise. This increases the width

of the depletion layer, which decreases the junction's capacitance resulting in faster

response times. The reverse bias induces only a small amount of current (known as

saturation or back current) along its direction while the photocurrent remains virtually

the same. For a given spectral distribution, the photocurrent is linearly proportional to

the luminance (and to the irradiance).

Page 19: The Final Report

P a g e | 19

Although this mode is faster, the photoconductive mode tends to exhibit more

electronic noise. The leakage current of a good PIN diode is so low (<1 nA) that the

Johnson–Nyquist noise of the load resistance in a typical circuit often dominates.

Other modes of operation

Avalanche photodiodes have a similar structure to regular photodiodes, but they are

operated with much higher reverse bias. This allows each photo-generated carrier to be

multiplied by avalanche breakdown, resulting in internal gain within the photodiode,

which increases the effective responsivity of the device.

A phototransistor is in essence a bipolar transistor encased in a transparent case so that

light can reach the base-collector junction. It was invented by Dr. John N. Shive (more

famous for his wave machine) at Bell Labs in 1950. The electrons that are generated by

photons in the base-collector junction are injected into the base, and this photodiode

current is amplified by the transistor's current gain β (or hfe). If the emitter is left

unconnected, the phototransistor becomes a photodiode. While phototransistors have

a higher responsivity for light they are not able to detect low levels of light any better

than photodiodes. Phototransistors also have significantly longer response times.

I-V curve of a photodiode and the equivalent circuit

Page 20: The Final Report

P a g e | 20

Applications

P-N photodiodes are used in similar applications to other photo detectors, such as

photoconductors, charge-coupled devices, and photomultiplier tubes. They may be used

to generate an output which is dependent upon the illumination (analog; for

measurement and the like), or to change the state of circuitry (digital; either for control

and switching, or digital signal processing).

Photodiodes are used in consumer electronics devices such as compact disc players,

smoke detectors, and the receivers for infrared remote control devices used to control

equipment from televisions to air conditioners. For many applications either

photodiodes or photoconductors may be used. Either type of photo sensor may be used

for light measurement, as in camera light meters, or to respond to light levels, as in

switching on street lighting after dark.

Photosensors of all types may be used to respond to incident light, or to a source of light

which is part of the same circuit or system. A photodiode is often combined into a single

component with an emitter of light, usually a light-emitting diode (LED), either to detect

the presence of a mechanical obstruction to the beam (slotted optical switch), or to

couple two digital or analog circuits while maintaining extremely high electrical isolation

between them, often for safety (optocoupler).

Photodiodes are often used for accurate measurement of light intensity in science and

industry. They generally have a more linear response than photoconductors.

They are also widely used in various medical applications, such as detectors for

computed tomography (coupled with scintillators), instruments to analyze samples

(immunoassay), and pulse oximeters.

PIN diodes are much faster and more sensitive than p-n junction diodes, and hence are

often used for optical communications and in lighting regulation.

P-N photodiodes are not used to measure extremely low light intensities. Instead, if high

sensitivity is needed, avalanche photodiodes, intensified charge-coupled devices or

photomultiplier tubes are used for applications such as astronomy, spectroscopy, night

vision equipment and laser range finding.

Page 21: The Final Report

P a g e | 21

3.3 TRANSMISSION AND RECEIVING SYSTEM

The LEDs and the Photo Diodes together constitute the transmission & receiving system.

The LEDs are placed at one end of the door and the Photo Diodes are placed at the

other end of the door both in front and back end of the door. Light is transmitted by the

LEDs which is then received by the Photo Diodes at the other end of the door.

LEDs Door

3.4 HOW THE VISITOR IS SENSED

The LEDs and the Photo Diodes are placed at the two opposite sides of the door. The

light emitted by the LEDs is continuously received by the photo diodes and once a

person enters the door the reception is hindered. Once the person crosses both sets of

LED and photo diodes present in front and back of the door, the counter is incremented

by 1. Lights are then automatically switched on. The counter gets incremented as long

as people enter the door. Same thing happens when people leave. Counter is

decremented when light emitted by the LED at the back of door is hindered first and

then the one in front of the door. As soon as the counter value reaches 0, the circuit

opens and the lights are automatically switched off. The count of the number of visitors

is shown on 7-segment LCD attached to the circuit.

Page 22: The Final Report

P a g e | 22

4. MULTIVIBRATOR

A multivibrator is an electronics ckt which will be used as timer. This ckt is formed by

555 timer or simple transistor logic. There are three types of multivibrator – Astable,

monostable and bistable.

This multivibrator circuit oscillates between a "HIGH" state and a "LOW" state producing

a continuous output. Astable multivibrators generally have an even 50% duty cycle, that

is that 50% of the cycle time the output is "HIGH" and the remaining 50% of the cycle

time the output is "OFF". In other words, the duty cycle for an astable timing pulse is

1:1.

Sequential logic circuits that use the clock signal for synchronization are dependant

upon the frequency and and clock pulse width to activate there switching action.

Sequential circuits may also change their state on either the rising or falling edge, or

both of the actual clock signal as we have seen previously with the basic flip-flop

circuits. The following list are terms associated with a timing pulse or waveform.

Active HIGH - if the state changes occur at the

clock's rising edge or during the clock width.

Clock Signal Waveform

Active LOW - if the state changes occur at the

clock's falling edge.

Duty Cycle - is the ratio of clock width and clock

period.

Clock Width - this is the time during which the value of the clock signal is equal to one.

Clock Period - this is the time between successive transitions in the same direction,

i.e., between two rising or two falling edges.

Clock Frequency - the clock frequency is the reciprocal of the clock period, frequency =

Page 23: The Final Report

P a g e | 23

1/clock period

Clock pulse generation circuits can be a combination of analogue and digital circuits that

produce a continuous series of pulses (these are called astable multivibrators) or a pulse

of a specific duration (these are called monostable multivibrators). Combining two or

more of multivibrators provides generation of a desired pattern of pulses (including

pulse width, time between pulses and frequency of pulses).

There are basically three types of clock pulse generation circuits:

• Astable - A free-running multivibrator that has NO stable states but switches

continuously between two states this action produces a train of square wave

pulses at a fixed frequency.

• Monostable - A one-shot multivibrator that has only ONE stable state and is

triggered externally with it returning back to its first stable state.

• Bistable - A flip-flop that has TWO stable states that produces a single pulse either

positive or negative in value.

One way of producing a very simple clock signal is by the interconnection of logic gates.

As NAND gates contains amplification, they can also be used to provide a clock signal or

timing pulse with the aid of a single Capacitor, C and Resistor, R which provide the

feedback and timing function. These timing circuits are often used because of there

simplicity and are also useful if a logic circuit is designed that has un-used gates which

can be utilised to create the monostable or astable oscillator. This simple type of RC

Oscillator network is sometimes called a "Relaxation Oscillator".

Monostable Circuits.

Monostable Multivibrators or "one-shot" pulse generators are used to convert short

sharp pulses into wider ones for timing applications. Monostable multivibrators

generate a single output pulse, either "high" or "low", when a suitable external trigger

signal or pulse T is applied. This trigger pulse signal initiates a timing cycle which causes

the output of the monostable to change state at the start of the timing cycle, (t1) and

remain in this second state until the end of the timing period, (t1) which is determined

by the time constant of the timing capacitor, CT and the resistor, RT.

Page 24: The Final Report

P a g e | 24

The monostable multivibrator now stays in this second timing state until the end of the

RC time constant and automatically resets or returns itself back to its original (stable)

state. Then, a monostable circuit has only one stable state. A more common name for

this type of circuit is simply a "Flip-Flop" as it can be made from two cross-coupled

NAND gates (or NOR gates) as we have seen previously. Consider the circuit below.

Simple NAND Gate Monostable Circuit

Suppose that initially the trigger input T is held HIGH at logic level "1" by the resistor R1

so that the output from the first NAND gate U1 is LOW at logic level "0", (NAND gate

principals). The timing resistor, RT is connected to a voltage level equal to logic level "0",

which will cause the capacitor, CT to be discharged. The output of U1 is LOW, timing

capacitor CT is completely discharged therefore junction V1 is also equal to "0" resulting

in the output from the second NAND gate U2, which is connected as an inverting NOT

gate will therefore be HIGH.

The output from the second NAND gate, (U2) is fed back to one input of U1 to provide

the necessary positive feedback. Since the junction V1 and the output of U1 are both at

logic "0" no current flows in the capacitor CT. This results in the circuit being Stable and

it will remain in this state until the trigger input T changes.

If a negative pulse is now applied either externally or by the action of the push-button

to the trigger input of the NAND gate U1, the output of U1 will go HIGH to logic "1"

(NAND gate principles). Since the voltage across the capacitor cannot change

instantaneously (capacitor charging principals) this will cause the junction at V1 and also

the input to U2 to also go HIGH, which inturn will make the output of the NAND gate U2

change LOW to logic "0" The circuit will now remain in this second state even if the

trigger input pulse T is removed. This is known as the Meta-stable state.

Page 25: The Final Report

P a g e | 25

The voltage across the capacitor will now increase as the capacitor CT starts to charge up

from the output of U1 at a time constant determined by the resistor/capacitor

combination. This charging process continues until the charging current is unable to

hold the input of U2 and therefore junction V1 HIGH. When this happens, the output of

U2 switches HIGH again, logic "1", which inturn causes the output of U1 to go LOW and

the capacitor discharges into the output of U1 under the influence of resistor RT. The

circuit has now switched back to its original stable state.

Thus for each negative going trigger pulse, the monostable multivibrator circuit

produces a LOW going output pulse. The length of the output time period is determined

by the capacitor/resistor combination (RC Network) and is given as the Time Constant

T = 0.69RC of the circuit in seconds. Since the input impedance of the NAND gates is

very high, large timing periods can be achieved.

As well as the NAND gate monostable type circuit above, it is also possible to build

simple monostable timing circuits that start their timing sequence from the rising-edge

of the trigger pulse using NOT gates, NAND gates and NOR gates connected as inverters

as shown below.

NOT Gate Monostable Circuit

As with the NAND gate circuit above, initially the trigger input T is HIGH at a logic level

"1" so that the output from the first NOT gate U1 is LOW at logic level "0". The timing

resistor, RT and the capacitor, CT are connected together in parallel and also to the input

of the second NOT gate U2. As the input to U2 is LOW at logic "0" its output at Q is HIGH

at logic "1".

Page 26: The Final Report

P a g e | 26

When a logic level "0" pulse is applied to the trigger input T of the first NOT gate it

changes state and produces a logic level "1" output. The diode D1 passes this logic "1"

voltage level to the RC timing network. The voltage across the capacitor, CT increases

rapidly to this new voltage level, which is also connected to the input of the second NOT

gate. This inturn outputs a logic "0" at Q and the circuit stays in this Meta-stable state as

long as the trigger input T applied to the circuit remains LOW.

When the trigger signal returns HIGH, the output from the first NOT gate goes LOW to

logic "0" (NOT gate principals) and the fully charged capacitor, CT starts to discharge

itself through the parallel resistor, RT connected across it. When the voltage across the

capacitor drops below the lower threshold value of the input to the second NOT gate, its

output switches back again producing a logic level "1" at Q. The diode D1 prevents the

timing capacitor from discharging itself back through the first NOT gates output.

Then, the Time Constant for a NOT gate Monostable Multivibrator is given as

T = 0.8RC + Trigger in seconds.

One main disadvantage of Monostable Multivibrators is that the time between the

application of the next trigger pulse T has to be greater than the RC time constant of the

circuit.

Astable Circuits.

Astable Multivibrators are a type of free running oscillator that have no permanent

"meta" or "steady" state but are continually changing there output from one state

("LOW") to the other state ("HIGH") and then back again. This continual switching action

from "HIGH" to "LOW" and "LOW" to "HIGH" produces a continuous and stable square

wave output that switches abruptly between the two logic levels making it ideal for

timing and clock pulse applications. As with the monostable multivibrator circuit above,

the timing cycle is determined by the time constant of the resistor-capacitor, RC

Network. Then the output frequency can be varied by changing the value(s) of the

resistors and capacitor in the circuit.

Page 27: The Final Report

P a g e | 27

NAND Gate Astable Multivibrators

The astable multivibrator circuit uses two CMOS NOT gates such as the CD4069 or the

74HC04 hex inverter ICs, or as in our simple circuit below a pair of CMOS NAND such as

the CD4011 or the 74LS132 and an RC timing network. The two NAND gates are

connected as inverting NOT gates.

Suppose that initially the output from the NAND gate U2 is HIGH at logic level "1", then

the input must therefore be LOW at logic level "0" (NAND gate principles) as will be the

output from the first NAND gate U1. Capacitor, C is connected between the output of

the second NAND gate U2 and its input via the timing resistor, R2. The capacitor now

charges up at a rate determined by the time constant of R2 and C.

As the capacitor, C charges up, the junction between the resistor R2 and the capacitor, C,

which is also connected to the input of the NAND gate U1 via the stabilizing resistor, R2

decreases until the lower threshold value of U1 is reached at which point U1 changes

state and the output of U1 now becomes HIGH. This causes NAND gate U2 to also

change state as its input has now changed from logic "0" to logic "1" resulting in the

output of NAND gate U2 becoming LOW, logic level "0".

Capacitor C is now reverse biased and discharges itself through the input of NAND gate

U1. Capacitor, C charges up again in the opposite direction determined by the time

constant of both R2 and C as before until it reaches the upper threshold value of NAND

gate U1. This causes U1 to change state and the cycle repeats itself over again.

Then, the time constant for a NAND gate Astable Multivibrator is given as T = 2.2RC in

seconds with the output frequency given as f = 1/T.

For example: if resistor R2 = 10kΩ and the capacitor C = 45nF, then the oscillation

frequency will be given as:

Page 28: The Final Report

P a g e | 28

then the output frequency is calculated as being 1kHz, which equates to a time constant

of 1mS so the output waveform would look like:

Bistable Circuits.

The Bistable Multivibrators circuit is basically a SR flip-flop that we look at in the

previous tutorials with the addition of an inverter or NOT gate to provide the necessary

switching function. As with flip-flops, both states of a bistable multivibrator are stable,

and the circuit will remain in either state indefinitely. This type of multivibrator circuit

passes from one state to the other "only" when a suitable external trigger pulse T is

applied and to go through a full "SET-RESET" cycle two triggering pulses are required.

This type of circuit is also known as a "Bistable Latch", "Toggle Latch" or simply "T-

latch".

NAND Gate Bistable Multivibrator

The simplest way to make a Bistable Latch is to connect together a pair of Schmitt

NAND gates to form a SR latch as shown above. The two NAND gates, U2 and U3 form

Page 29: The Final Report

P a g e | 29

the bistable which is triggered by the input NAND gate, U1. This U1 NAND gate can be

omitted and replaced by a single toggle switch to make a switch debounce circuit as

seen previously in the SR Flip-flop tutorial. When the input pulse goes "LOW" the

bistable latches into its "SET" state, with its output at logic level "1", until the input goes

"HIGH" causing the bistable to latch into its "RESET" state, with its output at logic level

"0". The output of a bistable multivibrator will stay in this "RESET" state until another

input pulse is applied and the whole sequence will start again.

Then a Bistable Latch or "Toggle Latch" is a two-state device in which both states either

positive or negative, (logic "1" or logic "0") are stable.

Bistable Multivibrators have many applications such as frequency dividers, counters or

as a storage device in computer memories but they are best used in circuits such as

Latches and Counters.

555 Timer Circuit.

Simple Monostable or Astable timing circuits can now be easily made using standard

waveform generator IC's in the form of relaxation oscillators by connecting a few

passive components to their inputs with the most commonly used waveform generator

type IC being the classic 555 timer.

The 555 Timer is a very versatile low cost timing IC that can produce a very accurate

timing periods with good stability of around 1% and which has a variable timing period

from between a few micro-seconds to many hours with the timing period being

controlled by a single RC network connected to a single positive supply of between 4.5

and 16 volts. The NE555 timer and its successors, ICM7555, CMOS LM1455, DUAL NE556

etc, are covered in the 555 Oscillator tutorial and other good electronics based

websites, so are only included here for reference purposes as a clock pulse generator.

The 555 connected as an Astable oscillator is given below.

Using 555 timer(three 5 kohm resistors) and opamp(comparator) logic we can generate

timer output. 555 IC has 8 pins-Gnd, Trigger, output, reset, control, threshold, discharge

and vcc. The 555 timer IC is an integrated circuit (chip) used in a variety of timer, pulse

Page 30: The Final Report

P a g e | 30

generation, and oscillator applications. The 555 can be used to provide time delays, as

an oscillator, and as a flip-flop element. Derivatives provide up to four timing circuits in

one package.

Introduced in 1971 by Signetics, the 555 is still in widespread use, thanks to its ease of

use, low price, and good stability. It is now made by many companies in the original

bipolar and also in low-power CMOS types. As of 2003, it was estimated that 1 billion

units are manufactured every year.

555 IC pin diagram

Page 31: The Final Report

P a g e | 31

555IC schematic diagram

DESCRIPTION

The 555 monolithic timing circuit is a highly stable controller capable of producing

accurate time delays, or oscillation. In the time delay mode of operation, the time is

precisely controlled by one external resistor and capacitor. For a stable operation as an

oscillator, the free running frequency and the duty cycle are both accurately controlled

with two external resistors and one capacitor. The circuit may be triggered and reset on

falling waveforms, and the output structure can source or sink up to 200mA.

FEATURES

• Turn-off time less than 2ms

• Max. operating frequency greater than 500kHz

• Timing from microseconds to hours

• Operates in both astable and monostable modes

• High output current

Page 32: The Final Report

P a g e | 32

• Adjustable duty cycle

• TTL compatible

• Temperature stability of 0.005% per °C

APPLICATIONS

• Precision timing

• Pulse generation

• Sequential timing

• Time delay generation

• Pulse width modulation

Page 33: The Final Report

P a g e | 33

Page 34: The Final Report

P a g e | 34

4.1 TYPE OF MULTIVIBRATOR

Here we use monostable multivibrator. Monostable Multivibrator is also called one shot

Multivibrator. Trigger is needed here. We can give negative edge triggering. It has one

stable state; may be 0 or 1 and has one quasi stable state.

Page 35: The Final Report

P a g e | 35

4.2 OPERATION OF MONOSTABLE MULTIVIBRATOR

Monostable mode: in this mode, the 555 functions as a "one-shot" pulse generator.

Applications include timers, missing pulse detection, bounce free switches, touch

switches, frequency divider, capacitance measurement, pulse-width modulation (PWM)

and so on.

Monostable Multivibrator

The monostable multivibrator (sometimes called a ONE-SHOT MULTIVIBRATOR) is a

square- or rectangular-wave generator with just one stable condition. With no input

signal (quiescent condition) one amplifier conducts and the other is in cutoff. The

monostable multivibrator is basically used for pulse stretching. It is used in computer

logic systems and communication navigation equipment. The operation of the

monostable multivibrator is relatively simple. The input is triggered with a pulse of

voltage. The output changes from one voltage level to a different voltage level. The

output remains at this new voltage level for a definite period of time. Then the circuit

automatically reverts to its original condition and remains that way until another trigger

pulse is applied to the input. The monostable multivibrator actually takes this series of

input triggers and converts them to uniform square pulses. All of the square output

pulses are of the same amplitude and time duration

Schematic Diagram Of Multivibrator

Page 36: The Final Report

P a g e | 36

Block Diagram of Monostable Multivibrator

Initially, when the output at pin 3 is low i.e. the circuit is in a stable state, the transistor

is on and capacitor- C is shorted to ground. When a negative pulse is applied to pin 2,

the trigger input falls below +1/3 VCC, the output of comparator goes high which resets

the flip-flop and consequently the transistor turns off and the output at pin 3 goes high.

This is the transition of the output from stable to quasi-stable state, as shown in figure.

As the discharge transistor is cut¬off, the capacitor C begins charging toward +VCC

through resistance RA with a time constant equal to RAC. When the increasing capacitor

voltage becomes slightly greater than +2/3 VCC, the output of comparator 1 goes high,

Page 37: The Final Report

P a g e | 37

which sets the flip-flop. The transistor goes to saturation, thereby discharging the

capacitor C and the output of the timer goes low, as illustrated in figure.

Thus the output returns back to stable state from quasi-stable state.

The output of the Monostable Multivibrator remains low until a trigger pulse is again

applied. Then the cycle repeats. Trigger input, output voltage and capacitor voltage

waveforms are shown in figure.

Monostable Multivibrator Designing

The capacitor C has to charge through resistance RA. The larger the time constant RAC,

the longer it takes for the capacitor voltage to reach +2/3VCC.

In other words, the RC time constant controls the width of the output pulse. The time

during which the timer output remains high.

tp = 1.0986 RAC

where RA is in ohms and C is in farads. The above relation is derived as below.

Voltage across the capacitor at any instant during charging period is given as

vc = VCC (1- e-t/RAC)

Substituting vc = 2/3 VCC in above equation we get the time taken by the capacitor to

charge from 0 to +2/3VCC.

So +2/3VCC. = VCC. (1 – e-t/RAC) or t – RAC loge 3 = 1.0986 RAC

So pulse width, tP = 1.0986 RAC s 1.1 RAC

Page 38: The Final Report

P a g e | 38

Output wave form of monostable multivibrator

Transmitter Circuit:

Transmission Ckt Using Monostable Multivibrtor

Page 39: The Final Report

P a g e | 39

IR transmission circuit is used to generate the modulated 36 KHZ IR signal. The IC 555

timer in the transmitter side is to generate 36 KHZ square signal. Adjust the preset in the

transmitter to get 38 KHZ signal in the output. Around 1.4k we get 38 KHZ signal. Then

you point it over the sensor and output will go low when it senses IR signal of 38 KHZ.

Receiver Circuit:

The IR will emit modulated 38 KHZ IR signal and in receiver we use TSOP1738 Infrared

sensor.Output goes high when there is an interruption and it return back to low after

the time time period determined by the capacitor and resistor in the circuit i,e around 1

second.Input is given to the port 1 of microcontroller.Port 0 is used for seven segment display

unit.Port 2 is used for relay turn on turn of.

Page 40: The Final Report

P a g e | 40

5.MICROCONTROLLER

GENERAL OVERVIEW OF 8085 MICROPROCESSOR ARCHITECTURE:

1. The microprocessor can be programmed to perform functions on given data by

writing specific instructions into its memory.

2. The microprocessor reads one instruction at a time, matches it with its instruction

set, and performs the data manipulation specified.

3. The result is either stored back into memory or displayed on an output device.

4. The 8085 is an 8-bit general purpose microprocessor that can address 64K Byte of

memory.

5. It has 40 pins and uses +5V for power. It can run at a maximum frequency of 3

MHz.

6. The pins on the chip can be grouped into 6 groups:

i. Address Bus.

ii. Data

iii. Control and Status Signals.

iv. Power supply and frequency.

v. Externally Initiated Signals.

vi. Serial I/O ports.

Page 41: The Final Report

P a g e | 41

COMPARISON BETWEEN 8085 AND 8051:

The main differences between microprocessor and microcontroller are the following-

i. By microprocessor is meant the general purpose microprocessor such as Intel’s

x86 family(8085,8086,80286 and the Pentium)or Motorola’s 680x0

family(68000,68020 etc).

ii. These Microprocessor contain no RAM ,no ROM ,and no I/O ports on the chip

itself. For this reason ,they are commonly refer to as general-purpose

microprocessors.

A microcontroller has a CPU(a microprocessor)in addition to a fixed

amount of RAM,ROM,I/O ports and controllers.

Difference between 8051 and 8951

Instruction set, Internal memory structure and Pinout are the same. 8951 Controllers

which are faster and more complex were first developed in the 90's as an improvement

to the 8051.

Many 8951 controllers have 2, 4 or 6 clock cores as opposed to 12. Whats more many

provide onboard DAC, ADC, I2C, USB, CAN etc

5.1WORKING PRINCIPLE

8051 Microcontroller is a programable device which is used for controlling purpose.

Basically 8051 controller is Mask porogramble means it will programed at the time of

manufacturing and will not programed again, there is a derivative of 8051

microcontroller, 89c51 microcontroller which is reprogramable upto 10000 times, here

Page 42: The Final Report

P a g e | 42

is small discription abot the 89c51 microcontroller.

It have 4 ports which are used as input or output according to your need.

These prots are also programmed as bit wise pattern, means you can use each bit of

microcontroller saperatelly as input or output.

This 89c51 is 8-bit device mean each port have 8-bits for I/O, total of 32-bits in the

controller.

This device also have Timer, Serial Port interface and Interrupt controlling you can use

these according to your need.

This device have 4K of ROM space to store the program,and 256Bytes of RAM space,

this device have ability to interface with TTL based devices and also with the external

MEMORY to increase its data space, but when your are using external MEMORY the 2

ports of 89c51 microcontroller are used for this purpose.

The Microcontroller that we have used in this project is AT89C51. AT89C51 is an 8-bit

microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash

programmable and erasable read only memory (PEROM) and 128 bytes of RAM. It can

be erased and program to a maximum of 1000 times.

In 40 pin AT89C51, there are four ports designated as P1, P2, P3 and P0. All these ports

are 8-bit bi-directional ports, i.e., they can be used as both input and output ports.

Except P0 which needs external pull-ups, rest of the ports have internal pull-ups. When

1s are written to these port pins, they are pulled high by the internal pull-ups and can be

used as inputs. These ports are also bit addressable and so their bits can also be

accessed individually.

Port P0 and P2 are also used to provide low byte and high byte addresses, respectively,

when connected to an external memory. Port 3 has multiplexed pins for special

functions like serial communication, hardware interrupts, timer inputs and read/write

operation from external memory. AT89C51 has an inbuilt UART for serial

communication. It can be programmed to operate at different baud rates. Including two

timers & hardware interrupts, it has a total of six interrupts.

Page 43: The Final Report

P a g e | 43

Pin Diagram

Page 44: The Final Report

P a g e | 44

Pin No Function Name

1

8 bit input/output port (P1) pins

P1.0

2 P1.1

3 P1.2

4 P1.3

5 P1.4

6 P1.5

7 P1.6

8 P1.7

9 Reset pin; Active high Reset

10 Input (receiver) for serial communication RxD

8 bit

input/output

port (P3)

pins

P3.0

11 Output (transmitter) for serial communication TxD P3.1

12 External interrupt 1 Int0 P3.2

13 External interrupt 2 Int1 P3.3

14 Timer1 external input T0 P3.4

15 Timer2 external input T1 P3.5

16 Write to external data memory Write P3.6

17 Read from external data memory Read P3.7

18 Quartz crystal oscillator (up to 24 MHz)

Crystal 2

19 Crystal 1

20 Ground (0V) Ground

21

8 bit input/output port (P2) pins

/

High-order address bits when interfacing with external memory

P2.0/ A8

22 P2.1/ A9

23 P2.2/ A10

24 P2.3/ A11

25 P2.4/ A12

26 P2.5/ A13

27 P2.6/ A14

28 P2.7/ A15

29 Program store enable; Read from external program memory PSEN

30 Address Latch Enable ALE

Program pulse input during Flash programming Prog

31 External Access Enable; Vcc for internal program executions EA

Programming enable voltage; 12V (during Flash programming) Vpp

32

8 bit input/output port (P0) pins

Low-order address bits when interfacing with external memory

P0.7/ AD7

33 P0.6/ AD6

34 P0.5/ AD5

35 P0.4/ AD4

36 P0.3/ AD3

37 P0.2/ AD2

38 P0.1/ AD1

39 P0.0/ AD0

40 Supply voltage; 5V (up to 6.6V) Vcc

Page 45: The Final Report

P a g e | 45

Description

The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K

bytes of in-system programmable Flash memory. The device is manufactured using

Atmel’s high-density non volatile memory technology and is compatible with the

industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the

program memory to be reprogrammed in-system or by a conventional non volatile

memory programmer.

By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic

chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible

and cost-effective solution to many embedded control applications. The AT89S52

provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O

lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-

level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock

circuitry. In addition, the AT89S52 is designed with static logic for operation down to

zero frequency and supports two software selectable power saving modes. The Idle

Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt

system to continue functioning. The Power-down mode saves the RAM contents but

freezes the oscillator, disabling all other chip functions until the next interrupt or

hardware reset.

Page 46: The Final Report

P a g e | 46

BLOCK DIAGRAM

Page 47: The Final Report

P a g e | 47

PIN DESCRIPTION

VCC

Supply voltage.

GND

Ground.

Port 0

Port 0 is an 8-bit open drain bidirectional 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 can 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 pullups.

Port 0 also receives the code bytes during Flash programming and outputs the code

bytes during program verification. External pullups are required during program

verification.

Port 1

Port 1 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups 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 pullups.

In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count

input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as

shown in the following table.

Port 1 also receives the low-order address bytes during Flash programming and

verification.

Page 48: The Final Report

P a g e | 48

Port Pin Alternate Functions

P1.0 T2 (external count input to

Timer/Counter 2), clock-out

P1.1 T2EX (Timer/Counter 2

capture/reload trigger and

direction control)

P1.5 MOSI (used for In-System

Programming)

P1.6 MISO (used for In-System

Programming)

P1.7 SCK (used for In-System

Programming)

Port 2

Port 2 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups 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 pullups.

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, Port 2 uses strong internal pul-lups when emitting 1s. During

accesses to external data memory that use 8-bit 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.

Page 49: The Final Report

P a g e | 49

Port 3

Port 3 is an 8-bit bidirectional 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 pullups and can be used as inputs. As inputs, Port 3 pins that are

externally being pulled low will source current (IIL) because of the pullups.

Port 3 also serves the functions of various special features of the AT89S52, as shown in

the following table.

Port 3 also receives some control signals for Flash programming and verification.

Port Pin Alternate Functions

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

P3.6 WR (external data memory write

strobe)

P3.7 RD (external data memory read

strobe)

Page 50: The Final Report

P a g e | 50

RST

Reset input. A high on this pin for two machine cycles while the oscillator is running

resets the device. This pin drives High for 96 oscillator periods after the Watchdog times

out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the

default state of bit DISRTO, the RESET HIGH out feature is enabled.

ALE/PROG

Address Latch Enable (ALE) is an 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 (PSEN) is the read strobe to external program memory.

When the AT89S52 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.

Page 51: The Final Report

P a g e | 51

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.

Special Function Registers

A map of the on-chip memory area called the Special Function Register (SFR) space is

shown in Table 1.

Note that not all of the addresses are occupied, and unoccupied addresses may not be

implemented on the chip. Read accesses to these addresses will in general return

random data, and write accesses will have an indeterminate effect.

User software should not write 1s to these unlisted locations, since they may be used in

future products to invoke new features. In that case, the reset or inactive values of the

new bits will always be 0.

Timer 2 Registers:

Control and status bits are contained in registers T2CON (shown in Table 2) and T2MOD

(shown in Table 3) for Timer 2.

The register pair (RCAP2H, RCAP2L) are the Capture/Reload registers for Timer 2 in 16-

bit capture mode or 16-bit auto-reload mode.

Interrupt Registers:

The individual interrupt enable bits are in the IE register. Two priorities can be set for

each of the six interrupt sources in the IP register.

Page 52: The Final Report

P a g e | 52

Dual Data Pointer Registers:

To facilitate accessing both internal and external data memory, two banks of 16-bit Data

Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H-

85H. Bit DPS = 0

in SFR AUXR1 selects DP0 and DPS = 1 selects DP1.

Memory Organization

MCS-51 devices have a separate address space for Program and Data Memory. Up to

64K bytes each of external Program and Data Memory can be addressed.

Program Memory

If the EA pin is connected to GND, all program fetches are directed to external memory.

On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through

1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH

are to external memory.

Data Memory

The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a

parallel address space to the Special Function Registers. This means that the upper 128

bytes have the same addresses as the SFR space but are physically separate from SFR

space.

When an instruction accesses an internal location above address 7FH, the address mode

used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM

or the SFR space. Instructions which use direct addressing access of the SFR space.

Page 53: The Final Report

P a g e | 53

For example, the following direct addressing instruction accesses the SFR at location

0A0H (which is P2).

MOV 0A0H, #data

Instructions that use indirect addressing access the upper 128 bytes of RAM. For

example, the following indirect addressing instruction, where R0 contains 0A0H,

accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).

MOV @R0, #data

Note that stack operations are examples of indirect addressing, so the upper 128 bytes

of data RAM are available as stack space.

Page 54: The Final Report

P a g e | 54

5.2 MICROCONTROLLER PROGRAM

ORG 0000H

SET B P1.0

SETB P1.0

CLR P2.0

MOV R3,#00H

MOV P3,R3

CHECK: JNB P1.1,LOW 1

MOV R1,#01H

LJMP NEXT1

LOW1: MOV R1,#00

NEXT1: JNB P1.0,LOW2

MOV R2,#01H

JMP NEXT 2

LOW2: MOV R2#00H

NEXT2: MOV A,R1

XRL A,R2

CJNE A,#01 ,RESET

ENTER: CJNE R1,# 01H,EXIT

CHECKEN: JNB P1.0,LOW3

MOV R2,#01H

Page 55: The Final Report

P a g e | 55

LJMP NEXT3

LOW3: MOV R2,#00H

NEXT3: CJNE R2,#01H,CHECKEN

LJMP ENTERPG

CHECKENAG: JNB P1.0,LOW4

MOV R2,#01H

LJMP NEXT 4

LOW4: MOVR2,#00H

NEXT4: CJNE R2,#00H,CHECKEN AG

LJMP RESET

EXIT: CJNE R2,#01,ENTER

CHECKEX: JNB P1.1,LOW5

MOVR1,#01

LJMP NEXT5

LOW5: MOV R1 #00H

NEXT5: CJNE R1,#01H,CHECKEX

LJMP EXITPG

CHECKENXAG: JNB P1.1 LOW6

MOV R1,#01

LJMP NEXT6

LOW6: MOV R1,#00H

NEXT6: CJNE R1,#00H,CHECKENEX AG

Page 56: The Final Report

P a g e | 56

LJMP RESET

RESET: MOV R1,#00H

MOV R2,#00H

LJMP CHECK

ENTER PG: INC R3

MOV A,R3

MOV P3,A

SET B P2.0

LJMP CHECKENAG

EXITPG: DEC R3

MOV A,R3

MOV P3,A

CJNE R3,#00H,CHECKEXAG

CLR P2.0

LJMP CHECKENEXAG

END

Page 57: The Final Report

P a g e | 57

5.3 FLOW CHART

NO NO

YES YES

NO NO

YES YES

NO

Start

Visitor counter

C=0

DISPLAY

Is IR

Receive 2

detects

Is IR

Receiver1

detects

Wait tn time Wait tn time

Is IR

Receiver2

detects

Is IR

Receiver1

detects

Decrement

C = C -- 1

Increment

C = C + 1 DISPLAY

Is

C=0

RELAY OFF RELAY ON

Lights

Switched OFF

Lights

Switched ON

Page 58: The Final Report

P a g e | 58

6. Software Development

Microcontroller Model Functionality- The core of any embedded system design is the

microcontroller and the completeness of the model as well as its accuracy are therefore

of primary importance. That simulation models for

Microcontrollers not only support a peripheral that want to use but support the mode

which want to use the peripheral and to a satisfactory level of detail. Some

microcontroller models are in fact little more than instruction set simulators (which is

light years away from the level of detail in Proteus VSM microcontroller models) The

following chart details model particulars Peripheral Support-

In embedded systems design it's vital that have simulation models for the peripherals

likely to use. Aside from the standard collection of TTL/CMOS libraries, op amps, diodes,

transistors, etc. the following chart lists some common embedded peripherals and their

support within various packages.

PIC C Compiler-

This integrated C development environment gives developers the capability to quickly

produce very efficient code from an easily maintainable high level language.

The compiler includes built-in functions to access the PIC microcontroller hardware such

as READ_ADC to read a value from the A/D converter. Discrete I/O is handled by

describing

the port characteristics in a PRAGMA. Functions such as INPUT and OUTPUT_HIGH will

properly maintain the tri-state registers. Variables including structures may be directly

mapped

to memory such as I/O ports to best represent the hardware structure in C.

Page 59: The Final Report

P a g e | 59

7. Seven Segment Display

A seven-segment display (SSD), or seven-segment indicator, is a form of electronic

display device for displaying decimal numerals that is an alternative to the more

complex dot-matrix displays. Seven-segment displays are widely used in digital clocks,

electronic meters, and other electronic devices for displaying numerical information.

The idea of the seven-segment display is quite old. In 1910, for example, a seven-

segment display illuminated by incandescent bulbs was used on a power-plant boiler

room signal panel.

A seven segment display, as its name indicates, is composed of seven elements.

Individually on or off, they can be combined to produce simplified representations of

the arabic numerals. Often the seven segments are arranged in an oblique (slanted)

arrangement, which aids readability. In most applications, the seven segments are of

nearly uniform shape and size (usually elongated hexagons, though trapezoids and

rectangles can also be used), though in the case of adding machines, the vertical

segments are longer and more oddly shaped at the ends in an effort to further enhance

readability.

Each of the numbers 0, 6, 7 and 9 may be represented by two or more different glyphs

on seven-segment displays.

The seven segments are arranged as a rectangle of two vertical segments on each side

with one horizontal segment on the top, middle, and bottom. Additionally, the seventh

segment bisects the rectangle horizontally. There are also fourteen-segment displays

and sixteen-segment displays (for full alphanumerics); however, these have mostly been

replaced by dot-matrix displays.

Page 60: The Final Report

P a g e | 60

PARTS AND MATERIALS

• 4511 BCD-to-7seg latch/decoder/driver (Radio Shack catalog # 900-4437)

• Common-cathode 7-segment LED display (Radio Shack catalog # 276-075)

• Eight-position DIP switch (Radio Shack catalog # 275-1301)

• Four 10 kΩ resistors

• Seven 470 Ω resistors

• One 6 volt battery

Caution! The 4511 IC is CMOS, and therefore sensitive to static electricity

Page 61: The Final Report

P a g e | 61

There are two important types of 7-segment LED display. In a common cathodedisplay,

the cathodes of all the LEDs are joined together and the individual segments are

illuminated by HIGH voltages. In a common anode display, the anodes of all the LEDs are

joined together and the individual segments are illuminated by connecting to a LOW

voltage.

The 4511 is designed to drive a common cathode display and won't work with a

common anode display. You need to check that you are using the right kind of display

before you start building.

Page 62: The Final Report

P a g e | 62

The 0.56 in. 7-segment display common cathode available from Rapid works well as part

of a prototype board circuit.

Page 63: The Final Report

P a g e | 63

FEATURES

* 0.52 inch (13.2 mm) DIGIT HEIGHT.

* CONTINUOUS UNIFORM SEGMENTS.

* LOW POWER REQUIREMENT.

* EXCELLENT CHARACTERS APPEARANCE.

* HIGH BRIGHTNESS + HIGH CONTRAST.

* WIDE VIEWING ANGLE.

* SOLID STATE RELIABILITY.

* CATEGORIZED FOR LUMINOUS INTENSITY.

DESCRIPTION

The LTS-547AP is a 0.52 inch (13.2 mm) digit height single digit

seven-segment display. This device utilizes bright red LED chips,

which are made from GaP on a transparent GaP substrate, and has

a gray face and white segments.

DEVICE

PART NO DESCRIPTION

BRIGHT RED COMMON CATHODE

LTS-547AP RT.HAND DECIMAL

Page 64: The Final Report

P a g e | 64

INTERNAL CIRCUIT DIAGRAM

PIN CONNECTION

No. CONNECTION

1 ANODE E

2 ANODE D

3 COMMON CATHODE

4 ANODE C

5 ANODE DP

6 ANODE B

7 ANODE A

8 COMMON CATHODE

9 ANODE F

10 ANODE G

Page 65: The Final Report

P a g e | 65

ABSOLUTE MAXIMUM RATING AT Ta=25°C

PARAMETER MAXIMUM RATING UNIT

Power Dissipation Per Segment 40 mW

Peak Forward Current Per Segment (

1/10 Duty Cycle, 0.1ms Pulse Width )

60 mA

Continuous Forward Current Per

Segment Derating Linear From 25C

Per Segment

15

0.2

MA

MA/C

Reverse Voltage Per Segment 5 V

Operating Temperature Range -35°C to +85°C

Storage Temperature Range -35°C to +85C

Solder Temperature: max 260C for max 3sec at 1.6mm below seating

plane.

ELECTRICAL / OPTICAL CHARACTERISTICS AT Ta=25°C

PARAMETER SYMBOL MIN

.

TYP. MAX

.

UNIT TEST CONDITION

Average Luminous Intensity Iv 320 800 |icd IF=10mA

Peak Emission Wavelength Xp 697 nm IF=20mA

Spectral Line Half-Width Ak 90 nm IF=20mA

Dominant Wavelength 657 nm IF=20mA

Forward Voltage Per

Segment

VF 2.1 2.6 V IF=20mA

Reverse Current Per Segment IR 100 |lA VR=5V

Luminous Intensity Matching

Ratio

Iv-m 2:1 IF=10mA

Note: Luminous intensity is measured with a light sensor and filter combination that approximates the CIE

(Commision Internationale De L'Eclairage) eye-response curve.

Page 66: The Final Report

P a g e | 66

TYPICAL ELECTRICAL / OPTICAL CHARACTERISTIC CURVES

Page 67: The Final Report

P a g e | 67

8.RELAY

A relay is an electrically operated switch used to isolate one electrical circuit from

another. In its simplest form, a relay consists of a coil used as an electromagnet to open

and close switch contacts. Since the two circuits are isolated from one another, a lower

voltage circuit can be used to trip a relay, which will control a separate circuit that

requires a higher voltage or amperage. Relays can be found in early telephone exchange

equipment, in industrial control circuits, in car audio systems, in automobiles, on water

pumps, in high-power audio amplifiers and as protection devices.

Relay Switch Contacts

The switch contacts on a relay can be "normally open" (NO) or "normally closed" (NC)--

that is, when the coil is at rest and not energized (no current flowing through it), the

switch contacts are given the designation of being NO or NC. In an open circuit, no

current flows, such as a wall light switch in your home in a position that the light is off.

In a closed circuit, metal switch contacts touch each other to complete a circuit, and

current flows, similar to turning a light switch to the "on" position. In the accompanying

schematic diagram, points A and B connect to the coil. Points C and D connect to the

switch. When you apply a voltage across the coil at points A and B, you create an

electromagnetic field, which attracts a lever in the switch, causing it to make or break

contact in the circuit at points C and D (depending if the design is NO or NC). The switch

contacts remain in this state until you remove the voltage to the coil. Relays come in

Page 68: The Final Report

P a g e | 68

different switch configurations. The switches may have more than one "pole," or switch

contact. The diagram shows a "single pole single throw" configuration, referred to as

SPST. This is similar to a wall light switch in your home. With a single "throw" of the

switch, you close the circuit.

A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron

core, an iron yoke which provides a low reluctance path for magnetic flux, a movable

iron armature, and one or more sets of contacts (there are two in the relay pictured).

The armature is hinged to the yoke and mechanically linked to one or more sets of

moving contacts. It is held in place by a spring so that when the relay is de-energized

there is an air gap in the magnetic circuit. In this condition, one of the two sets of

contacts in the relay pictured is closed, and the other set is open. Other relays may have

more or fewer sets of contacts depending on their function. The relay in the picture also

has a wire connecting the armature to the yoke. This ensures continuity of the circuit

between the moving contacts on the armature, and the circuit track on the printed

circuit board (PCB) via the yoke, which is soldered to the PCB.

When an electric current is passed through the coil it generates a magnetic field that

activates the armature, and the consequent movement of the movable contact(s) either

makes or breaks (depending upon construction) a connection with a fixed contact. If the

set of contacts was closed when the relay was de-energized, then the movement opens

the contacts and breaks the connection, and vice versa if the contacts were open. When

the current to the coil is switched off, the armature is returned by a force,

approximately half as strong as the magnetic force, to its relaxed position. Usually this

force is provided by a spring, but gravity is also used commonly in industrial motor

starters. Most relays are manufactured to operate quickly. In a low-voltage application

this reduces noise; in a high voltage or current application it reduces arcing.

When the coil is energized with direct current, a diode is often placed across the coil to

dissipate the energy from the collapsing magnetic field at deactivation, which would

otherwise generate a voltage spike dangerous to semiconductor circuit components.

Some automotive relays include a diode inside the relay case. Alternatively, a contact

protection network consisting of a capacitor and resistor in series (snubber circuit) may

absorb the surge. If the coil is designed to be energized with alternating current (AC), a

Page 69: The Final Report

P a g e | 69

small copper "shading ring" can be crimped to the end of the solenoid, creating a small

out-of-phase current which increases the minimum pull on the armature during the AC

cycle.

A solid-state relay uses a thyristor or other solid-state switching device, activated by the

control signal, to switch the controlled load, instead of a solenoid. An optocoupler (a

light-emitting diode (LED) coupled with a photo transistor) can be used to isolate control

and controlled circuits.

Latching relay

Latching relay with permanent magnet

A latching relay has two relaxed states (bistable). These are also called "impulse",

"keep", or "stay" relays. When the current is switched off, the relay remains in its last

state. This is achieved with a solenoid operating a ratchet and cam mechanism, or by

having two opposing coils with an over-center spring or permanent magnet to hold the

armature and contacts in position while the coil is relaxed, or with a remanent core. In

the ratchet and cam example, the first pulse to the coil turns the relay on and the

second pulse turns it off. In the two coil example, a pulse to one coil turns the relay on

and a pulse to the opposite coil turns the relay off. This type of relay has the advantage

that one coil consumes power only for an instant, while it is being switched, and the

relay contacts retain this setting across a power outage. A remanent core latching relay

requires a current pulse of opposite polarity to make it change state.

Page 70: The Final Report

P a g e | 70

Reed relay

A reed relay is a reed switch enclosed in a solenoid. The switch has a set of contacts

inside an evacuated or inert gas-filled glass tube which protects the contacts against

atmospheric corrosion; the contacts are made of magnetic material that makes them

move under the influence of the field of the enclosing solenoid. Reed relays can switch

faster than larger relays, require only little power from the control circuit, but have low

switching current and voltage ratings. In addition, the reeds can become magnetized

over time, which makes them stick 'on' even when no current is present; changing the

orientation of the reeds with respect to the solenoid's magnetic field will fix the

problem.

Mercury-wetted relay

A mercury-wetted reed relay is a form of reed relay in which the contacts are wetted

with mercury. Such relays are used to switch low-voltage signals (one volt or less) where

the mercury reduces the contact resistance and associated voltage drop, for low-current

signals where surface contamination may make for a poor contact, or for high-speed

applications where the mercury eliminates contact bounce. Mercury wetted relays are

position-sensitive and must be mounted vertically to work properly. Because of the

toxicity and expense of liquid mercury, these relays are now rarely used. See also

mercury switch.

Polarized relay

A polarized relay placed the armature between the poles of a permanent magnet to

increase sensitivity. Polarized relays were used in middle 20th Century telephone

exchanges to detect faint pulses and correct telegraphic distortion. The poles were on

Page 71: The Final Report

P a g e | 71

screws, so a technician could first adjust them for maximum sensitivity and then apply a

bias spring to set the critical current that would operate the relay.

Machine tool relay

A machine tool relay is a type standardized for industrial control of machine tools,

transfer machines, and other sequential control. They are characterized by a large

number of contacts (sometimes extendable in the field) which are easily converted from

normally-open to normally-closed status, easily replaceable coils, and a form factor that

allows compactly installing many relays in a control panel. Although such relays once

were the backbone of automation in such industries as automobile assembly, the

programmable logic controller (PLC) mostly displaced the machine tool relay from

sequential control applications.

A relay allows circuits to be switched by electrical equipment: for example, a timer

circuit with a relay could switch power at a preset time. For many years relays were the

standard method of controlling industrial electronic systems. A number of relays could

be used together to carry out complex functions (relay logic). The principle of relay logic

is based on relays which energize and de-energize associated contacts. Relay logic is the

predecessor of ladder logic, which is commonly used in Programmable logic controllers.

Ratchet relay

This is again a clapper type relay which does not need continuous current through its

coil to retain its operation.

Contactor relay

A contactor is a very heavy-duty relay used for switching electric motors and lighting

loads, although contactors are not generally called relays. Continuous current ratings for

common contactors range from 10 amps to several hundred amps. High-current

contacts are made with alloys containing silver. The unavoidable arcing causes the

contacts to oxidize; however, silver oxide is still a good conductor. Such devices are

often used for motor starters. A motor starter is a contactor with overload protection

Page 72: The Final Report

P a g e | 72

devices attached. The overload sensing devices are a form of heat operated relay where

a coil heats a bi-metal strip, or where a solder pot melts, releasing a spring to operate

auxiliary contacts. These auxiliary contacts are in series with the coil. If the overload

senses excess current in the load, the coil is de-energized. Contactor relays can be

extremely loud to operate, making them unfit for use where noise is a chief concern.

Solid-state relay

Solid state relay with no moving parts

A solid state relay (SSR) is a solid state electronic component that provides a similar

function to an electromechanical relay but does not have any moving components,

increasing long-term reliability. Every solid-state device has a small voltage drop across

it. This voltage drop limited the amount of current a given SSR could handle. The

minimum voltage drop for such a relay is a function of the material used to make the

device. Solid-state relays rated to handle 100 to 1,200 Amperes, have become

commercially available. Compared to electromagnetic relays, they may be falsely

triggered by transients.

Page 73: The Final Report

P a g e | 73

Solid state contactor relay

25 A or 40 A solid state contactors

A solid state contactor is a heavy-duty solid state relay, including the necessary heat

sink, used for switching electric heaters, small electric motorsand lighting loads; where

frequent on/off cycles are required. There are no moving parts to wear out and there is

no contact bounce due to vibration. They are activated by AC control signals or DC

control signals from Programmable logic controller (PLCs), PCs, Transistor-transistor

logic (TTL) sources, or other microprocessor and microcontroller controls.

Buchholz relay

A Buchholz relay is a safety device sensing the accumulation of gas in large oil-filled

transformers, which will alarm on slow accumulation of gas or shut down the

transformer if gas is produced rapidly in the transformer oil.

Forced-guided contacts relay

A forced-guided contacts relay has relay contacts that are mechanically linked together,

so that when the relay coil is energized or de-energized, all of the linked contacts move

together. If one set of contacts in the relay becomes immobilized, no other contact of

the same relay will be able to move. The function of forced-guided contacts is to enable

Page 74: The Final Report

P a g e | 74

the safety circuit to check the status of the relay. Forced-guided contacts are also known

as "positive-guided contacts", "captive contacts", "locked contacts", or "safety relays".

Overload protection relay

Electric motors need overcurrent protection to prevent damage from over-loading the

motor, or to protect against short circuits in connecting cables or internal faults in the

motor windings.[3] One type of electric motor overload protection relay is operated by a

heating element in series with the electric motor. The heat generated by the motor

current heats a bimetallic strip or melts solder, releasing a spring to operate contacts.

Where the overload relay is exposed to the same environment as the motor, a useful

though crude compensation for motor ambient temperature is provided.

The Single Pole Double Throw Relay

A single pole double throw (SPDT) relay configuration switches one common pole to two

other poles, flipping between them. As shown in the schematic diagram, the common

point E completes a circuit with C when the relay coil is at rest, that is, no voltage is

applied to it. This circuit is "closed." A gap between the contacts of point E and D creates

an "open" circuit. When you apply power to the coil, a metal level is pulled down,

closing the circuit between points E and D and opening the circuit between E and C. A

single pole double throw relay can be used to alternate which circuit a voltage or signal

will be sent to.

How Relay Works In This Circuit :-

A single pole dabble throw (SPDT) relay is connected to port RB1 of the microcontroller

through a driver transistor. The relay requires 12 volts at a current of around 100ma,

which cannot provide by the microcontroller. So the driver transistor is added. The relay

is used to operate the external solenoid forming part of a locking device or for operating

any other electrical devices. Normally the relay remains off. As soon as pin of the

microcontroller goes high, the relay operates. When the relay operates and releases.

Diode D2 is the standard diode on a mechanical relay to prevent back EMF from

damaging Q3 when the relay releases. LED L2 indicates relay on.

Page 75: The Final Report

P a g e | 75

8.PROJECT PICTURES

Variable Power Supply Unit

Display Unit Relay Unit

Page 76: The Final Report

P a g e | 76

Processor Unit

Receiver Units

Page 77: The Final Report

P a g e | 77

Variable Power Supply Unit

Transmitter Units

Page 78: The Final Report

P a g e | 78

9.CONCLUSION

Testing And Results

We started our project by making power supply. That is easy for me but when we turn

toward the main circuit, there are many problems and issues related to it, which we

faced, like component selection, which components is better than other and its feature

and cost wise a, then refer the data books and other materials related to its.

We had issues with better or correct result, which we desired. And also the software

problem.

We also had some soldering issues which were resolved using continuity checks

performed on the hardware.

We had issues with better or correct result, which we desired. And also the software

problem.

We also had some soldering issues which were resolved using continuity checks

performed on the hardware.

We started testing the circuit from the power supply. There we got over first trouble.

After getting 9V from the transformer it was not converted to 5V and the circuit

received 9V.

As the solder was shorted IC 7805 got burnt. So we replaced the IC7805.also the circuit

part around the IC7805 were completely damaged..with the help of the solder we made

the necessary paths.

Page 79: The Final Report

P a g e | 79

DIFFICULTIES AND RECTIFICATION:

The common difficulties faced while making this project were:

1 . L a c k o f u n i f o r m i t y f o r t h e “ C o m m o n G r o u n d ” : The Relay circuit, the

Seven Segment circuit, the I.R sensors, and the Microcontroller kit, all have to be

connected to the “common ground”.There was a mismatch between the values of

ground given to each and wasn’t constant for all. The mistake was observed and

corrected.

2. Erroneously giving “Human Ground” to the circuit: In the Relay circuit, the

triggering sound was observed when connections were made, i.e. one terminal to

ground and other to the 5V of micro controller. Even after the connections were

removed, triggering sound was observed. After much thinking and speculation it was

observed that, supplying Human Ground was causing the triggering

3. Giving a D.C (12V) supply to 5 relays simultaneously: Instead of using a

battery or an adapter, we created a Power Source using a Step-down Transformer,

Bridge Rectifier, Capacitor Filter and Voltage Regulator. That’s how we got a 12volt D.C

supply from the domestic 220 volts A.C.

4 . I m p r o p e r S o l d e r i n g : Due to flow improper soldering, the 3 legs of the

voltage regulator were short circuited, (as concluded by the use of a millimeter).It was

de-soldered and placed again with legs open wider than before.

5 . I m p r o p e r p l a c e m e n t o f t h e b u l b s : In order to exactly simulate the model,

we had put bulbs on the ceiling of the wooden structure. Once all of them were

placed together, it was difficult to understand which bulb was illuminated when. We

then took a corrective measure and decided to place the bulbs on the roofs, and it could

be clearly seen that which bulb is being lit and where.

Page 80: The Final Report

P a g e | 80

APPLICATIONS AND FUTURE PROSPECTS

General applications

This project, Automatic light control in a room with person counter, can be used in

areas, like:

1 . P o w e r c o n s e r v a t i o n a n d i t s e f f i c i e n t u s e : The genius of this idea is

the efficient use of power. One of the most crucial issues in today’s times is energy

conservation. In spite of repeated reminders about “switching off the lights and fans

when you leave” it’s hardly done with any effect. The usage of an Automatic Room Light

Controller and Visitor Counter ensures both, Optimum usage and Minimum wastage. A

recent survey by “The NTPC” has shown that, if for an average consumer of electricity,

the appliances are switched off as use; there is a saving of more than 36% of power.

Page 81: The Final Report

P a g e | 81

Thus having an automatic control of the appliances is like banking and storing that

electricity for future use. After all, power saved is power generated.

Specific Applications of the Visitor Counter and Display:

1 . P r e v e n t i n g t h e f t i n a c o m m e r c i a l c o m p l e x :

If a showroom of a multiplex shopping Centre has an Automatic Room Light

Controller and Visitor Counter installed on every entrance and exit point, the “Visitor

Counter” feature comes into play.

2 . D i s t r i b u t i o n o f t h e e x a c t n u m b e r o f a r t i c l e s :

Exact information of number of people present facilitates proper distribution of articles

be it books, reports or refreshments to the people.

In large capacity arenas, such as auditoriums, or conference halls, it’s difficult to

know the number of people presents accurately. Now, while conducting workshops,

presentations or lectures, there is often distribution of expensive articles like books or

confidential ones like reports and worksheets. Knowing the exact number required is

crucial. It ensures that each one gets one and only one preventing wastage as well as

deficiency.

3 . C r o s s v e r i f i c a t i o n o f a t t e n d a n c e :

Knowledge of the exact number of people present for a lecture or workshop, as

indicated by the visitor counter, in any educational institute eliminates any scope of a

false attendance or “proxy”. With as little effort as glancing at no of people present as

per the display it ensures vigilance and discipline in the classroom. Other than that, in

Cinema Halls and other events where entry is strictly as per passes or invitations, like

concerts and fests the number of people entered and the tickets or passes gathered can

be cross checked.

Page 82: The Final Report

P a g e | 82

FUTURE EXPANSION

By using this circuit and proper power supply we can implement various applications

Such as fans, tube lights, etc.

By modifying this circuit and using two relays we can achieve a task of opening and

closing the door.

APPLICATION, ADVANTAGES & DISADVANTAGES

Application:-

For counting purposes

For automatic room light control

Advantages:-

Low cost

Easy to use

Implement in single door

Disadvantages:-

It is used only when one single person cuts the rays of the sensor hence it cannot be

used when two person cross simultaneously.

Page 83: The Final Report

P a g e | 83

11.APPENDIX

Overview of IC 89S752

Programmable Clock Out A 50% duty cycle clock can be programmed to come out on P1.0, as shown in Figure 9. This pin, besides being a regular I/O

pin, has two alternate functions. It can be programmed to input the external clock for Timer/Counter 2 or to output a 50%

duty cycle clock ranging from 61 Hz to 4 MHz at a 16 MHz operating frequency.

To configure the Timer/Counter 2 as a clock generator, bit C/T2 (T2CON.1) must be cleared and bit T2OE (T2MOD.1) must

be set. Bit TR2 (T2CON.2) starts and stops the timer.

The clock-out frequency depends on the oscillator frequency and the reload value of Timer 2 capture registers (RCAP2H,

RCAP2L), as shown in the following equation.

Clock-Out Frequency

In the clock-out mode, Timer 2 roll-overs will not generate an interrupt. This behavior is similar to when Timer 2 is used as a

baud-rate generator. It is possible to use Timer 2 as a baud-rate generator and a clock generator simultaneously. Note,

however, that the baud-rate and clock-out frequencies cannot be determined independently from one another since they both

use RCAP2H and RCAP2L.

Interrupts The AT89S52 has a total of six interrupt vectors: two external interrupts (INTO and INT1), three timer interrupts (Timers 0,

1, and 2), and the serial port interrupt. These interrupts are all shown in Figure 10.

Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function

Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once.

Note that Table 5 shows that bit position IE.6 is unimple-mented. In the AT89S52, bit position IE.5 is also unimple-mented.

User software should not write 1s to these bit positions, since they may be used in future AT89 products.

Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. Neither of these flags is cleared

by hardware when the service routine is vectored to. In fact, the service routine may have to determine whether it was TF2 or

EXF2 that generated the interrupt, and that bit will have to be cleared in software.

The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then

polled by the circuitry in the next cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in

which the timer overflows.

Oscillator Frequency

4x[65536(RCAP2H,RCAP2L)]

Page 84: The Final Report

P a g e | 84

Table. Interrupt Enable (IE) Register

(MSB) (LSB)

EA - ET2 ES ET1 EX1 ETO EXO

Enable

Bit

= 1 enables the interrupt.

Enable

Bit

= O disables the interrupt.

Symbol

Position

Function

EA IE.7 Disables all interrupts. If EA = O, no interrupt is acknowledged. If EA = 1, each interrupt source is individually enabled or disabled by setting or clearing its enable bit.

- IE.6 Reserved.

ET2 IE.5 Timer 2 interrupt enable bit.

ES IE.4 Serial Port interrupt enable bit.

ET1 IE.3 Timer 1 interrupt enable bit.

EX1 IE.2 External interrupt 1 enable bit.

ETO IE.1 Timer O interrupt enable bit.

EXO IE.O External interrupt O enable bit.

User software should never write 1s to unimplemented bits, because they may be used in future AT89 products.

Figure. Interrupt Sources

IEO

Page 85: The Final Report

P a g e | 85

Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-

chip oscillator, as shown in Figure 11. 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 12. 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.

Note that when idle mode is terminated by a hardware 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 mode is terminated by a reset, the instruction following the one that invokes idle mode should not write

to a port pin or to external memory.

Power-down Mode In the Power-down mode, the oscillator is stopped, and the instruction that invokes Power-down is the last instruction

executed. The on-chip RAM and Special Function Registers retain their values until the Power-down mode is terminated.

Exit from Power-down mode can be initiated either by a hardware reset or by an enabled external interrupt.

Page 86: The Final Report

P a g e | 86

10.BIBLOGRAPHY

Microprocessor Architecture, Programming & Application-R. Gaonkar, Wiley

Advance Microprocessor -Badriram & Badriram-MH

www.wikipedia.org

www.datasheetcatalog.com

www.electronicsforyou.com

www.projectworld.com

www.alldatasheets.com


Recommended