Sie sind auf Seite 1von 55

CHAPTER 1

INTRODUCTION

1.1Objective

Technology is the making, modification, usage, and knowledge of tools, machines,


techniques, crafts, systems, methods of organization, in order to solve a problem,
improve a preexisting solution to a problem, achieve a goal, handle an applied
input/output relation or perform a specific function. It can also refer to the collection
of such tools, machinery, modifications, arrangements and procedures. Technologies
significantly affect human as well as other animal species' ability to control and adapt
to their natural environments. This project entitled “Microcontroller based Eye Blink
Detector” is focused at making travel safe by constantly monitoring if the driver is
sleeping or not.

Various human behaviors can be indicated by eye blink patterns. In this project, we
present a method based on IR sensing techniques for detecting human eye blinks and
generating inter-eye-blink intervals. This project is based on a new algorithm and a
new measurement for eye blinking detection called “the eyelid’s state detecting (ESD)
value.” The ESD value can then be used for examining the open and close states of
eyelids. Our algorithm provides a 99.6% overall accuracy detection for eye blink
detection. We can further generate an inter-eye-blink interval graphs by differencing
between two consecutive eye blink states. Depending upon blinking period and
blinking frequency one can estimate whether the eyes are closed or open i.e. it can be
depicted if the person is sleeping or not. This is of much use in determining if the
driver of the vehicle is sleeping or not. Further an alarm can be used to awaken him if
driver is found sleeping and along with that owner of the vehicle or the related
authority can be informed about the same through DTMF.

1.2 Application

1. This is of much use in trains. As almost 38% accidents occurs due to dozing habits
of drivers. So this will reduce accidents manifold and will save human life and
property.

1
2. This is helpful for taxi owners to keep an eye on the sleeping habits of their drivers
that too from a far off location by the virtue of DTMF. Simultaneously it will avoid
any mishap that can occur due to dozing driver.

2
CHAPTER 2
LITERATURE SURVEY

2.1 Microcontroller

A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a


single integrated circuit containing a processor core, memory, and programmable
input/output peripherals. Program memory in the form of NOR flash or OTP ROM is
also often included on chip, as well as a typically small amount of RAM.
Microcontrollers are designed for embedded applications, in contrast to
the microprocessors used in personal computers or other general purpose applications.

Microcontrollers are used in automatically controlled products and devices, such as


automobile engine control systems, implantable medical devices, remote controls,
office machines, appliances, power tools, toys and other embedded systems. By
reducing the size and cost compared to a design that uses a separate microprocessor,
memory, and input/output devices, microcontrollers make it economical to digitally
control even more devices and processes. Mixed signal microcontrollers are common,
integrating analog components needed to control non-digital electronic systems.

Some microcontrollers may use four-bit words and operate at clock rate frequencies
as low as 4 kHz, for low power consumption (mill watts or microwatts). They will
generally have the ability to retain functionality while waiting for an event such as a
button press or other interrupt; power consumption while sleeping (CPU clock and
most peripherals off) may be just nano watts, making many of them well suited for
long lasting battery applications. Other microcontrollers may serve performance-
critical roles, where they may need to act more like a digital signal processor (DSP),
with higher clock speeds and power consumption.

2.2Embedded Design

Microcontroller can be considered a self-contained system with a processor, memory


and peripherals and can be used as an embedded system.[1] The majority of
microcontrollers in use today are embedded in other machinery, such as automobiles,
telephones, appliances, and peripherals for computer systems. These are

3
called embedded systems. While some embedded systems are very sophisticated,
many have minimal requirements for memory and program length, with no operating
system, and low software complexity. Typical input and output devices include
switches, relays, solenoids, LEDs, small or custom LCD displays, radio frequency
devices, and sensors for data such as temperature, humidity, light level etc. Embedded
systems usually have no keyboard, screen, disks, printers, or other recognizable I/O
devices of a personal computer, and may lack human interaction devices of any kind.

2.3 Programming environments

microcontrollers were originally programmed only in assembly language, but


various high-level programming languages are now also in common use to target
microcontrollers. These languages are either designed specially for the purpose, or
versions of general purpose languages such as the C programming
language. Compilers for general purpose languages will typically have some
restrictions as well as enhancements to better support the unique characteristics of
microcontrollers. Here in this project we have used embedded C.

2.4 IR Sensors
A Passive measures infrared (IR) light radiating from objects in its field of view. PIR
sensors are often used in the construction of PIR-based motion (see below). Apparent
motion is detected when an infrared source with on temperature, such as a human,
passes in front of an infrared source with another temperature, such as a wall. This is
not to say that the sensor detects the heat from the object passing in front of it but that
the object breaks the field which the sensor has determined as the "normal" state. Any
object, even one exactly the same temperature as the surrounding objects will cause
the PIR to activate if it moves in the field of the sensors. Infrared sensor (PIR sensor)
is an electronic device that All objects above absolute zero emit energy in the form of
radiation. Usually infrared radiation is invisible to the human eye but can be detected
by electronic devices designed for such a purpose. The term passive in this instance
means that the PIR device does not emit an infrared beam but merely passively
accepts incoming infrared radiation. “Infra” meaning below our ability to detect it
visually, and “Red” because this color represents the lowest energy level that our eyes

4
can sense before it becomes invisible. Thus, infrared means below the energy level of
the color red, and applies to many sources of invisible energy.

2.4.1 Details about the IR Sensor


Based on a simple basic Idea, this proximity sensor, is easy to build, easy to calibrate
and still, it provides a detection range of 35 cm (range can change depending on the
ambient light intensity i.e. the range of the light intensity in surroundings of object).
This sensor can be used for most indoor applications where no important ambient
light is present. For simplicity, this sensor doesn't provide ambient light immunity but
a more complicated, ambient light ignoring sensor should be discussed in a coming
article. However, this sensor can be used to measure the speed of object moving at a
very high speed, like in industry or in tachometers. In such applications, ambient light
ignoring sensor, which rely on sending 40 Khz pulsed signals cannot be used because
there are time gaps between the pulses where the sensor is 'blind'. The solution
proposed doesn't contain any special components, like photo-diodes, photo-
transistors, or IR receiver ICs, only a couple of IR leds, an Op amp, a transistor and a
couple of resistors. In need, as the title says, a standard IR led is used for the
purpose of detection. Due to that fact, the circuit is extremely simple, and any novice
electronics hobbyist can easily understand and build it.

2.4.2 Working of IR Sensors


IR sensors are used to detect the presence of the objects. Its working is based on a
quite simple principle. It is the same principle in all Infra-Red proximity sensors. The
basic idea is to send infra red light through IR-LEDs, which is then reflected by any
object in front of the sensor. Then pick up the reflected IR light. For detecting the
reflected IR light, effective technique is used and that is to use another IR-LED, to
detect the IR light that was emitted from another led of the exact same type.This is an
electrical property of Light Emitting Diodes (LEDs) which is the fact that a led
Produce a voltage difference across its leads when it is subjected to light. As if it was
a photo-cell, but with much lower output current. In other words, the voltage
generated by the leds can't be – in any way - used to generate electrical power from
light, it can barely be detected.

5
CHAPTER 3
ABOUT THE PROJECT

3.1 Functional Block Diagram

Figure 3.1 Block Diagram

In this diagram, various blocks present the working of circuit.


3.1.1 Power Supply

Transformers used here are Step down transformers. As output of transformer is AC,
so it gets converted into DC by using capacitor circuit. Above circuit shows output of
first module.

3.1.2 IR Sensor

IR senor will detect the blinking of eye and will send high to microcontroller for each
blink detected.
3.1.3 Microcontroller part
The microcontroller is getting its input from the IR sensor. For each blink it receives a
high signal. Side by side RTC i.e. real time clock is also working. For every 5 sec,
total number of blinks is counted by microcontroller. If the eye of driver blinks for

6
less than 3 times in 5 sec a high signal is send to buzzer. It alarms the driver.
Simultaneously microcontroller sends a high to DTMF section which makes a call to
the owner.
3.1.4 DTMF Section

This section is used to make a call to the owner to mark that driver is sleeping while
driving. When DTMF section receives a high, a call is made through the mobile at
the transmitter site i.e. vehicle to the receiver i.e owner on the pre stored contact
number. Contact number is stored in the microcontroller.

3.2 Working

1. The first step is the same conventional one i.e. to provide the power supply.
Installation will be such that once the vehicle comes in motion; the setup will be
automatically switched on.
2. Now if the driver doesn’t blink his eyes for at least three times in 5 seconds, then
the buzzer will ring up and simultaneously a call will be made to owner to mark that
the driver is dozing. The time period can be varied depending upon requirement.
3. Call is made through DTMF. DTMF stands for Dual Tone Multi Frequency.

3.3Organization of the Project

The project organization is done in following modules.


1. Designing of Block Diagram and Circuit Diagram.
2. Selecting various components to be used and to calculate various values.
3. Soldering of various components and IC’s.
4. Mechanical work such as placement of components on Sheet.
Chapter 4 deals with various Components used in project.
Chapter 5 deals with hardware implementation of project.
Chapter 6 consists of various results and conclusions related to project.
Chapter 7 deals with applications of project and further improvements or future scope
of it.

CHAPTER 4
SYSTEM ARCHITECTURE
7
Before going into details of project let us first emphasize on the basic system,
functional units and functional IC’s to be used in it.

4.1 Transformer

4.1.1 Introduction

A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors—the transformer's coils. A varying current in
the first or primary winding creates a varying magnetic flux in the transformer's core
and thus a varying magnetic field through the secondary winding. This varying
magnetic field induces a varying electromotive force (EMF), or "voltage", in the
secondary winding. This effect is called mutual induction.
A transformer makes use of Faraday's law and the ferromagnetic properties of an iron
core to efficiently raise or lower AC voltages. It of course cannot increase power so
that if the voltage is raised, the current is proportionally lowered and vice versa.

4.1.2 Basic principles

The transformer is based on two principles: first, that an electric current can produce a
magnetic field (electromagnetism), and, second that a changing magnetic field within
a coil of wire induces a voltage across the ends of the coil (electromagnetic
induction). Changing the current in the primary coil changes the magnetic flux that is
developed. The changing magnetic flux induces a voltage in the secondary coil.

4.1.3 Types of Transformer

There are basically two types of Transformers:


1) Step up Transformers
2) Step down Transformers.

Step Up Transformer:
8
Step-Up Transformers are one of the really common and vital electrical tools used in
power transmission and modification. They are usually the first major transformer in
a transmission system and are often used in various forms throughout the system.
A step-up transformer is one whose secondary voltage is greater than its primary
voltage. This kind of transformer "steps up" the voltage applied to it. For instance, a
step up transformer is needed to use a 220v product in a country with a 110v supply.

Step Down Transformer:


Step-Down Transformers are very close to the construction of Step-Up Transformers,
except that the windings on the primary side are always more numerous than those on
the secondary side. In fact, if you are already thinking it, yes, either type of
transformer could be wired in backwards and therefore achieve the opposite
application. The one caveat in this is that one has to assure that the resultant voltage
is equivalent to what is desirable as it is possible to arrive at an output in a range not
at all desirable for one's needs, depending on the proportionate number of windings
on primary and secondary sides. To be safe and effective, the output of a transformer
must be within a few percent of the voltage needed.

4.1.4 Detailed Operation:

The simplified description above neglects several practical factors, in particular the
primary current required to establish a magnetic field in the core, and the contribution
to the field due to current in the secondary circuit.
Models of an ideal transformer typically assume a core of negligible reluctance with
two windings of zero resistance.[31] When a voltage is applied to the primary
winding, a small current flows, driving flux around the magnetic circuit of the core.
[31] The current required to create the flux is termed the magnetizing current; since
the ideal core has been assumed to have near-zero reluctance, the magnetizing current
is negligible, although still required to create the magnetic field.
The changing magnetic field induces an electromotive force (EMF) across each
winding. Since the ideal windings have no impedance, they have no associated
voltage drop, and so the voltages VP and VS measured at the terminals of the
transformer, are equal to the corresponding EMFs. The primary EMF, acting as it does
in opposition to the primary voltage, is sometimes termed the "back EMF". This is
9
due to Lenz's law which states that the induction of EMF would always be such that it
will oppose development of any such change in magnetic field.

4.1.5 Construction:

A transformer consists of a rectangular core of soft iron in the form of sheets insulated
from one another. Two separate coils of insulated wires, a primary coil and a
secondary coil are wound on the core. These coils are well insulated from one another
and from the core. The coil on the input side is called Primary coil and the coil on the
output side is called Secondary coil.

4.1.6 Energy Losses

An ideal transformer would have no energy losses, and would be 100% efficient. In
practical transformers energy is dissipated in the windings, core, and surrounding
structures. Larger transformers are generally more efficient, and those rated for
electricity distribution usually perform better than 98%.
Experimental transformers using superconducting windings achieve efficiencies of
99.85%. The increase in efficiency can save considerable energy, and hence money, in
a large heavily-loaded transformer; the trade-off is in the additional initial and running
cost of the superconducting design.
Losses in transformers (excluding associated circuitry) vary with load current, and
may be expressed as "no-load" or "full-load" loss. Winding resistance dominates load
losses, whereas hysteresis and eddy currents losses contribute to over 99% of the no-
load loss. The no-load loss can be significant, so that even an idle transformer
constitutes a drain on the electrical supply and a running cost; designing transformers
for lower loss requires a larger core, good-quality silicon steel, or even amorphous
steel, for the core, and thicker wire, increasing initial cost, so that there is a trade-off
between initial cost and running cost. (Also see energy efficient transformer).
Transformer losses are divided into losses in the windings, termed copper loss, and
those in the magnetic circuit, termed iron loss. Losses in the transformer arise from:

Winding resistance:

10
Current flowing through the windings causes resistive heating of the conductors. At
higher frequencies, skin effect and proximity effect create additional winding
resistance and losses.
Hysteresis losses
Each time the magnetic field is reversed, a small amount of energy is lost due to
hysteresis within the core. For a given core material, the loss is proportional to the
frequency, and is a function of the peak flux density to which it is subjected.[43]
Eddy currents
Ferromagnetic materials are also good conductors, and a core made from such a
material also constitutes a single short-circuited turn throughout its entire length.
Eddy currents therefore circulate within the core in a plane normal to the flux, and are
responsible for resistive heating of the core material. The eddy current loss is a
complex function of the square of supply frequency and inverse square of the material
thickness. Eddy current losses can be reduced by making the core of a stack of plates
electrically insulated from each other, rather than a solid block; all transformers
operating at low frequencies use laminated or similar cores.
Magnetostriction
Magnetic flux in a ferromagnetic material, such as the core, causes it to physically
expand and contract slightly with each cycle of the magnetic field, an effect known as
magnetostriction. This produces the buzzing sound commonly associated with
transformers, and can cause losses due to frictional heating.
Mechanical losses
In addition to magnetostriction, the alternating magnetic field causes fluctuating
forces between the primary and secondary windings. These incite vibrations within
nearby metalwork, adding to buzzing noise, and consuming a small amount of power.
Stray losses
Leakage inductance is by itself largely lossless, since energy supplied to its magnetic
fields is returned to the supply with the next half-cycle. However, any leakage flux
that intercepts nearby conductive materials such as the transformer's support structure
will give rise to eddy currents and be converted to heat. There are also radiative losses
due to the oscillating magnetic field, but these are usually small.
4.2 Microcontroler 8051

4.2.1 Introduction
11
In 1981,Intel Corporation introduced an 8-bit microcontroller called 8051.This
microcontroller had 128 bytes of RAM,4K bytes of on-chip ROM, two timers, one
serial port and four ports(each 8-bits wide) all on a single chip. At that time it was also
referred to as a “system on a chip”. The 8051 is an 8-bit processor meaning that the
CPU can work on only 8-bits of data at a time. Data larger than 8 bits has to be broken
into 8 bits pieces to be processed by the CPU. The 8051 has a total of four I/O ports,
each 8 bits wide. The 8051 can have a maximum of 64K bytes of on-chip ROM.

4.2.2 Features of 8051

 It provides many functions (CPU, RAM, ROM, I/O, interrupt logic, timer, etc.)
in single package
 8-bit ALU, Accumulator and Registers; hence it is an 8-bit microcontroller

 8-bit data bus - It can access 8 bits of data in one operation

 16-bit address bus - It can access 216 memory locations - 64 kB (65536


locations) each of RAM and ROM

 On-chip RAM - 128 bytes (data memory)

 On-chip ROM - 4 kB (program memory)

 Four byte bi-directional input/output port

 UART (serial port)

 Two 16-bit Counter/timers

 Two-level interrupt priority.

4.2.3 Members of 8051 Family

There are two other members in the 8051 family of microcontrollers. They are 8052
and 8031.

8052 Microcontroller

The 8052 is another member of 8051 family. The 8052 has all the standard features of
8051 as well as an extra 128 bytes of RAM and an extra timer. In other words, the
12
8052 has 256 bytes of RAM and 3 timers. It also has 8K bytes of on-chip program
ROM instead of 4K bytes.

8031 Microcontroller

Another member of 8051 family is the 8031 chip. This chip is often referred to as a
ROM-less 8051 since it has 0K bytes of on-chip ROM. To use this chip external ROM
is added to it. The ROM containing the program attached to the 8031 can be as large
as 64K bytes. In the process of adding external ROM containing the program attached
to the 8031, two ports are lost. This leaves only 2 ports for I/O operations. To solve
this problem, we can add external I/O to the 8031 by interfacing the 8031 with
memory and I/O ports such as 8255 chip.

4.2.4 Comaprison of 8051 Family Members

Table 4.1: 8051 Family Members

FEATURE 8051 8052 8031

ROM 4K 8K 0K

RAM 128 256 128

TIMERS 2 3 2

I/O PINS 32 32 32

SEARIAL PORT 1 1 1

INTERRUPT SOURCES 6 8 6

13
4.2.5 Block Diagram

Figure 4.1 Block Diagram

Figure shows the block diagram of a typical microcontroller, which is a true

computer on a chip. The design incorporates all of the features found in

micro processor CPU: ALU, PC, SP, and registers. It also added the other

features needed to make a complete computer: ROM, RAM, parallel I/O,

serial I/O, counters, and clock circuit.

14
4.2.6 Pin Description

Figure 4.2 Pin Diagram

(i)Vcc

Pin 40 provides supply voltage to the chip. The voltage source is +5V.

(ii)GND

Pin 20 is the ground.

(iii)XTAL1 and XTAL2

The 8051 has an on-chip oscillator but requires an external clock to run it. Most often
a quartz crystal oscillator is connected to inputs XTAL1 (pin 19) and XTAL2 (pin
18).The quartz crystal oscillator connected to XTAL1 and XTAL2 also needs two
capacitors of 30pF value. One side of each capacitor is connected to the ground. There

15
are various speeds of 8051 family. Speed refers to the maximum oscillator frequency
connected to XTAL.

Figure 4.3 Oscillator connections

(iv)RST
Pin 9 is the RESET pin. It is an input and is active high (normally low).Upon applying
a high pulse to this pin, the microcontroller will reset and terminate all activities. This
is often referred to as a power-on reset. Activating a power-on reset will cause all
values in the registers to be lost. It will set program counter to all 0s.

In order for reset input to be effective, it must have a minimum duration of two
machine cycles. In other words, the high pulse must be high for a minimum of two
machine cycles before to go low.

(iv)EA
The 8051 family members such as 8751/52, 89C51/52 all come with on-chip ROM to
store programs. In such cases the this pin is connected to V cc. For family members
such as 8031 and 8052 in which there is no on-chip ROM, code is stored on an
external ROM

and is fetched by the 8051/52.Therefore, for 8051 the EA pin must be connected to
GND to indicate that the code is stored externally. EA which stands for “external
access” is pin number 31 in the DIP packages. It is an input pin and must be
connected to either Vcc or GND. This pin cannot be left unconnected.

16
(v)PSEN

This pin is an output pin. PSEN stands for “program store enable”. In an 8051 based
system in which an external ROM holds the program code, this pin is connected to the
OE pin of the ROM.

(vi) ALE

ALE (address latch enable) is an output pin and is active high. When connecting an
8051 to external memory, port 0 provides both address and data. In other words, the
8051 multiplexes address and data through port 0 to save pins. The ALE pin is used
for demultiplexing the address and data by connecting to the G pin of the 74LS373
chip.

(vii) I/O PORT PINS

The four ports P0, P1, P2, P3 each use 8 pins, making them 8-bit ports. All the ports
upon RESET are configured as inputs, ready to be used as input ports. When the first
0 is written to a port, it becomes an output. To reconfigure it as an input, a 1 must be
sent to the port. To use any of these ports as an input port, it must be programmed.

(vii)PORT 0

Port 0 occupies a total of 8 pins (pins32-39).It can be used for an input or output. To
use the pins of port 0 as both input and output ports, each pin must be connected
externally to a 10K-ohm pull-up resistor. Port 0 is also designated as AD0-AD7,
allowing it to be used for both address and data. When connecting an 8051 to an
external memory, port 0 provides both address and data. The 8051 multiplexes
address and data through port 0 to save pins. ALE indicates if P0 has address or data.
When ALE=0,it provides data D0-D7 but when ALE=1 it has address A0-A7.

(viii)PORT1

Port 1 occupies a total of 8 pins (pins 1 through 8).It can be used as input or output. In
contrast to port 0, this port does not need any pull-up resistors since it already has pull
up resistors. Upon reset, port1 is configured as an input port. If port 1 has been

17
configured as an output port, to make it an input port again, it must be programmed as
such by writing 1 to all its bits.

(ix)PORT2
Port 2 occupies a total of 8 pins (pins 21 through 28).It can be used as an input or
output. Just like P1.port 2 does not need any pull up resistors since it already has pull
up resistors internally. Upon reset port 2 is configured as an input port. To make port 2
as an input, it must be programmed as such by writing 1 to all its bits.

(x)Dual role of port 2

In many 8051 systems, P2 is used as simple I/O. But in 8051-based systems, port 2
must be used along with P0 to provide the 16-bit address for external memory. Port 2
is also designated as A8-A15, indicating its dual function.

(xi)PORT 3

Port 3 occupies a total of 8 pins, pins 10 through 17.It can be used as input or
oputput.P3 does not need any pull up resistors, just like P1 and P2 did not. Although
port 3 is configured as an input port upon reset, this is not the way it is most
commonly used. Port 3 has the additional function of providing some extremely
important signals such as interrupts. Port 3 has an additional function of providing
some extremely important signals such as interrupts. Some of the alternate functions
of P3 are listed below:

P3.0 RXD (Serial input)


P3.1 TXD (Serial output)
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 memory write strobe)
P3.7 RD (External memory read strobe).

18
4.2.7 Memory Space Allocation

1. Internal ROM
The 89C51 has 4K bytes of on-chip ROM. This 4K bytes ROM memory has memory
addresses of 0000 to 0FFFh. Program addresses higher than 0FFFh, which exceed the
internal ROM capacity, will cause the microcontroller to automatically fetch code
bytes from external memory. Code bytes can also be fetched exclusively from an
external memory, addresses 0000h to FFFFh, by connecting the external access pin to
ground. The program counter doesn’t care where the code is: the circuit designer
decides whether the code is found totally in internal ROM, totally in external ROM or
in a combination of internal and external ROM.
2. Internal RAM
The 128 bytes of RAM inside the 8051 are assigned addresses 00 to 7Fh. These 128
bytes can be divided into three different groups as follows:
 A total of 32 bytes from locations 00 to 1Fh are set aside for register banks and
the stack.
 A total of 16 bytes from locations 20h to 2Fh are set aside for bit addressable
read/write memory and instructions.
 A total of 80 bytes from locations 30h to 7Fh are used for read and write
storage, or what is normally called a scratch pad. These 80 locations of RAM
are widely used for the purpose of storing data and parameters by 8051
programmers.

4.3 Diode

An electric component that conducts electric current in only one direction, functioning
as a one-way valve. Diodes typically are made from semiconductor materials such as
silicon, germanium or selenium and are uses as voltage regulators, signal rectifiers,
oscillators and signal modulators/demodulators. In computer equipment, diodes are
commonly used to emit light by passing a current through it, as in light emitting
diodes (LEDs).

Abbreviation of light emitting diode, an electronic device that lights up when


electricity is passed through it. LEDs are usually red. They are good for displaying

19
images because they can be relatively small, and they do not burn out. However, they
require more power than LCDs.

The semiconductor diode, also known as a pn junction diode, is a two-element


semiconductor device that makes use of the rectifying properties of a PN junction to
convert alternating current into direct current by permitting current flow in only one
direction.

Figure 4.4: A PN junction diode

4.3.1 Function

Diodes allow electricity to flow in only one direction. The arrow of the circuit symbol
shows the direction in which the current can flow. Diodes are the electrical version of
a valve and early diodes were actually called valves.

4.3.2 Forward Voltage

Electricity uses up a little energy pushing its way through the diode, rather like a
person pushing through a door with a spring. This means that there is a small voltage
across a conducting diode, it is called the forward voltage drop and is about 0.7V for
all normal diodes which are made from silicon. The forward voltage drop of a diode is
almost constant whatever the current passing through the diode so they have a very
steep characterstic (currenet-voltage graph).

20
Figure 4.5 A forward bias PN junction diode

4.3.3 Reverse Voltage

When a reverse voltage is applied a perfect diode does not conduct, but all real diodes
leak a very tiny current of a few uA or less. This can be ignored in most circuits
because it will be very much smaller than the current flowing in the forward direction.
However, all diodes have a maximum reverse voltage(usually 50V or more) and if this
is exceeded the diode will fail and pass a large current in the reverse direction, this is
called breakdown.

Ordinary diodes can be split into two types:

 Signal diodes, which pass small currents of 100mA or less.


 Rectifier diode, which can pass large currents.

Figure.4.6 A
reverse biased PN junction
diode

4.3.4 Biasing

4.3.4.1 Forward biasing

It is an external voltage that is applied to a PN junction to reduce its barrier and,


therefore aid current flow through the junction. To accomplish this function,the
external voltage is connected so that it opposes the electrostatic field of the junction.

21
Figure.4.7 Internal diagram of forward biased PN junction

4.3.4.2 Reverse biasing

It is an external voltage that is connected across a PN junction so that its voltage aids
the junction and thereby, offers a high resistance to the current flow through the
junction.

Figure.4.8 Internal diagram of reverse biased PN junction

4.3.5 V-I Characterstics

The charcterstics are plotted under three heads: Zero external voltage, forward
biasing, reverse biasing. From the chracterstics following points may be noted:

 At Zero external voltage,no current flows through the circuit or diode.


 At forward bias ,the current increases slightly the barrier potential is wiped-
off.
 After knee voltage,the forward current rise abruptly.

22
 The forward current is limited by series resistance and a small value of
junction resistance. If the forward current increase beyond the rated value of
the diode, the diode may be destroyed.
 At reverse bias, the reverse current increases slightly with the increase in
voltage because of the minority carriers. For silicon the maximum value of
reverse current is low as 1uA. However, for Ge, it is about 100uA.
 At a certain reverse voltage, the reverse current rises abruptly to a large value.
It is because at this voltage the junction breaks and the resistance of the barrier
region falls suddenly.
 Breakdown voltage is the reverse votage at which pn junction breaks. At
reverse votage, when the junction breaks the diode may be destroyed.

Figure 4.9 characteristics of PN junction diode

4.4 Oscillator Circuit

Oscillator circuit is the heart of the 8051 microcontroller. The 8051 has an on chip
oscillator but it requires an external clock to run it.
Most often a quartz crystal oscillator is connected to inputs XTAL1(Pin 19) and
XTAL2(Pin 18).The a quartz crystal oscillator connected to inputs XTAL1 and
XTAL2 requires two capacitors of 30pF each.One side of each capacitor is connected
to ground.

23
Figure 4.10: Crystal connection to 8051

4.5 Resistor

A linear resistor is a linear, passive two-terminal electrical component that


implements electrical resistance as a circuit element. The current through a resistor is
in direct proportion to the voltage across the resistor's terminals. Thus, the ratio of the
voltage applied across a resistor's terminals to the intensity of current through the
circuit is called resistance.
This relation is represented by Ohm's law:
I= V/R.
Resistors are common elements of electrical networks and electronic circuits and are
ubiquitous in most electronic equipment. Practical resistors can be made of various
compounds and films, as well as resistance wire (wire made of a high-resistivity alloy,

24
such as nickel-chrome). Resistors are also implemented within integrated circuits,
particularly analog devices, and can also be integrated into hybrid and printed circuits.
The electrical functionality of a resistor is specified by its resistance: common
commercial resistors are manufactured over a range of more than nine orders of
magnitude. When specifying that resistance in an electronic design, the required
precision of the resistance may require attention to the manufacturing tolerance of the
chosen resistor, according to its specific application. The temperature coefficient of
the resistance may also be of concern in some precision applications. Practical
resistors are also specified as having a maximum power rating which must exceed the
anticipated power dissipation of that resistor in a particular circuit: this is mainly of
concern in power electronics applications. Resistors with higher power ratings are
physically larger and may require heat sinks. In a high-voltage circuit, attention must
sometimes be paid to the rated maximum working voltage of the resistor.
Practical resistors have a series inductance and a small parallel capacitance; these
specifications can be important in high-frequency applications. In a low-noise
amplifier or pre-amp, the noise characteristics of a resistor may be an issue. The
unwanted inductance, excess noise, and temperature coefficient are mainly dependent
on the technology used in manufacturing the resistor. They are not normally specified
individually for a particular family of resistors manufactured using a particular
technology.[1] A family of discrete resistors is also characterized according to its form
factor, that is, the size of the device and the position of its leads (or terminals) which
is relevant in the practical manufacturing of circuits using them.
Units:
The behavior of an ideal resistor is dictated by the relationship specified by Ohm's
law:
Ohm's law states that the voltage (V) across a resistor is proportional to the current
(I), where the constant of proportionality is the resistance (R).
Equivalently, Ohm's law can be stated:
This formulation states that the current (I) is proportional to the voltage (V) and
inversely proportional to the resistance (R). This is directly used in practical
computations. For example, if a 300 ohm resistor is attached across the terminals of a
12 volt battery, then a current of 12 / 300 = 0.04 amperes (or 40 milliamperes) occurs
across that resistor.

25
Power dissipation:
The power P dissipated by a resistor (or the equivalent resistance of a resistor
network) is calculated as:

Construction:
1) Lead arrangements
Through-hole components typically have leads leaving the body axially.
Others have leads coming off their body radially instead of parallel to the
resistor axis. Other components may be SMT (surface mount technology)
while high power resistors may have one of their leads designed into the heat
sink.
2) Carbon Composition
Carbon composition resistors consist of a solid cylindrical resistive element
with embedded wire leads or metal end caps to which the lead wires are
attached. The body of the resistor is protected with paint or plastic. Early 20th-
century carbon composition resistors had uninsulated bodies; the lead wires
were wrapped around the ends of the resistance element rod and soldered. The
completed resistor was painted for color coding of its value.

The resistive element is made from a mixture of finely ground (powdered)


carbon and an insulating material (usually ceramic). A resin holds the mixture
together. The resistance is determined by the ratio of the fill material (the
powdered ceramic) to the carbon. Higher concentrations of carbon, a weak
conductor, result in lower resistance. Carbon composition resistors were
commonly used in the 1960s and earlier, but are not so popular for general use
now as other types have better specifications, such as tolerance, voltage
dependence, and stress (carbon composition resistors will change value when
stressed with over-voltages). Moreover, if internal moisture content (from
exposure for some length of time to a humid environment) is significant,
soldering heat will create a non-reversible change in resistance value. Carbon
composition resistors have poor stability with time and were consequently
factory sorted to, at best, only 5% tolerance.[4] These resistors, however, if
26
never subjected to overvoltage nor overheating were remarkably reliable
considering the component's size.

4.6 Capacitors

A capacitor (formerly known as condenser) is a passive two-terminal electrical


component used to store energy in an electric field. The forms of practical capacitors
vary widely, but all contain at least two electrical conductors separated by a dielectric
(insulator). Capacitors are used as parts of electrical systems, for example, consist of
metal foils separated by a layer of insulating film.
When there is a potential difference (voltage) across the conductors, a static electric
field develops across the dielectric, causing positive charge to collect on one plate and
negative charge on the other plate. Energy is stored in the electrostatic field. An ideal
capacitor is characterized by a single constant value, capacitance, measured in farads.
This is the ratio of the electric charge on each conductor to the potential difference
between them.
The capacitance is greatest when there is a narrow separation between large areas of
conductor, hence capacitor conductors are often called "plates," referring to an early
means of construction. In practice, the dielectric between the plates passes a small
amount of leakage current and also has an electric field strength limit, resulting in a
breakdown voltage, while the conductors and leads introduce an undesired inductance
and resistance.
Capacitors are widely used in electronic circuits for blocking direct current while
allowing alternating current to pass, in filter networks, for smoothing the output of
power supplies, in the resonant circuits that tune radios to particular frequencies and
for many other purposes.

4.7 Battery

An electrical battery is one or more electrochemical cells that convert stored chemical
energy into electrical energy. Since the invention of the first battery (or "voltaic pile")
in 1800 by Alessandro Volta, batteries have become a common power source for
many household and industrial applications. According to a 2005 estimate, the
27
worldwide battery industry generates US$48 billion in sales each year, with 6%
annual growth.
There are two types of batteries: primary batteries (disposable batteries), which are
designed to be used once and discarded, and secondary batteries (rechargeable
batteries), which are designed to be recharged and used multiple times. Batteries come
in many sizes, from miniature cells used to power hearing aids and wristwatches to
battery banks the size of rooms that provide standby power for telephone exchanges
and computer data centers.

Principle of operation
A battery is a device that converts chemical energy directly to electrical energy.It
consists of a number of voltaic cells; each voltaic cell consists of two half cells
connected in series by a conductive electrolyte containing anions and cations. One
half-cell includes electrolyte and the electrode to which anions (negatively charged
ions) migrate, i.e., the anode or negative electrode; the other half-cell includes
electrolyte and the electrode to which cations (positively charged ions) migrate, i.e.,
the cathode or positive electrode. In the redox reaction that powers the battery, cations
are reduced (electrons are added) at the cathode, while anions are oxidized (electrons
are removed) at the anode. The electrodes do not touch each other but are electrically
connected by the electrolyte. Some cells use two half-cells with different electrolytes.
A separator between half cells allows ions to flow, but prevents mixing of the
electrolytes.
Each half cell has an electromotive force (or emf), determined by its ability to drive
electric current from the interior to the exterior of the cell. The net emf of the cell is
the difference between the emfs of its half-cells, as first recognized by Volta.
Therefore, if the electrodes have emfs and , then the net emf is ; in other words, the
net emf is the difference between the reduction potentials of the half-reactions.
The electrical driving force or across the terminals of a cell is known as the terminal
voltage (difference) and is measured in volts. The terminal voltage of a cell that is
neither charging nor discharging is called the open-circuit voltage and equals the emf
of the cell. Because of internal resistance, the terminal voltage of a cell that is
discharging is smaller in magnitude than the open-circuit voltage and the terminal
voltage of a cell that is charging exceeds the open-circuit voltage. An ideal cell has

28
negligible internal resistance, so it would maintain a constant terminal voltage of
until exhausted, then dropping to zero. If such a cell maintained 1.5 volts and stored a
charge of one coulomb then on complete discharge it would perform 1.5 joule of
work.In actual cells, the internal resistance increases under discharge, and the open
circuit voltage also decreases under discharge. If the voltage and resistance are plotted
against time, the resulting graphs typically are a curve; the shape of the curve varies
according to the chemistry and internal arrangement employed.
As stated above, the voltage developed across a cell's terminals depends on the energy
release of the chemical reactions of its electrodes and electrolyte. Alkaline and
carbon-zinc cells have different chemistries but approximately the same emf of 1.5
volts; likewise NiCd and NiMH cells have different chemistries, but approximately
the same emf of 1.2 volts.On the other hand the high electrochemical potential
changes in the reactions of lithium compounds give lithium cells emfs of 3 volts or
more.

4.8 Micros witches

A miniature snap-action switch, also trademarked and frequently known as a micro


switch, is an electric switch that is actuated by very little physical force, through the
use of a tipping-point mechanism, sometimes called an "over-center" mechanism.
Switching happens reliably at specific and repeatable positions of the actuator, which
is not necessarily true of other mechanisms. They are very common due to their low
cost and durability, greater than 1 million cycles and up to 10 million cycles for heavy
duty models. This durability is a natural consequence of the design.

The defining feature of micro switches is that a relatively small movement at the
actuator button produces a relatively large movement at the electrical contacts, which
occurs at high speed (regardless of the speed of actuation). Most successful designs
also exhibit hysteresis, meaning that a small reversal of the actuator is insufficient to
reverse the contacts; there must be a significant movement in the opposite direction.
Both of these characteristics help to achieve a clean and reliable interruption to the
switched circuit.

Micro switches are very widely used; among their applications are appliances,
machinery, industrial controls, vehicles, and many other places for control of
29
electrical circuits. They are usually rated to carry current in control circuits only,
although some switches can be directly used to control small motors, solenoids,
lamps, or other devices.

Figure 4.11 Micro switch

4.9 IC1 7806

It is a voltage regulator meant to give regulated 6V supply when provided with


suitable input.

The 78xx (sometimes LM78xx) is a family of self-contained fixed linear voltage


regulator integrated circuits. The 78xx family is commonly used in electronic circuits
requiring a regulated power supply due to their ease-of-use and low cost. For ICs
within the family, the xx is replaced with two digits, indicating the output voltage (for
example, the 7805 has a 5 volt output, while the 7812 produces 12 volts). The 78xx
line are positive voltage regulators: they produce a voltage that is positive relative to a
common ground. There is a related line of79xx devices which are complementary
negative voltage regulators. 78xx and 79xx ICs can be used in combination to provide
positive and negative supply voltages in the same circuit.

78xx ICs have three terminals and are commonly found in the TO220 form factor,
although smaller surface-mount and larger TO3 packages are available. These devices
support an input voltage anywhere from a couple of volts over the intended output
voltage, up to a maximum of 35 or 40 volts, and typically provide 1 or
1.5 amperes of current (though smaller or larger packages may have a lower or higher
current rating).

Advantages

 78xx series ICs do not require additional components to provide a constant,


regulated source of power, making them easy to use, as well as economical and

30
efficient uses of space. Other voltage regulators may require additional
components to set the output voltage level, or to assist in the regulation process.
Some other designs (such as a switching power supply) may need substantial
engineering expertise to implement.

 78xx series ICs have built-in protection against a circuit drawing too much
power. They have protection against overheating and short-circuits, making them
quite robust in most applications. In some cases, the current-limiting features of
the 78xx devices can provide protection not only for the 78xx itself, but also for
other parts of the circuit.

Disadvantages

 The input voltage must always be higher than the output voltage by some
minimum amount (typically 2 volts). This can make these devices unsuitable for
powering some devices from certain types of power sources (for example,
powering a circuit that requires 5 volts using 6-volt batteries will not work using a
7805).

 As they are based on a linear regulator design, the input current required is
always the same as the output current. As the input voltage must always be higher
than the output voltage, this means that the total power (voltage multiplied by
current) going into the 78xx will be more than the output power provided. The
extra input power is dissipated as heat. This means both that for some applications
an adequate heatsink must be provided, and also that a (often substantial) portion
of the input power is wasted during the process, rendering them less efficient than
some other types of power supplies. When the input voltage is significantly higher
than the regulated output voltage (for example, powering a 7805 using a 24 volt
power source), this inefficiency can be a significant issue.

 Even in larger packages, 78xx integrated circuits cannot supply as much


power as many designs which use discrete components, and are generally
inappropriate for applications requiring more than a few amperes of current.

31
In spite of the above mentioned disadvantes, these are widely used for voltage
regulation as their advantages hold good over disadvantages.

4.10 Relay

A relay is an electrically operated switch. Many relays use an electromagnet to


operate a switching mechanism mechanically, but other operating principles are also
used. Relays are used where it is necessary to control a circuit by a low-power signal
(with complete electrical isolation between control and controlled circuits), or where
several circuits must be controlled by one signal. The first relays were used in long
distance telegraph circuits, repeating the signal coming in from one circuit and re-
transmitting it to another. Relays were used extensively in telephone exchanges and
early computers to perform logical operations.
A type of relay that can handle the high power required to directly control an electric
motor is called a contactor. Solid-state relays control power circuits with no moving
parts, instead using a semiconductor device to perform switching. Relays with
calibrated operating characteristics and sometimes multiple operating coils are used to
protect electrical circuits from overload or faults; in modern electric power systems
these functions are performed by digital instruments still called "protective relays"

4.10.1Basic Operation:

A simple electromagnetic relay consists of a coil of wire surrounding 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.

32
Figure 4.12 Relay

When an electric current is passed through the coil it generates a magnetic field that
attracts 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 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.[1]

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
33
(a light-emitting diode (LED) coupled with a photo transistor) can be used to isolate
control and controlled circuits.
4.10.2 Pole and throw
Since relays are switches, the terminology applied to switches is also applied to
relays. A relay will switch one or more poles, each of whose contacts can be thrown
by energizing the coil in one of three ways:
Normally-open (NO) contacts connect the circuit when the relay is activated; the
circuit is disconnected when the relay is inactive. It is also called a Form A contact or
"make" contact. NO contacts can also be distinguished as "early-make" or NOEM,
which means that the contacts will close before the button or switch is fully engaged.
Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the
circuit is connected when the relay is inactive. It is also called a Form B contact or
"break" contact. NC contacts can also be distinguished as "late-break" or NCLB,
which means that the contacts will stay closed until the button or switch is fully
disengaged.
Change-over (CO), or double-throw (DT), contacts control two circuits: one
normally-open contact and one normally-closed contact with a common terminal. It is
also called a Form C contact or "transfer" contact ("break before make"). If this type
of contact utilizes”make before break" functionality, then it is called a Form D
contact.

Figure 4.13 Function of Relay


The following designations are commonly encountered:
SPST – Single Pole Single Throw. These have two terminals which can be connected
or disconnected. Including two for the coil, such a relay has four terminals in total. It

34
is ambiguous whether the pole is normally open or normally closed. The terminology
"SPNO" and "SPNC" is sometimes used to resolve the ambiguity.
SPDT – Single Pole Double Throw. A common terminal connects to either of two
others. Including two for the coil, such a relay has five terminals in total.
DPST – Double Pole Single Throw. These have two pairs of terminals. Equivalent to
two SPST switches or relays actuated by a single coil. Including two for the coil, such
a relay has six terminals in total. The poles may be Form A or Form B .
DPDT – Double Pole Double Throw. These have two rows of change-over terminals.
Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay has
eight terminals, including the coil.
The "S" or "D" may be replaced with a number, indicating multiple switches
connected to a single actuator. For example 4PDT indicates a four pole double throw
relay (with 14 terminals).

4.10.3 Applications:

Relays are used to and for:


 Amplify a digital signal, switching a large amount of power with a small
operating power.
 Detect and isolate faults on transmission and distribution lines by opening and
closing circuit breakers (protection relays).
 Isolate the controlling circuit from the controlled circuit when the two are at
different potentials, for example when controlling a mains-powered device
from a low-voltage switch. The latter is often applied to control office lighting
as the low voltage wires are easily installed in partitions, which may be often
moved as needs change. They may also be controlled by room occupancy
detectors in an effort to conserve energy.
 Safety-critical logic. Because relays are much more resistant than
semiconductors to nuclear radiation, they are widely used in safety-critical
logic, such as the control panels of radioactive waste-handling machinery.
 Time delay functions. Relays can be modified to delay opening or delay
closing a set of contacts. A very short (a fraction of a second) delay would use
a copper disk between the armature and moving blade assembly. Current
flowing in the disk maintains magnetic field for a short time, lengthening
35
release time. For a slightly longer (up to a minute) delay, a dashpot is used. A
dashpot is a piston filled with fluid that is allowed to escape slowly. The time
period can be varied by increasing or decreasing the flow rate. For longer time
periods, a mechanical clockwork timer is installed.

4.11 DTMF Decoder


4.11.1 Introduction

DTMF stands for Dual Tone Multiple Frequency. It is a tone consisting of two
frequencies superimposed. Individual frequencies are chosen such that it is easy to
design filters and easy to transmit the tones through a telephone line having
bandwidth of approximately 3.5 kHz. DTMF was not intended to be used for data
transfer, it was meant to be used for sending the control signals along the telephone
line. With standard decoders it is possible to send 10 beeps per second i.e., five bits
per second. DTMF standard specifies 50ms tones and 600ms duration between two
successive tone. The last column is not commonly seen in the telephones that is used,
but used by telephone exchanges quite often. Nowadays, DTMF is used for dialing
the numbers in telephones, configuring telephone exchanges etc.

Table 4.1 DTMF Keypad Frequencies

Hz 1209 1336 1477 1633

697 1 2 3 A

770 4 5 6 B

852 7 8 9 C

941 * 0 # D

A CB transreceiver of 2.7 MHz is normally used to send floating codes. DTMF was
designed to be able to send the codes using microphone. Each beep (or digit you dial
on the telephone) is composed of two concurrent frequencies, which are superimposed
on amplitude. The higher of the two frequencies is normally aloud by 4dB, and this
shift is termed as twist. If the twist is equal to 4dB, the higher frequency is loud by
4dB. If the lower frequency is loud, then the twist is said to be negative. Nowadays,

36
DTMF is used for dialing the numbers in telephones, configuring telephone
exchanges etc

4.11.2 Generating DTMF

DTMF signals can be generated through dedicated ICs or by using RC networks


connected to a microprocessor. MT8880 is an example of a dedicated IC. But getting
the latter method work is a bit difficult if high accuracy is needed. The crystal
frequency needs to be sacrificed for a non standard cycle length. Hence this method is
used for simple applications. Most often, a PIC micro could be used for the above
purpose.

4.11.3 Decoding DTMF

Detecting DTMF with satisfactory precision is a hard thing. Often, a dedicated IC


such as MT8870 is used for this purpose. It uses two 6th order band-pass filters using
switched capacitor filters and it suppresses any harmonics. Hence they can produce
pretty good sine waves from distorted input. Hence it is preferred. Again
microprocessors can also be used, but their application is limited.

4.11.4 MT8870

4.11.4.1 Introduction

MT8870 is a complete DTMF receiver integrating both the band split filter and the
digital decoder function. The filter section uses switched capacitor technique for high
and low group filters, the decoder uses a digital counting technique to detect and
decode all 16 DTMF tone pairs with 4 bit code. External component count is
minimized by on-chip provision of a differential input amplifier, clock oscillator and
latches 3 stable bus interfaces.

4.11.4.2Features

Following are the features of MT8870 decoder:

1. Complete DTMF receiver


37
2. Low power consumption

3. Internal gain setting amplifier

4. Adjustable guard time

5. Central office quality

6. Power down mode

7. Inhibit mode

4.11.4.3 Pin description

Pin no. Name Description

1 IN+ Non-Inverting Op-Amp (Input).

2 IN- Inverting Op-Amp (Input).

3 GS Gain select gives access to output of front and differential


amplifier of feedback register.
4 Vref Reference voltage(output) nominally Vdd/2 is used to bias
Input at mid rail.
5 INH Inihibit(Input).Logic high inhibits the detection of tones
representing characters A, B, C and D. This pin input is
internally pulled down.
6 PWDN Power Down(Input).Active high. Powers down the device and
inhibits the oscillator.
7 Osc1 Clock(input)
8 Osc2 Clock(output) a 3.579545 MHz crystal connected between
Osc1and Osc2 completes the internal oscillator circuits.
9 Vss Ground(input).0V typical.
10 TOE Three state output enable(input).Logic high. Enables the O/P
Q1-Q4.
11-14 Q1-Q4 Three state data(output). When enabled by TOE, provide the

38
code corresponding to the last valid tone pair received. When
TOE is 1 logic low the data ouput are high impedance.
15 Std Delayed sterring (output) presents a logic high when received
to tone-pair has been registered and the ouput latch updated.
Return to logic low when the voltage on St/GT falls below Vst
16 ESt Early sterring (input) presents a logic high once the digital
algorithm has detected a valid tone pair (signal condition).
Any momentarily loss of signal condition will cause ESt to
restart to a logic low
17 St/GT Sterring input/guard time (ouput) bidirectional. A voltage
greater than Vt/St detected tone pair and update the output
latch.A voltage less than Vt/St frees the device to accept a
new tone pair.
18 Vdd Positive power supply (input) +5V typical.
4.12 IR Sensors
A Passive measures infrared (IR) light radiating from objects in its field of view. PIR
sensors are often used in the construction of PIR-based motion (see below). Apparent
motion is detected when an infrared source with on temperature, such as a human,
passes in front of an infrared source with another temperature, such as a wall. This is
not to say that the sensor detects the heat from the object passing in front of it but that
the object breaks the field which the sensor has determined as the "normal" state. Any
object, even one exactly the same temperature as the surrounding objects will cause
the PIR to activate if it moves in the field of the sensors. Infrared sensor (PIR sensor)
is an electronic device that All objects above absolute zero emit energy in the form of
radiation. Usually infrared radiation is invisible to the human eye but can be detected
by electronic devices designed for such a purpose. The term passive in this instance
means that the PIR device does not emit an infrared beam but merely passively
accepts incoming infrared radiation. “Infra” meaning below our ability to detect it
visually, and “Red” because this color represents the lowest energy level that our eyes
can sense before it becomes invisible. Thus, infrared means below the energy level of
the color red, and applies to many sources of invisible energy.

4.12.1 Details about the IR Sensor


39
Based on a simple basic Idea, this proximity sensor, is easy to build, easy to calibrate
and still, it provides a detection range of 35 cm (range can change depending on the
ambient light intensity i.e. the range of the light intensity in surroundings of object).
This sensor can be used for most indoor applications where no important ambient
light is present. For simplicity, this sensor doesn't provide ambient light immunity but
a more complicated, ambient light ignoring sensor should be discussed in a coming
article. However, this sensor can be used to measure the speed of object moving at a
very high speed, like in industry or in tachometers. In such applications, ambient light
ignoring sensor, which rely on sending 40 Khz pulsed signals cannot be used because
there are time gaps between the pulses where the sensor is 'blind'. The solution
proposed doesn't contain any special components, like photo-diodes, photo-
transistors, or IR receiver ICs, only a couple of IR leds, an Op amp, a transistor and a
couple of resistors. In need, as the title says, a standard IR led is used for the
purpose of detection. Due to that fact, the circuit is extremely simple, and any novice
electronics hobbyist can easily understand and build it.

4.12.2 Working of IR Sensors


IR sensors are used to detect the presence of the objects. Its working is based on a
quite simple principle. It is the same principle in all Infra-Red proximity sensors. The
basic idea is to send infra red light through IR-LEDs, which is then reflected by any
object in front of the sensor. Then pick up the reflected IR light. For detecting the
reflected IR light, effective technique is used and that is to use another IR-LED, to
detect the IR light that was emitted from another led of the exact same type.This is an
electrical property of Light Emitting Diodes (LEDs) which is the fact that a led
Produce a voltage difference across its leads when it is subjected to light. As if it was
a photo-cell, but with much lower output current. In other words, the voltage
generated by the leds can't be – in any way - used to generate electrical power from
light, it can barely be detected.
CHAPTER 5
HARDWARE IMPLEMENTATION

5.1 Hardware Description

40
5.1.1 Component Used

The various components used in the project are listed as below:


S.No Component Name Quantity
1. Transformer(6-0-6 500 mA) 1
2. Capacitor 30 pF 2
3. Voltage regulator 7806 1
4. General Purpose PCB 1
5. Pin Connectors 2
6. Diodes 1N4007 6
7. Microcontroller 8051(AT89C52P6) 1
8. DTMF IC 1
9. Mobile Phones 2
10. Buzzer 1
Besides these some other equipments and materials were also used such as
Soldering iron and Solder wire

5.1.2 Circuit Modules

This project is divided into following modules


1. AC to DC conversion
2. IR sensor
3. Controller Section
4. DTMF Section

1) AC to DC Conversion:

The following are the circuit diagrams AC to DC Conversion.


.

41
Figure 5.1 AC to DC conversion

Transformers used here are Step down transformers. As output of transformer is AC,
so it gets converted into DC by using capacitor circuit. Above circuit shows output of
first module.

2) IR Sensor

IR senor will detect the blinking of eye and will send high to microcontroller for each
blink detected.

3) Microcontroller part

Microcontroller is the heart of the setup.

42
Figure 5.2 Pin diagram 8051
The microcontroller is getting its input from the IR sensor. For each blink it receives a
high signal. Side by side RTC i.e. real time clock is also working. For every 5 sec,
total number of blinks is counted by microcontroller. If the eye of driver blinks for
less than 3 times in 5 sec a high signal is send to buzzer. It alarms the driver.
Simultaneously microcontroller sends a high to DTMF section which makes a call to
the owner.
4) DTMF Section

This section is used to make a call to the owner to mark that driver is sleeping while
driving. When DTMF section receives a high, a call is made through the mobile at
the transmitter site i.e. vehicle to the receiver i.e owner on the pre stored contact
number. Contact number is stored in the microcontroller.

5.2 Tools and Platform Used

Various tools are used in this project are discussed here.

5.2.1 Printed Circuit Board


43
A printed circuit board, or PCB, is used to mechanically support and electrically
connect electronic components using conductive pathways, tracks or signal traces
etched from copper sheets laminated onto a non-conductive substrate. It is also
referred to as printed wiring board (PWB) or etched wiring board. A PCB populated
with electronic components is a printed circuit assembly (PCA), also known as a
printed circuit board assembly (PCBA). Printed circuit boards are used in virtually all
but the simplest commercially-produced electronic devices.
PCBs are inexpensive, and can be highly reliable. They require much more layout
effort and higher initial cost than either wire wrap or point-to-point construction, but
are much cheaper and faster for high-volume production; the production and soldering
of PCBs can be done by totally automated equipment. Much of the electronics
industry's PCB design, assembly, and quality control needs are set by standards that
are published by the IPC organization.
Materials Used:
Conducting layers are typically made of thin copper foil. Insulating layers dielectric
are typically laminated together with epoxy resin prepreg. The board is typically
coated with a solder mask that is green in color. Other colors that are normally
available are blue, black, white and red. There are quite a few different dielectrics that
can be chosen to provide different insulating values depending on the requirements of
the circuit. Some of these dielectrics are polytetrafluoroethylene (Teflon), FR-4, FR-1,
CEM-1 or CEM-3. Well known prepreg materials used in the PCB industry are FR-2
(Phenolic cotton paper), FR-3 (Cotton paper and epoxy), FR-4 (Woven glass and
epoxy), FR-5 (Woven glass and epoxy), FR-6 (Matte glass and polyester), G-10
(Woven glass and epoxy), CEM-1 (Cotton paper and epoxy), CEM-2 (Cotton paper
and epoxy), CEM-3 (Woven glass and epoxy), CEM-4 (Woven glass and epoxy),
CEM-5 (Woven glass and polyester). Thermal expansion is an important
consideration especially with ball grid array (BGA) and naked die technologies, and
glass fiber offers the best dimensional stability.
Here in below figure show images of Printed Circuit board

FR-4 is by far the most common material used today. The board with copper on it is
called "copper-clad laminate".

44
Copper foil thickness can be specified in ounces per square foot or micrometres. One
ounce per square foot is 1.344 mils or 34 micrometres.

5.2.2 Soldering Iron

A soldering iron is a hand tool most commonly used in soldering. It supplies heat to
melt the solder so that it can flow into the joint between two workpieces.
A soldering iron is composed of a heated metal tip and an insulated handle. Heating is
often achieved electrically, by passing an electric current (supplied through an
electrical cord or battery cables) through the resistive material of a heating element.
Another heating method includes combustion of a suitable gas, which can either be
delivered through a tank mounted on the iron (flameless), or through an external
flame.
Less common uses include pyrography (burning designs into wood) and plastic
welding.
Soldering irons are most often used for installation, repairs, and limited production
work. High-volume production lines use other soldering methods

Tips while using Soldering Iron:


Some soldering irons have interchangeable tips, also known as bits, that vary in size
and shape for different types of work.[2] Pyramid tips with a triangular flat face and
chisel tips with a wide flat face are useful for soldering sheet metal. Fine conical or
tapered chisel tips are typically used for electronics work.
Older and very cheap irons typically use a bare copper tip, which is shaped with a file
or sandpaper. This dissolves gradually into the solder, suffering pitting and erosion of
the shape. Copper tips are sometimes filed when worn down. Iron-plated copper tips
have become increasingly popular since the 1980s. Because iron is not readily
dissolved by molten solder, the plated tip is more durable than a bare copper one. This
is especially important when working at the higher temperatures needed for modern
lead-free solders. Solid iron and steel tips are seldom used because they store less
heat, and rusting can break the heating element.
Cleaning:
When burnt flux and oxidized material begin to accumulate on the tip, they can block
heat transfer and contaminate joints, making soldering difficult or impossible.
45
Therefore, the tips are periodically cleaned. Many soldering stations come with
cellulose sponges which are dampened and used to wipe a hot iron's tip clean. A wire
brush, preferably brass or wire wheel (mounted on a bench grinder), is sometimes
carefully used to remove very severe oxidation, though this may risk damaging the
tip's protective iron plating. A small amount of fresh solder is usually then applied to
the clean tip in a process called tinning. The working surface of the tip is usually kept
tinned (coated with wet solder) to minimize oxidation. Oxidation blocks heat transfer,
corrodes the tip, and contaminates the joint

5.2.3 Soldering Wire

Solder (usually pronounced /sɒldər/, /soʊdər/ or in USA /sɒdər/) is a fusible metal


alloy used to join together metal workpieces and having a melting point below that of
the workpiece(s).
Soft solder is what is most often thought of when solder or soldering are mentioned
and it typically has a melting range of 90 to 450 °C (190 to 840 °F). It is commonly
used in electronics and plumbing. Alloys that melt between 180 and 190 °C (360 and
370 °F) are the most commonly used. By definition, using alloys with melting point
above 450 °C (840 °F) is called 'hard soldering', 'silver soldering' or brazing. Soft
solder can contain lead and/or flux but in many applications lead free solder is used.
Perhaps the most common and most familiar form of solder is as a wire or rod, though
plumbers often use bars of solder while jewelers often use solder in thin sheets which
they cut into snippets. Solder can also come in a paste or as a preformed foil shaped to
match the workpiece. The word solder comes from the Middle English word soudur,
via Old French solduree and soulder, from the Latin solidare, meaning "to make
solid".
Eutectic alloys melt at a single temperature. Non-eutectic alloys have markedly
different solidus and liquidus temperature, and within that range they exist as a paste
of solid particles in a melt of the lower-melting phase. The pasty state causes some
problems during handling; it can however be exploited as it allows molding of the
solder during cooling, e.g. for ensuring watertight joint of pipes, resulting in a so
called 'wiped joint'.
With the reduction of the size of circuit board features, the size of interconnects
shrinks as well. Current densities above 104 A/cm2 are often achieved and
46
electromigration becomes a concern. At such current densities the Sn63Pb37 solder
balls form hillocks on the anode side and voids on the cathode side; the increased
content of lead on the anode side suggests lead is the primary migrating species.
Lead solder
Tin/lead solders, also called soft solders, are commercially available with tin
concentrations between 5% and 70% by weight. The greater the tin concentration, the
greater the solder’s tensile and shear strengths. At the retail level, the two most
common alloys are 60/40 Tin/lead (Sn/Pb) which melts at 370 °F or 188 °C and 63/37
Sn/Pb used principally in electrical/electronic work. The 63/37 ratio is notable in that
it is a eutectic mixture, which means:
1) It has the lowest melting point (183 °C or 361.4 °F) of all the tin/lead alloys;
and
2) The melting point is truly a point — not a range.
In plumbing, a higher proportion of lead was used, commonly 50/50. This had the
advantage of making the alloy solidify more slowly, so that it could be wiped over the
joint to ensure watertightness, the pipes being physically fitted together before
soldering. Although lead water pipes were displaced by copper when the significance
of lead poisoning began to be fully appreciated, lead solder was still used until the
1980s because it was thought that the amount of lead that could leach into water from
the solder was negligible from a properly soldered joint. The electrochemical couple
of copper and lead promotes corrosion of the lead and tin, however tin is protected by
insoluble oxide. Since even small amounts of lead have been found detrimental to
health, lead in plumbing solder was replaced by silver (food grade applications) or
antimony, with copper often added, and the proportion of tin was increased (see Lead-
free solder.)
The addition of tin improves wetting properties of the alloy; lead itself has poor
wetting characteristics. Tin however increases the cost of the solder. High-tin tin-lead
alloys have limited use as the workability range can be provided by a cheaper high-
lead alloy.
In electronics, printed circuit boards use solder joints to mount components and create
a circuit. For miniaturised PCB joints with surface mount components, solder paste
has largely replaced solid solder.

47
5.3 Circuit Diagram

Figure 5.3: Circuit Diagram

48
CHAPTER 6
RESULT AND DISCUSSION

6.1 Response Time of System

The Microcontroller based Eye Blink Detector system proves to be a real time
feedback control system which monitors and controls sleeping habits of the drivers.
The controller controls all activities in few milliseconds which is indeed a very fast
response for practical applications. The setup is designed to be efficient enough to
detect eye blink.

6.2 Discussion

This project can be used at various purposes say for automatic monitoring of driver
mainly required during night journeys. Its smaller version can be used by student to
keep a check on their own sleeping habits. On the other hand, when designed on
larger scale this project can easily be implemented in factories, offices etc for keeping
an eye on the workers.
This project introduces the notion of eye blink detection within the context of
embedded design and DTMF. More specifically, it provides the microcontroller based
eye blink detection and wireless DTMF based informing system.

6.3 Conclusion

Eye Blink Detector presents a fast, robust and yet cheap set up to detect whether the
person is sleeping or not. Some other automated systems are also offered so far but
most of the method has some shortness in practice. This project tries to overcome
these problems and implement an efficient automated Eye Blink detection and
awakening (Through buzzer) system. The present proposal is a model to modernize
the Eye Blink Detection system with optimum expenditure. Using this system, one
can save manpower and along with that mishaps can be avoided which can occur on
account of dozing driver. Thus saves life as well as money.

49
CHAPTER 7
APPLICATIONS AND FUTURE SCOPE

7.1 Applications

This project is very useful. It removes the need of constant human monitoring of
driver required during a night journey.
Microcontroller monitored Eye Blink Detector has following advantages:
1. This is of much use in trains. As almost 38% accidents occurs due to dozing habits
of drivers. So this will reduce accidents manifold and will save human life and
property.
2. This is helpful for taxi owners to keep an eye on the sleeping habits of their drivers
that too from a far off location by the virtue of DTMF. Simultaneously it will avoid
any mishap that can occur due to dozing driver.

7.2 Future Scope

It has vast scope in future. With few changes it can be implemented in offices also to
avoid the incidences where employs are found sleeping during working hours.
Addition of wireless camera will make the setup more sophisticated.

REFERENCES
50
[1]http://www.google.co.in/#sclient=psyb&hl=en&source=hp&q=microcontroller+A
T89C52P6+pin+diagram&pbx=1&oq=microcontroller+AT89C52P6
[2] www.electricalprojects.com
[3] Basic electronics by J.B Gupta.
[4]http://www.sensorsmag.com/sensors/acoustic-ultrasound/choosing-ultrasonic-
sensor-proximity-or-distance-measurement-825

APPENDIX A

51
MICROCONTROLLER 8051 DATASHEET

52
53
APPENDIX B

CODING

#include”reg51.h”

#include”gsm.h”

#include”buzzer.h”

main()

Initialize();

uppar:

Buzzer=1; //Initially Buzzer Off

delay_ms(5000); //5 seconds delay

if(count<2)

Buzzer=0; //Buzzer gets activate

Call=0;

delay_ms(200);

Call=1;

while(1);

54
}

else

count=0;

goto uppar;

55