Вы находитесь на странице: 1из 66

CHAPTER 1

INTRODUCTION
The cell phone security system is the result of a fusion of a creative idea with an
attempt to motivate change. Even though modern technology has allowed for the
automation of many aspects of domestic lifestyles, from automatic motion sensing
lights to automatic garage door openers, home security has not seen much benefit
from this revolution. Household entry has long been a very manual routine with little
effort to automate the process.
Entry into a residence is still primarily limited to a manual process which involves
inserting a key into a bolt and physically moving the locking mechanism. The cell
phone security system aims to change this. The system takes advantage of the
widespread acceptance of cell phones in todays society in conjunction with the deeprooted standards of the landline telephone network to introduce automation and
convenience. The system will allow a user to use their cell phone to place a call into
their home security system. Once the system verifies the caller, the caller is then allowed
to attempt a password entry.Upon successfully entering a password, the system will
automatically unlock the door and grant entrance.

1.1 OBJECTIVE:
The main objective of this project is to unlock a door by a mobile phone using a unique
password entered through the keypad of the phone. Opening and closing of doors
involves human labor. In this proposed system, the opening and closing of a door is
achieved by using a mobile phone. The owner can call to a mobile phone interfaced to the
system which in turn is connected to the door that can open/close the door by entering the
password. This method is very convenient as one doesnt have to get down of his car to
open/close the door physically.
This project is based on the concept of DTMF (dual tone multi - frequency). Every
numeric button on the keypad of a mobile phone generates a unique frequency when

pressed. These frequencies are decoded by the DTMF decoder IC at the receiving end
which is fed to the microcontroller. If these decoded values (password entered by the
user) matches with the password stored in the microcontroller, then the microcontroller
initiates a mechanism to open the door through a motor driver interface.

1.2 MAIN IDEA:


DTMF signaling is used for telephone signaling over the line in the voice-frequency band
to the call switching centre. The version of DTMF used for telephone tone dialing is
known as Touch-Tone. DTMF assigns a specific frequency (consisting of two separate
tones) to each key so that it can easily be identified by the electronic circuit. The signal
generated by the DTMF decoder is a direct algebraic summation, in real time, of the
amplitudes of two sine (cosine) waves of different frequencies, i.e., pressing 5 will send
a tone.
Dial your number using DTMF phone or Cell phone from anywhere in the world and
remotely turn on/off the relay. The MCU on the interface senses Telephone ring,
Automatic telephone pick up, and line hang up. This interface uses the popular MT8870
DTMF decoder IC along with pic16f887 Microcontroller. Here is a circuit that lets you
operate your industrial equipment like motors from your office or any other remote place.
So if you forgot to switch off the motors while going out, it helps you to turn off the
motors with your cell phone. Your cell phone works as remote control to your industrial
equipment. You can control the desired equipment by presetting the corresponding key.

1.3 PROJECT DESCRIPTION:


The use of microprocessor or micro-controller involves complexities like microprocessor
operating voltages; interrupt servicing, poling, memory access mechanism and extensive
soldering. Moreover, if we use micro-controller or a microprocessor we cant change the
working as and when desired. The problem being, while using them we have to hardwire
the code into ROM chips and in case we need to amend we have to burn a new ROM
chip to replace the earlier one. DTMF decoder is used for decoding the DTMF signals

coming from the transmitter end. When a short circuit connection is established between
the two wires then DTMF signals are received from the transmitting end and are decoded
at the receiving end by the DTMF decoder at receiver end. DTMF decoder will then gives
a BCD signal to the microcontroller and then a particular operation will start up by the
controller according to the signal send by the user from transmitting end.
Electrical isolator is a circuit which is used for generating switching signals for the
switching circuits to switch the devices attached to them. After the establishment of short
circuit will generates a signal according to the signal received from the transmitting end
and then the electrical isolator will generate a switching signal for the switching circuit
then that particular device is switched according to the need.
Virtually anything in the office that is powered by electricity can be automated and/or
controlled. We can control our electrical devices with our cordless phone from our easy
chair. We can turn our porch lights on automatically at dark or when someone approaches
and can see who is at the front door from any nearby machine, and talk to them or unlock
the door from any nearby telephone. Have the security system turn off lights, close drapes
and setback the temperature when we leave and turn on the alarm system. The
possibilities are only limited by our imagination.

CHAPTER 2
PROJECT WORK
In this dual tone multiple-frequency based door opening system an ICM8870 through a
required circuitry interfaced with microcontroller. When the signal comes from mobile
passng through IC M8870, as these are analog values these are connected with ADC, this
ADC is connected to micro controller so that it can acquire desired frequencies. The
corresponding value of frequency select their function and perform it. When there is any
problem occurs in motors or any other equipment want to off than we conrol it through
DTMF section. Microcontroller works on +5v power.

2.1 HARDWARE REQUIREMENT:


Micro controller(pic16f887)
Lm 7805(Regulator)
M8870 IC & L293D IC
Phone jack
330k resistance
Fourteen 1k resistance
Two 10k resistance
Dc geared motor(DVD loader)
LEDs
Cell Phone
Six .1 uf ceramic capacitors

One 100uF & One 1000 uF electrolytic capacitor


Two 22pF ceramic capacitors
Six p-n junction diodes
9-0-9 v 500mA transformer
Relay
Transistor
Quick switch
One 3.57MHz Crystal oscillator

2.2 SOFTWARE REQUIREMENT:


ORCAD for PCB designing
Pic C compiler
Tiny boot loader(program burn)

2.3 BLOCK DIAGRAM OF POWER SUPPLY:

Fig 2.1: Power supply

2.4 BLOCK DIAGRAM OF PROJECT:

Fig 2.2: Block Diagram of DTMF Based Door Opening System.


2.5 SCHEMATIC DIAGRAM:

SW 1

R 1

R ESET
C 1

J1

.1 u F

M C LR
1
2
3
4
5
6

C O N 6

VC C

VC C

10k

J3

1
1
1
1
1
1
1
1
1
1
2

C 2
.1 u F

1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0

R B7
R B6

40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21

1
2
3
4
5
VC C

C O N 5

J2

C O N 6
1
2
3
4
5
6

J4

1
2
3
4
5
6
7
8

C O N 2
1
2

J13

J8
VC C

1
1
1
1
1
1
1
9

6
5
4
3
2
1
0

VC C

L293D

P IC 1 6 F 8 8 7

VC C

J7
1

U 1
1

1
2

D IO D E

D IO D E

D 6

D 7

D IO D E

D IO D E

J10

C 3
.1 u F

V IN

C 4
1 0 0 0 u F /5 0 v

C O N 2

7805

G N D

D 4

VO U T

R 3
C 5

D 3

J9

1
1k

C 6
1 0 0 u F /2 5 v

.1 u F

D 5
LED

J11
1
C O N 1
1

J12
C O N 1

Fig 2.3: Schematic Diagram Of DTMF Door Opening System


2.6 PCB LAYOUT

Fig 2.4(a): Layout Of DTMF section

J5
1
2
C O N 2

Fig 2.4(b): Layout Of PIC & power supply


2.7 MICROCONTROLLER:
A microcontroller (or MCU) is a computer-on-a-chip used to control electronic devices. It
is a type of microprocessor emphasizing self-sufficiency and cost-effectiveness, in
contrast to a general-purpose microprocessor (the kind used in a PC). A typical
microcontroller contains all the memory and interfaces needed for a simple application,
whereas a general purpose microprocessor requires additional chips to provide these
functions.

2.7.1 INTRODUCTION:
Circumstances that we find ourselves in today in the field of microcontrollers had their
beginnings in the development of technology of integrated circuits. This development has
made it possible to store hundreds of thousands of transistors into one chip. That was a
prerequisite for production of microprocessors , and the first computers were made by
adding external peripherals such as memory, input-output lines, timers and other. Further
increasing of the volume of the package resulted in creation of integrated circuits. These
integrated circuits contained both processor and peripherals. That is how the first chip
containing a microcomputer , or what would later be known as a microcontroller came
about.

2.7.2 HISTORY:
It was year 1969, and a team of japanese engineers from the busicom company arrived to
united states with a request that a few integrated circuits for calculators be made using
their projects. the proposition was set to intel, and marcian hoff was responsible for the
project. since he was the one who has had experience in working with a computer (pc)
pdp8, it occured to him to suggest a fundamentally different solution instead of the
suggested construction. this solution presumed that the function of the integrated circuit
is determined by a program stored in it. that meant that configuration would be more
simple, but that it would require far more memory than the project that was proposed by
japanese engineers would require. after a while, though japanese engineers tried finding
an easier solution, marcian's idea won, and the first microprocessor was born. in
transforming an idea into a ready made product , frederico faggin was a major help to
intel. he transferred to intel, and in only 9 months had succeeded in making a product
from its first conception. intel obtained the rights to sell this integral block in 1971. First,
they bought the license from the busicom company who had no idea what treasure they
had. During that year, there appeared on the market a microprocessor called 4004. That
was the first 4-bit microprocessor with the speed of 6 000 operations per second. Not
long after that, American company CTC requested from INTEL and Texas Instruments to

make an 8-bit microprocessor for use in terminals. Even though CTC gave up this idea in
the end, Intel and Texas Instruments kept working on the microprocessor and in April of
1972, first 8-bit microprocessor appeard on the market under a name 8008. It was able to
address 16Kb of memory, and it had 45 instructions and the speed of 300 000 operations
per second. That microprocessor was the predecessor of all today's microprocessors. Intel
kept their developments up in April of 1974, and they put on the market the 8-bit
processor under a name 8080 which was able to address 64Kb of memory, and which had
75 instructions, and the price began at $360 microprocessors. At the WESCON exhibit in
United States in 1975, a critical event took place in the history of microprocessors. The
MOS Technology announced it was marketing microprocessors 6501 and 6502 at $25
each, which buyers could purchase immediately. This was so sensational that many
thought it was some kind of a scam, considering that competitors were selling 8080 and
6800 at $179 each. As an answer to its competitor, both Intel and Motorola lowered their
prices on the first day of the exhibit down to $69.95 per microprocessor. Motorola
quickly brought suit against MOS Technology and Chuck Peddle for copying the
protected 6800. MOS Technology stopped making 6501, but kept producing 6502. The
6502 was a 8-bit microprocessor with 56 instructions and a capability of directly
addressing 64Kb of memory. Due to low cost , 6502 becomes very popular, so it was
installed into computers such as: KIM-1, Apple I, Apple II, Atari, Comodore, Acorn,
Oric, Galeb, Orao, Ultra, and many others. Soon appeared several makers of 6502
(Rockwell, Sznertek, GTE, NCR, Ricoh, and Comodore takes over MOS Technology)
which was at the time of its prosperity sold at a rate of 15 million processors a year!
Others were not giving up though. Frederico Faggin leaves Intel, and starts his own Zilog
Inc.In 1976 Zilog announced the Z80. During the making of this microprocessor, Faggin
made a pivotal decision. Knowing that a great deal of programs have been already
developed for 8080, Faggin realized that many would stay faithful to that microprocessor
because of great expenditure which redoing of all of the programs would result in. Thus
he decided that a new processor had to be compatible with 8080, or that it had to be
capable of performing all of the programs which had already been written for 8080.
Beside these characteristics, many new ones have been added, so that Z80 was a very
powerful microprocessor in its time. It was able to address directly 64 Kb of memory, it

10

had 176 instructions, a large number of registers, a built in option for refreshing the
dynamic RAM memory, single-supply, greater speed of work etc. Z80 was a great
success and everybody converted from 8080 to Z80. It could be said that Z80 was
without a doubt commercially most successful 8-bit microprocessor of that time. Besides
Zilog, other new manufacturers like Mostek, NEC, SHARP, and SGS also appeared. Z80
was the heart of many computers like Spectrum, Partner, TRS703, Z-3. In 1976, Intel
came up with an improved version of 8-bit microprocessor named 8085. However, Z80
was so much better that Intel soon lost the battle. Altough a few more processors
appeared on the market (6809, 2650, SC/MP etc.), everything was actually already
decided. There weren't any more great improvements to make manufacturers convert to
something new, so 6502 and Z80 along with 6800 remained as main representatives of
the 8-bit microprocessors of that time.

2.7.3 MICROCONTROLLERS VERSUS MICROPROCESSOR:


Microcontroller differs from a microprocessor in many ways. First and the most
important is its functionality. In order for a microprocessor to be used, other components
such as memory, or components for receiving and sending data must be added to it. In
short that means that microprocessor is the very heart of the computer. On the other hand,
microcontroller is designed to be all of that in one. No other external components are
needed for its application because all necessary peripherals are already built into it. Thus,
we save the time and space needed to construct devices.

A microprocessor contains a control unit, ALU, and Registers

Limited to no I/O

A microcontroller contain a control unit, ALU, Registers, memory, I/O and


other peripherals inside the chip.

Both come in 8, 16, and 32 bit models

11

Difference is the number of bits that the processor can operate on in one
instruction.

2.8 INTRODUCTION TO PIC MICROCONTROLLER:


Circumstances that we find ourselves in today in the field of microcontrollers had their
beginnings in the development of technology of integrated circuits. This development has
made it possible to store hundreds of thousands of transistors into one chip. That was a
prerequisite for production of microprocessors, and the first computers were made by
adding external peripherals such as memory, input-output lines, timers and other. Further
increasing of the volume of the package resulted in creation of integrated circuits. These
integrated circuits contained both processor and peripherals. That is how the first chip
containing a microcomputer, or what would later be known as a microcontroller came
about.

2.8.1 PIC MICROCONTROLLER:


PIC is a family of Harvard architecture microcontrollers made by Microchip Technology,
derived from the PIC1640 originally developed by General Instrument's Microelectronics
Division. The name PIC initially referred to "Programmable Interface Controller .PICs
are popular with both industrial developers and hobbyists alike due to their low cost,
wide availability, large user base, extensive collection of application notes, availability of
low cost or free development tools, and serial programming (and re-programming with
flash memory) capability. The original PIC was built to be used with GI's new 16-bit
CPU, the CP1600. While generally a good CPU, the CP1600 had poor I/O performance,
and the 8-bit PIC was developed in 1975 to improve performance of the overall system
by offloading I/O tasks from the CPU. The PIC used simple microcode stored in ROM to
perform its tasks, and although the term wasn't used at the time, it is a RISC design that
runs one instruction per cycle (4 oscillator cycles). Over 120 million devices are sold
each year. The PIC microcontroller architecture is based on a modified Harvard RISC
(Reduced Instruction Set Computer) instruction set with dual-bus architecture, providing

12

fast and flexible design with an easy migration path from only 6 pins to 80 pins, and from
384 bytes to 128 Kbytes of program memory.PIC microcontrollers are available with
many different specifications depending on:

Memory Type

Flash

OTP (One-time-programmable)

ROM (Read-only-memory)

ROM less

InputOutput (I/O) Pin Count

Although there are many models of PIC microcontrollers, the nice thing is that they are
upward compatible with each other and a program developed for one model can very
easily, in many cases with no modifications, be run on other models of the family. The
basic assembler instruction set of PIC microcontrollers consists of only 33 instructions
and most of the family members (except the newly developed devices) use the same
instruction set. This is why a program developed for one model can run on another model
with similar architecture without any changes. All PIC microcontrollers offer the
following features:
RISC instruction set with only a handful of instructions to learn
Digital I/O ports
On-chip timer with 8-bit prescaler
Power-on reset
Watchdog timer
Power-saving SLEEP mode

13

High source and sink current


Direct, indirect, and relative addressing modes
External clock interface
RAM data memory
EPROM or Flash program memory
Although there are several hundred models of PIC microcontrollers, choosing a
microcontroller for an application is not a difficult task and requires taking into account
these factors:
Number of I/O pins required
Required peripherals (e.g., USART, USB)
The minimum size of program memory
The minimum size of RAM
Whether or not EEPROM nonvolatile data memory is required
Speed
Physical size
Cost
The important point to remember is that there could be many models that satisfy all of
these requirements. You should always try to find the model that satisfies your minimum
requirements and the one that does not offer more than you may need. For example, if
you require a microcontroller with only 8 I/O pins and if there are two identical
microcontrollers, one with 8 and the other one with 16 I/O pins, you should select the one

14

with 8 I/O pins.Although there are several hundred models of PIC microcontrollers, the
family can be broken down into three main groups, which are:
12-bit instruction word (e.g., 12C5XX, 16C5X)
14-bit instruction word (e.g., 16F8X, 16F87X)
16-bit instruction word (e.g., 17C7XX, 18C2XX)
All three groups share the same RISC architecture and the same instruction set, with a
few Additional instructions available for the 14-bit models and many more instructions
available For the 16-bit models. Instructions occupy only one word in memory, thus
increasing the code efficiency and reducing the required program memory. Instructions
and data are transferred on separate buses, so the overall system performance is
increased. The features of some microcontrollers in each group are given in the following
sections. The PIC architecture is characterized by the following features:

Separate code and data spaces (Harvard architecture) for devices other than
PIC32, which has a Von Neumann architecture.

A small number of fixed length instructions

Most instructions are single cycle execution (2 clock cycles), with one delay cycle
on branches and skips

One accumulator (W0), the use of which (as source operand) is implied (i.e. is not
encoded in the opcode)

All RAM locations function as registers as both source and/or destination of math
and other functions. A hardware stack for storing return addresses

A fairly small amount of addressable data space (typically 256 bytes), extended
through banking

Data space mapped CPU, port, and peripheral registers

15

The program counter is also mapped into the data space and writable (this is used
to implement indirect jumps).

There is no distinction between memory space and register space because the RAM
serves the job of both memory and registers, and the RAM is usually just referred to as
the register file or simply as the registers.

INSTRUCTION SET:
A PIC's instructions vary from about 35 instructions for the low-end PICs to over 80
instructions for the high-end PICs. The instruction set includes instructions to perform a
variety of operations on registers directly, the accumulator and a literal constant or the
accumulator and a register, as well as for conditional execution, and program branching.
Instructions for the low-ructions to perform a variety of operations on registers directly,
the accumulator and a literal constant or the accumulator and a register, as well as for
conditional execution, and program branching.

2.8.2 PERFORMANCE:
The architectural decisions are directed at the maximization of speed-to-cost ratio. The
PIC architecture was among the first scalar CPU designs and is still among the simplest
and cheapest. The Harvard architecturein which instructions and data come from
separate sourcessimplify timing and microcircuit design greatly, and this benefits clock
speed, price, and power consumption. The PIC instruction set is suited to implementation
of fast lookup tables in the program space. Such lookups take one instruction and two
instruction cycles. Many functions can be modeled in this way. Optimization is facilitated
by the relatively large program space of the PIC (e.g. 4096 x 14-bit words on the 16F690)
and by the design of the instruction set, which allows for embedded constants. For
example, a branch instruction's target may be indexed by W, and execute a "RETLW"
which does as it is named - return with literal in W.
Execution time can be accurately estimated by multiplying the number of instructions by
two cycles; this simplifies design of real-time code. Similarly, interrupt latency is

16

constant at three instruction cycles. External interrupts have to be synchronized with the
four clock instruction cycle; otherwise there can be a one instruction cycle jitter. Internal
interrupts are already synchronized. The constant interrupt latency allows PICs to achieve
interrupt driven low jitter timing sequences. An example of this is a video sync pulse
generator.

2.8.3 LIMITS:
The PIC architectures have several limits:

Only one accumulator

A small instruction set

Operations and registers are not orthogonal; some instructions can address RAM
and/or immediate constants, while others can only use the accumulator

Memory must be directly referenced in arithmetic and logic operations, although


indirect addressing is available via 2 additional registers

Register-bank switching is required to access the entire RAM of many devices.


The following limitations have been addressed in the PIC18, but still apply to
earlier cores.

Conditional skip instructions are used instead of conditional jump instructions


used by most other architectures

Indexed addressing mode is very rudimentary

Stack:

The hardware call stack is so small that program structure must often be flattened

The hardware call stack is not addressable, so pre-emptive task switching cannot
be implemented

17

Software-implemented stacks are

not

efficient,

so

it

is

difficult

to

generate reentrant code and support local variables

Program memory is not directly addressable, and thus space-inefficient and/or


time-consuming to access. (This is true of most Harvard architecture
microcontroller

Fig 2.5: 16F887 Pin Diagram

2.9 I/O PORTS:

18

There are as many as thirty-five general purpose I/O pins available. Depending on which
peripherals are enabled, some or all of the pins may not be available as general purpose
I/O. In general, when a peripheral is enabled, the associated pin may not be used as a
general purpose I/O pin.

2.9.1 PORTA AND THE TRISA REGISTERS:


PORTA is a 8-bit wide, bidirectional port. The corresponding data direction register is
TRISA setting a TRISA bit (= 1) will make the corresponding PORTA pin an input (i.e.,
disable the output driver). Clearing a TRISA bit (= 0) will make the corresponding
PORTA pin an output (i.e., enables output driver and puts the contents of the output latch
on the selected pin). Reading the PORTA register (Register 3-1) reads the status of the
pins, whereas writing to it will write to the PORT latch.

2.9.2 PORTB AND THE TRISB REGISTERS:


PORTB is an 8-bit wide, bidirectional port. The corresponding data direction register is
TRISB Setting a TRISB bit (= 1) will make the corresponding PORTB pin an input (i.e.,
put the corresponding output driver in a High-Impedance mode).Clearing a TRISB bit (=
0) will make the corresponding PORTB pin an output (i.e., enable the output driver and
put the contents of the output latch on the selected pin).Reading the PORTB register
reads the status of the pins, whereas writing to it will write to the PORT latch. All write
operations are read-modify-write operations. Therefore, a write to a port implies that the
port pins are read, this value is modified and then written.

2.9.3 PORTC AND TRISC REGISTERS:


PORTC is a 8-bit wide, bidirectional port. The corresponding data direction register is
TRISC Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input (i.e.,
put the corresponding output driver in a High-Impedance mode).Clearing a TRISC bit (=
0) will make the corresponding PORTC pin an output (i.e., enable the output driver and
put the contents of the output latch on the selected pin).Reading the PORTC register

19

reads the status of the pins, whereas writing to it will write to the PORT latch. All write
operations are read-modify-write operations. Therefore, a write to a port implies that the
port pins are read, this value is modified and then written

2.9.4 PORTD and TRISD REGISTERS:


PORTD(1) is a 8-bit wide, bidirectional port. The corresponding data direction register is
TRISD. Setting a TRISD bit (= 1) will make the corresponding PORTD pin an input (i.e.,
put the corresponding output driver in a High-Impedance mode).Clearing a TRISD bit (=
0) will make the corresponding PORTD pin an output (i.e., enable the output driver and
put the contents of the output latch on the selected pin).Reading the PORTD register
reads the status of the pins, whereas writing to it will write to the PORT latch. All write
operations are read-modify-write operations. Therefore, a write to a port implies that the
port pins are read, this value is modified and then written

2.9.5 PORTE AND TRISE REGISTERS:


PORTE(1) is a 4-bit wide, bidirectional port. The corresponding data direction register is
TRISE. Setting a TRISE bit (= 1) will make the corresponding PORTE pin an input (i.e.,
put the corresponding output driver in a High-Impedance mode). Clearing a TRISE bit (=
0) will make the corresponding PORTE pin an output (i.e., enable the output driver and
put the contents of the output latch on the selected pin). The exception is RE3,which is
input only and its TRIS bit will always read as1.Shows how to initialize PORTE.
Reading the PORTE register reads the status of the pins, whereas writing to it will write
to the PORT latch. All write operations are read-modify-write operations. Therefore, a
write to a port implies that the port pins are read, this value is modified and then written
to the PORT data latch.

2.10 CLOCK SOURCE MODES:


Clock Source modes can be classified as external or internal.

20

External Clock modes rely on external circuitry for the clock source. Examples are:
oscillator modules (EC mode), quartz crystal resonators or ceramic resonators .
Internal clock sources are contained internally within the oscillator module. The
oscillator module has two internal oscillators: the 8 MHz High-Frequency Internal
Oscillator (HFINTOSC) and the 31 kHz Low-Frequency Internal Oscillator .

2.11 TIMER0 MODULE:


The Timer0 module is an 8-bit timer/counter with the following features:
8-bit timer/counter register (TMR0)
8-bit pre-scalar (shared with Watchdog Timer)
Programmable internal or external clock source
Programmable external clock edge selection
Interrupt on overflow

2.11.1 TIMER1 MODULE WITH GATE CONTROL:


The Timer1 module is a 16-bit timer/counter with the following features:
16-bit timer/counter register pair (TMR1H:TMR1L)
Programmable internal or external clock source
3-bit pre-scalar
Optional LP oscillator
Synchronous or asynchronous operation
Timer1 gate (count enable) via comparator or T1G pin

21

Interrupt on overflow
Wake-up on overflow (external clock, Asynchronous mode only)
Time base for the Capture/Compare function

2.11.2 INTERNAL CLOCK SOURCE:


When the internal clock source is selected theTMR1H:TMR1L register pair will
increment on multiples of FOSC as determined by the Timer1 pre-scalar.

2.11.3 EXTERNAL CLOCK SOURCE:


When the external clock source is selected, the Timer1module may work as a timer or a
counter. When counting, Timer1 is incremented on the rising edge of the external clock
input T1CKI. In addition, the Counter mode clock can be synchronized to the
microcontroller system clock or run asynchronously. If an external clock oscillator is
needed (and the microcontroller is using the INTOSC without CLKOUT), Timer1 can
use the LP oscillator as a clock source.
Timer1 is enabled after POR or BOR Reset
A write to TMR1H or TMR1L
T1CKI is high when Timer1 is disabled and when Timer1 is enabled T1CKI is
low.

2.11.4 TIMER1 PRESCALER:


Timer1 has four pre-scalar options allowing 1, 2, 4 or 8divisions of the clock input. The
T1CKPS bits of theT1CON register control the pre-scale counter. The pre-scale counter is

22

not directly readable or writable, however, the pre-scalar counter is cleared upon a write
toTMR1H or TMR1L.

2.11.5 TIMER1 OSCILLATOR:


A low-power 32.768 kHz oscillator is built-in between pins T1OSI (input) and T1OSO
(amplifier output). The oscillator is enabled by setting the T1OSCEN control bit of the
T1CON register. The oscillator will continue to run during sleep. The Timer1 oscillator is
identical to the LP oscillator.

2.11.6 TIMER2 MODULE:


The Timer2 module is an eight-bit timer with the following features:
8-bit timer register (TMR2)
8-bit period register (PR2)
Interrupt on TMR2 match with PR2
.Software programmable pre-scalar (1:1, 1:4, 1:16)
Software programmable post-scalar (1:1 to 1:16)

2.12 COMPARATOR MODULE:


Comparators are used to interface analog circuits to a digital circuit by comparing two
analog voltages and providing a digital indication of their relative magnitudes. The
comparators are very useful mixed signal building blocks because they provide analog
functionality independent of the program execution. The analog comparator module
includes the following features:
Independent comparator control
Programmable input selection

23

Comparator output is available internally/externally


Programmable output polarity
Interrupt-on-change
Wake-up from Sleep
PWM shutdown

2.13 APPLICATIONS OF MICROCONTROLLER:


Telecom: Mobile phone systems (handsets and base stations), Modems,
Routers.
Automotive Applications: Traction control, Airbag release systems,
Engine-management

units,

Steer-by-wire

systems,

Cruise

control

applications.
Domestic Appliances: Dishwashers, Televisions, Washing Machines,
Microwave ovens, Video recorders, Security systems, Garage door
controllers, Calculators, Digital Watches, VCRs, Digital cameras, Remote
controls.
Robotic: Fire Fighting Robot, Automatic Floor Cleaner.
Aerospace applications: Flight Control System, Engine Controllers,
Autopilots, Passenger in-flight entertainment system.
Medical Equipment: An aesthesia monitoring system, ECG monitors,
Pacemakers, Drug delivery system, MRI scanner.
Defence system: Radar system, Fighter aircraft flight control system, Radio
system, Missile guidance system.

24

2.14 PCB (PRINTED CIRCUIT BOARD):


PCB stands for PRINTED CIRCUIT BOARD. Printed Circuit Board (PCB) provides
both the physical structure for mounting and holding the components as well as the
electrical interconnection between the components. That means a PCB or PWB (Printed
Wiring Board) is the platform upon which electronic components such as integrated
circuit chips and other components are mounted. The only difference between the PCB
and PWB is that in PWB the connections are given through the wiring but this case is not
valid for PCB.
PRINTED CIRCUIT BOARD is a component made up of one or more layers of
insulating materials with electrical conductors. An insulator is made up of various
materials that are based on fiberglass, ceramics, or plastics. During manufacturing the
that connects the electronic components.

2.14.1 TYPES OF PCB:


Generally PCB is available in given three types:

SINGLE SIDED PCBs

As the name suggests in these designs, the conductive pattern is only at in one side i.e. on
the one side of PCB components are mounted and on the other side soldering is
performed..

DOUBLE SIDED PCBs

These are the PCBs on which the conductive pattern is in both sides i.e. soldering and
mounting of the components can be done on either of the two sides.

MULTILAYER PCBs

In this case, the board consists of alternating layers of conducting pattern and insulating
material. The conductive material is connected across the layers through holes.

25

Fig 2.6: General Purpose PCB


PCBs may also be either rigid, flexible, or the combination of two (rigid flex). When the
electronic components have mounted on the PCB, the combination of

PCB and

components is an electronic assembly also called the PRINTED CIRCUIT ASSEMBLY.


This assembly is the basic building block for all the electronic appliances such as
television, computer and other goods.

2.14.2 FUNCTIONS OF PCB:


Printed Circuit Boards are dielectric substrates with metallic circuitry formed on that.
They are sometimes referred to as the base line in electronic packaging. Electronic
packaging is fundamentally an inter connection technology and the PCB is the baseline
building block of this technology. The advantages of using a PCB are following:

The circuit becomes more compact.

The circuit becomes more reliable

MOUNTING OF COMPONENTS

26

All the components, according to the component assembly diagram, are mounted in the
appropriate holes.

2.14.3 STEPS TO PCB DESIGN USING ORCAD:


1. Design circuit using schematic entry package (Capture).
2. Generate netlist for PCB package.
3. Import netlist into PCB package (LayoutPlus).
4. Place components, route signals.
5. Generate machining (Gerber) files for PCB plant.
This document is a 'quick start', describing some of the most commonly used operations
for PCB design using Orcad. For more details see on-line help and also the pdf manuals
which are usually in Program Files\Orcad\Document. These pdf files seem generally
much more comprehensive than the on-line help.

2.14.4 SCHEMATIC DESIGN:


Use Capture to enter your design. Multiple schematic pages for same designcan be
used.
Tip: label nets you may want to locate at the pcb stage net names are carried through
to the pcb design process.
Select project in project window (as opposed to schematic window), select Design Rule
Check for Tools menu. Correct any errors in design.
Select project in project window, select Create Netlist from Tools menu. Choose Layout
tab (to generate Layout compatible netlist), generate netlist. Choose units (English or
metric) compatible with what you will use in yourpcb design.

27

2.14.5 PCB LAYOUT:


Run LayoutPlus. Choose File/New.
Select a technology file appropriate for your design. These are in Program
Files\Orcad\Layout_Plus\data and set defaults for things like track spacing,hole sizes etc.
Some examples:
1BET_ANY.TCH allows single track between pins on standard DIP;
2BET_SMT.TCH for surface mount and mixed smt/through hole designs, 2tracks
between pins of standard DIP;
3BET_THR.TCH through hole boards, up to 3 tracks between pins.You're best using
1bet_any.tch if at all possible, since this is the least demanding pcb technology.
Choose your netlist file (.mnl extension). If the units (English/metric) are not the same
you won't be able to load it. Just go back to Capture and generate the netlist again with
the right units.
If some of your components chosen from the Orcad Capture libraries did nothave PCB
footprints associated with them you will get Cannot find footprint for... messages. If
this happens, choose link existing footprint tocomponent. Browse footprint libraries to
find the required footprint (preview of footprint shown on screen). You can often guess
footprints from names. Examples:TM = through hole mounted (as opposed to surface
mount)

BCON100T

block

connector,

0.1

pitch,

through

hole

BLKCON.100/VH/TM1SQ/W.100/3 = block connector, 0.1 pitch, vertical (as opposed


to right angle), through hole, pin 1 square pad, width 0.1, 3 pins.
Library DIP100T = dual in line packages, through hole, 0.1 between pins.If you
can't find the right footprint then you'll need to make your own. SeeCreating a new
Footprint at the end of this document.

28

2.14.6 DRAW BOARD OUTLINE:


Click obstacle toolbar button.
Somewhere in design, right click, select new.
Right click again, select properties.
Select: board outline, width = 50 (or as required), layer = global layer, OK.
Left click to place one corner of board, then right click on successivecorners.
Draw a board the required size. Right click, select finish when done (only need to do 3
corners, finish will complete the outline). Notice that the dimensions are shown on status
bar at bottom of screen as you draw the board can be helpful for creating particular
board size. (You can do all this later, after you've placed and routed everything if you
prefer.)

2.14.7 CHOOSE LAYERS:


Use spreadsheet toolbar button to see the Layers spreadsheet.
Enable only the layers you want for routing, set other layers to unused (double click on
the spreadsheet entry, select unused routing). For a single sided board you probably want
only the bottom layer, for double sided you probably want top and bottom, for a 4
layer board you probably want these plus power and ground plane layers. Tip: you can
select multiple layers using click with ctrl key, then right click, select properties, then
set/clear unused routing to simultaneously enable or disable several layers.

2.14.8 PLACE COMPONENTS:


Select component tool from toolbar, click on required component and drag it where
you want. Right click to see some options, including rotate.

29

Auto/place board will attempt to place components automatically for you within board
outline. You may want to move components manually as well.

2.14.9 TRACK THICKNESS:


To change, select nets spreadsheet, double click on required net to set its properties.
Net names are inherited from your schematic diagram.
Explicitly naming nets helps you identify them in the PCB design. For a simple through
hole board you probably want about 20mil tracks. For surface mount boards you probably
want 10 or 12 mil tracks. Our pcb plant will make 5 mil tracks if you really need them,
but there's an increased risk of part of the track being lost in the etching process. 10 or 12
mil can be reliably made. You may want to make power and ground tracks thicker.

2.14.10 ROUTING:
Automatic routing is ok, but you can manually route as well (use toolbar buttons).
Make sure you've set the track thicknesses as you want before routing (see above).
You may want to route power and ground first, especially if it's a 1 or 2 layer board. Use
the nets spreadsheet to enable/disable those nets you want to route at any one time. Tip:
select Routing Enabled column, right click,disable to disable all nets, then enable the
ones you want.
You may want to give priority to critical nets (those that need shortestpaths), to
optimally route those. Priority can be selected from the netsspreadsheet for each net.
To automatically route, select Tools, auto, route board. To put everything back to the
rat's nest net, tools/auto/unroute board.
You can auto route just one component by selecting autoroute/component then click on
a pin on that component.

30

After an autoroute/board is completed, orcad thinks it's finished, and if you run it again
(eg to route some more signals that were disabled the first time) it says all sweeps done or
disabled and won't run again. To run autoroute again you have to remove "done" from all
autoroute passes. Click the spreadsheet toolbar button and select strategy/route pass.
Select the whole "enable" colum, right click, select properties. Remove the "done" tick
and click OK. Close the spreadsheet and you can now run the autorouter again.

2.14.11 COPPER POUR:

Copper pour fills selected unused board area with copper. This allows creation of large

ground (and/or power) areas which improves noiseproperties. Also reduces amount of
copper that needs to be etched off the board by manufacturing process.
Tip:

don't do this until you've finished placement and routing.

Select

required layer (eg TOP or BOTTOM).

Select

obstacle tool (toolbar button), right click in design, select new. Right click again,

select properties
Select

copper pour, net = GND (or as required), OK. (This example would

connect copper pour to the GND net.)


Draw

(by left click and drag) the outline for the copper fill.

Repeat

as required for other copper pour areas and/or layers.

If you want to delete it, select it by using obstacle tool then ctrl left click on the pour.

Then press the delete key.

2.14.12 SET DATUM (ORIGIN):


From

Tool menu select dimension/move datum.

31

Left

click at the bottom LH corner of your board to set the origin. (Exact placing doesn't

matter.)

2.14.13 GENERATE MACHINING FILES (GERBER FILES):

The machining files required to manufacture the PCB are generated by the post

processor. From options menu choose Post Processing. In the spreadsheet, select the
layers you need to manufacture. You need at least the routing layers you have used (eg
top, bottom) and the drill information.
Choose Auto/Post Process to generate the files. The files generated by the post
processor are the only ones needed for the PCB plant to make the board.

2.14.14 TIPS:
Use the colour toolbar button, click on a colour box and press the key to toggle its
visibility. With copper pour in place it can be hard to see what you've got.Silk Screen - to
see it, you need to add it to the colours table. Use Colours tool,right click, new. Select
layer SST (silk screen top), rule = default, OK.Use manual place (auto place doesn't
optimise placement for noise considerations).When placing, set critical nets (eg op amp
inputs) to a distinctive colour (via nets spreadsheet) so you can easily see them to
optimise placement. Place connectors first they need to be in a convenient place (eg
near the edge).Some components have multiple parts within one package. Place an
additional part in the schematic, choosing, for example, the B part. The annotate design
tool will combine them into one package (same component identifier). Don't forget to
connect unused inputs to appropriate places (eg
power, ground) in the schematic, particularly for digital circuits.You can go back and
change your schematic. Then, when you generate the netlist again, be sure to select the
box Run ECO to Layout (EngineeringChange Order). The PCB will be appropriately
changed (you may need to then tidy things up).To select an obstacle (eg board outline or
copper pour) select the obstacle tool (toolbar button). Hold ctrl key down and left click on

32

obstacle to select it (becomes highlighted usually white). Or, click on corner of obstacle
and drag as required. Or, select obstacle by drawing a box (with obstacle tool selected)
which includes some part of the object.Make sure you do a save fairly often. You can
save to a different file name if you want, then you have a partial pcb design you can go
back to if you change your mind how to do things. Do a save before trying anything
daring. Then if it doesn't work out you can just exit without saving and start again with
your previously saved design. Beware: the "undo" option is only occasionally helpful.The
on-line manuals are ok, but more detailed information is in the pdf files contained in the
Orcad Family folder (eg information on technology files,strategy files and many more
complex operations than those mentioned here).

2.14.15 CREATING A NEW FOOTPRINT:


An easy way to create a new footprint is to find an existing one that's similar,edit it and
save it with a new name.
Start Layout+ and choose tools/library manager.
The list of libraries is displayed in the top part of the window. Click on one you think
may be useful.
The list of footprints in that library is now shown in the bottom window. Ifyou click on
a footprint it is displayed in the window on the right.
Browse to a footprint that's close to what you want. (eg Right number of pins but wrong
width, or vice versa.)
To move a pin, choose pin tool, click on pin, move cursor to where you want it. (You
can also use the arrow keys.) The coordinates and distance moved are shown in the status
bar at the bottom.

33

Another, possibly easier way to move a pin to the right place is to edit its properties in
the footprints spreadsheet. You can just type in the required x,y coordinate of the pin
here. You can also take a copy of a pin (ctrl C) if you need to add pins.
To move text use the text tool, click on the text and drag it to where you want.
To change the place outline and detail, select them using the obstacle tool and either
delete (delete key) or drag to where you want. If you delete and redraw, make sure it's the
right obstacle type (right click, properties). The place outline shows the board space taken
other footprints can't be placed within this outline.
When you want to save, do a save as (don't overwrite the original libraryobject). Then
you have the option to create a new library. I'd recommend this make a library in your
own design folder and keep this with the rest of your design files.

2.15 SOLDERING:
SOLDERING: It is process of joining two or more metals to give physical bonding
and good electrical conductivity. It is used primarily in electrical and electronic circuitry.
Solder is a combination of metals, which are solid at normal room temperatures and
become liquid at between 180 and 200 degrees Celsius. Solder bonds well to various
metals, and extremely well to copper. Soldering is a necessary skill you need to learn to
successfully build electronics circuits. It is the primary way how electronics components
are connected to circuit boards, wires and sometimes directly to other components.
To solder you need a soldering iron. A modern basic electrical soldering iron consists of a
heating element, a soldering bit (often called the tip), a handle and a power cord. The
heating element can be either a resistance wire wound around a ceramic tube, or a thick
film resistance element printed onto a ceramic base. The element is then insulated and
placed into a metal tube for strength and protection. This is then thermally insulated from
the handle. The heating element of soldering iron usually reaches temperatures of around
370 to 400 Celsius degrees (higher than needed to melt the solder). The soldering bit is a
specially shaped piece of copper plated with iron and then usually plated with chrome or

34

iron. The tip planting makes it very resistant to aggressive solders and fluxes. The
strength or power of a soldering iron is usually expressed in Watts. Irons generally used
in electronics are typically in the range 12 to 25 Watts.
Higher powered iron will not run hotter, but it will have more power available to quickly
replace heat drained from the iron during soldering. Most irons are available in a variety
of voltages, 12V, 24V, 115V, and 230V are the most popular. Today most laboratories and
repair shops use soldering irons which operate at 24V (powered by isolation transformer
supplied with the soldering iron or by a separate low voltage outlet). You should always
use this low voltage where possible, as it is much safer. For advanced soldering work
(like very tiny very sensitive electronics components), you will need a soldering iron with
a temperature control. In this type of soldering irons the temperature may be usually set
between 200 deg C and 450 degrees C. Many temperature controlled soldering irons
designed for electronics have a power rating of around 40-50W. They will heat fast and
give enough power for operation, but are mechanically small (because the temperature
controller stops them from overheating when they are not used).
The solders designed for electronics work are usually a mixture of tin and lead. Tin melts
at 450 degree F and lead at 621 degree F. Solder Made from 63% tin and 37% lead melts
at 361?F, the lowest melting point for a tin and lead mixture. Solder construction is
designated by two numbers representing the percentages of each metal in that specific
mix. The first number always refers to the percentage of tin, the second is the percentage
of lead. Currently, the best commonly available, workable, and safe solder alloy is 63/37.
That is, 63% tin, 37% lead. It is also known as eutectic solder. Its most desirable
characteristic is that its solidest ("pasty") state, and its liquid state occur at the same
temperature -- 361 degrees F (around 183 degree C). This is the lowest possible
temperature for lead and tin combination to melt. You will often find "63/37" solder
referred to as a quick set solder or eutectic solder. Other commonly used mixture ration is
60/40, (60% tin/40% lead). Look for solders that are sold as "free of impurities" in the
component metals. Impurities cause a "scum" on your solder bead, degrade soldering iron
tips, and interfere with the proper soldering. For all electrical work you need to use rosin

35

core solder. In electronics a 60/40 fluxed core solder commonly is used. This consists of
60% Lead and 40% Tin, with flux cores added through the length of the solder.
There are two main classifications for the methods of soldering in use today:

Mechanical or non-electrical (using primarily acid flux).

Electrical (using primarily rosin flux).

For more than 50 years lead-containing solders have been used almost exclusively
throughout the electronics industry for attaching components to printed circuit boards
(PCBs). Such solders are inexpensive, perform reliably under a variety of operating
conditions, and possess unique characteristics (e.g. low melting point, high strength
ductility and fatigue resistance, high thermal cycling and joint integrity) that are well
suited for electronics applications. Solder is usually identified by its tin-to-lead
composition. If you look at a solder roll, you will probably find the Figs 40/60, 50/50,
60/40 or 63/37. These are the ratios of tin-to-lead, given in percent. Solder with a higher
tin content melts at a lower temperature, and is usually desirable. The so-called "eutectic
alloy" of 63% tin and 37% lead has a melting or eutectic temperature of 361 degrees
Fahrenheit (183 degrees Celsius). That composition is the standard for electronic
purposes, being approximated by 60/40 solder, and has a pronounced melting point. The
60Si-40Pb is the traditional soldering tin used in electronics work. Solders with a 63/37
or 60/40 composition are the most free-flowing kinds and are particularly good for
working on delicate printed circuit boards. Other solder compositions have a flexible or
plastic range running from the 361 degrees eutectic temperature up to the melting points
of either pure lead (621 degrees), or pure tin (450 degrees). Since tin is a more active
metallic solvent than lead, the quality of the joint is very closely related to its tin content.
The alloy quality curve reaches its peak with about 60% tin, which approximately
corresponds to the composition of the eutectic alloy we described.

2.15.1 MATERIALS USED IN THE PROCESS OF SOLDERING:

36

Soldering is a process by which two or more metal parts are united by an alloy. The alloy
melts at a lower temperature than either of the pieces of metal. The liquefied solder does
not adhere to the surface of the metal. Instead, the molten solder passes into (permeates)
An alloy is formed at the boundary of the two metals to a depth of about 0.1 milli metre
(mm). On cooling, the alloy forms a common bond, uniting the metals.
The familiar solders contain mainly lead and tin. Molten lead will not wet the surface of
copper however clean it is. If a little tin is added, the resulting alloy will readily flow over
the copper.

Fig 2.7: Soldering Iron


The familiar solders contain mainly lead and tin. Molten lead will not wet the surface of
copper however clean it is. If a little tin is added, the resulting alloy will readily flow over
the copper.
Solder is an alloy (mixture) of tin and lead, typically 60% tin and 40% lead. It melts at a
temperature of about 200C. Coating a surface with solder is called tinning because of
the tin content of solder. Lead is poisonous and you should always wash your hands after
using solder. Solder for electronics use contains tiny cores of flux, like the wires inside a

37

mains flex. The flux is corrosive, like an acid, and it cleans the metal surfaces as the
solder melts. This is why you must melt the solder actually on the joint, not on the iron
tip. Without flux most joints would fail because metals quickly oxidise and the solder
itself will not flow properly onto a dirty, oxidised, metal surface. The best size of solder
for electronic circuit boards is 22 (swg= standard wire gauge). For plugs, component
holders and other larger joints you may prefer to use 18swg solder.

Preparing the soldering iron


Place the soldering iron in its stand and plug in.
The iron will take a few minutes to reach its operating temperature of about 400C.
Dampen the sponge in the stand.
The best way to do this is to lift it out the stand and hold it under a cold tap for a moment,
then squeeze to remove excess water. It should be damp, not dripping wet.
Wait a few minutes for the soldering iron to warm up.
You can check if it is ready by trying to melt a little solder on the tip.
Wipe the tip of the iron on the damp sponge.
This will clean the tip.
Melt a little solder on the tip of the iron.
This is called 'tinning' and it will help the heat to flow from the irons tip to the joint.It
only needs to be done when you plug in the iron, and occasionally while soldering if you
need to wipe the tip clean on the sponge.
You are now ready to start soldering!

38

Please turn the page for further instructions.

Making soldered joints


Hold the soldering iron like a pen, near the base of the handle.
Imagine you are going to write your name! Remember to never touch the hot element tip.
Touch the soldering iron onto the joint to be made.
Make sure it touches both the component lead and the track.Hold the tip there for a few
seconds .
Feed a little solder onto the joint.
It should flow smoothly onto the lead and track to form a volcano shape as shown in the
diagram below. Make sure you apply the solder to the joint, not the iron.
Remove the solder, then the iron, while keeping the joint still.
Allow the joint a few seconds to cool before you move the circuit board.
Inspect the joint closely.
It should look shiny and have a volcano shape. If not, you will need to reheat it and feed
in a little more solder. This time ensure that both the lead and track are heated fully
before applying solder.

39

Fig 2.8: Soldering Joints


Using a heat sink
Some components, such as transistors, can be damaged by heat when soldering. It is wise
to use a heat sink clipped to the lead between the joint and the component body .You can
buy a special tool, but a standard crocodile clip works just as well and is cheaper!

2.16.DESOLDERING:
At some stage you will probably need to desolder a joint to remove or re-position a wire
or component. There are two ways to remove the solder:
1. With a desoldering pump (solder sucker)
Set the pump by pushing the spring-loaded plunger down until it locks.
Apply both the pump nozzle and the tip of your soldering iron to the joint.
Wait a second or two for the solder to melt.
Then press the button on the pump to release the plunger and suck the molten
solder into the tool.
Repeat if necessary to remove as much solder as possible.
The pump will need emptying occasionally by unscrewing the nozzle.

40

2. With solder remover wick (copper braid)


Apply both the end of the wick and the tip of your soldering iron to the joint.
As the solder melts most of it will flow onto the wick, away from the joint.
Remove the wick first, then the soldering iron.
Cut off and discard the end of the wick coated with solder.
After removing most of the solder from the joint(s) you may be able to remove the wire
or component lead straight away (allow a few seconds for it to cool).

Safety Precautions
Never touch the element or tip of the soldering iron.
They are very hot (about 400C) and will give you a nasty burn.
Take great care to avoid touching the mains flex with the tip of the iron.
The iron should have a heatproof flex for extra protection. Ordinary plastic flex mel

2.17 RESISTANCE:
Resistance refers to the property of a substance that impedes the flow of electric current.
Some substances resist current flow more than other. If a substance offers very high
resistance to current flow it is called an insulator. If its resistance to current flow is very
low, it is called a conductor. Resistivity refers to the ability of substance to resist current
flow. Good conductors have low resistivity and insulators have high resistivity.

2.17.1 OHMS LAW:

41

George Simon Ohm (1789-1854), a German physicist, formulated the relationships


among voltage, current, and resistance into what is referred to as Ohms law:
The current in a circuit is directly proportional to the applied potential difference and
inversely proportional to the resistance of the circuit.
The International Standard (SI) unit of resistance is the ohm, designated by the Greek
letter one ohm of resistance is equal to the resistance of a circuit in which a potential
difference of one volt produces a current of one ampere.
Mathematically Ohms law is written as:
I = E/R
Where I is the current in amperes, E is the applied voltage (difference in potential) in
volts and R is the resistance in ohms.
Therefore, voltage can be calculated using formula:
E=I*R
Resistance can be calculated using the formula:
R = E/I
It is important to note that adjusting voltage or current can not change resistance.
Resistance in a circuit is a physical constant and can only be modified by changing
components, exchanging resistance for those rated at more or fewer ohms, or by adjusting
variable resistors.

2.17.2 RESISTORS:
Most of the resistance in circuit is found in components that do specific work, such as
bulbs or heating elements, and in devices called resistors. Resistors are devices that

42

provide precise amount of opposition or resistance to current flow. Resistors are very
common in electric circuits. They are used to provide specific resistivity to limit current
and to control voltage in a circuit.

2.17.3 TYPES OF RESISTORS:


Resistors come in variety of values and types. The most common type is fixed resistor.
Fixed resistor have single value of resistance, which remain constant. There are also
variable resistors that can be adjusted to vary or change the amount of resistance n a
circuit.

FIXED RESISTORS
The most common fixed resistor is the composition type. The resistance element is made
of graphite, or some other form of carbon, and alloy materials. These resistor generally
have resistance values that range from 0.1 to 22 M.
Another kind of fixed resistor is the wire wound type. The resistance element is usually
made of nickel-chromium wire wound on a ceramic rod. These resistor generally have
resistance values that range from 1 to 100 k.

VARIABLE RESISTANCE
Variable Resistors are used to adjust the amount of resistance in a circuit. A variable
resistor consists of a sliding contact arm that makes contact with a stationary resistance
element. As the sliding arm moves across the element, its point of contact on the element
changes, effectively changing the length of the element. The rating of a variable resistor
is its resistance at its highest setting.Variable resistors are also called rheostats and
potentiometers. The resistance elements of rheostats are usually wire wound. They are
most often used to control very high currents, such as in motors and lamps.
Potentiometers generally have composition elements. They are used as control devices in
radios, amplifiers, televisions, and electrical instruments.

43

2.18 TRANSISTORS:
Transistors amplify current, for example they can be used to amplify the small output
current from a logic IC so that it can operate a lamp, relay or other high current device. In
many circuits a resistor is used to convert the changing current to a changing voltage, so
the transistor is being used to amplify voltage.
A transistor may be used as a switch (either fully on with maximum current, or fully off
with no current) and as an amplifier (always partly on).
Prior to invention of transistors, digital circuits were composed of vacuum tubes, which
has many disadvantages. They were much larger, required more energy, dissipated more
heat, and were more prone to failures. Its safe to say that without the invention of
transistors, computing as we know it today would not be possible.

Fig 2.9: Transistor circuit symbols

An electrical signal can be amplified by using a device that allows a small current or
voltage to control the flow of a much larger current. Transistors are the basic devices
providing control of this kind. Modern transistors are divided into two main categories:

44

Bipolar Junction Transistors (BJTs) and Field Effect Transistors (FFTs). Application of
current in BJTs and voltage in FETs between the input and common terminals increases
the conductivity between the common and output terminals, there by controlling current
flow between them. The transistors characteristics depend on their type.
The term TRANSITOR originally referred to the point contact type, which saw very
limited commercial application, being replaced by the much more practical Bi-polar
Junction types in the early 1950s. Todays most widely used schematic symbol, like the
term TRANSISTORS, originally referred to these long-obsolete devices. For a short
time in the early 1960s some manufacturers and publishers of electronic magazines
started to replace these with symbol that more accurately depicted the different
construction of the Bi-polar transistor, but this idea was soon abundant.
In analogue circuits, transistors are used in amplifiers, (direct current amplifiers, audioamplifiers), and linear regulated power supplies. Transistors are also used in digital
circuits where they function as electronic switches but rarely as discrete devices, almost
always being incorporated in monolithic integrated circuits. Digital circuits include logic
gates, random access memory (RAM), microprocessors, and digital signal processors
(DSPs).

2.19 PRESET:
A preset is a three legged electronic component which can be made to offer varying
resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The
adjustment can be done by using a small screw driver or a similar tool. The resistance
does not vary linearly but rather varies in exponential or logarithmic.

45

Fig 2.10: Preset


A preset is a three legged electronic component which can be made to offer varying
resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The
adjustment can be done by using a small screw driver or a similar tool. The resistance
does not vary linearly but rather varies in exponential or logarithmic manner. Such
variable resistors are commonly used for adjusting sensitivity along with a sensor.
The variable resistance is obtained across the single terminal at front and one of the two
other terminals. The two legs at back offer fixed resistance which is divided by the front
leg. So whenever only the back terminals are used, a preset acts as a fixed resistor.
Presets are specified by their fixed value resistance.

2.19.1 PIN DIAGRAM:

46

Fig 2.11: Preset Pin Diagram

2.20 LED (LIGHT EMITTENG DIODE):

47

Fig 2.12: Coloured LEDs


An LED is usually a small area source, often with extra optics added to the chip that
shapes its radiation pattern. [1] The color of the emitted light depends on the composition
and condition of the semiconducting material used, and can be infrared, visible, or nearultraviolet. An LED can be used as a regular household light source.
A light-emitting diode (LED) is a semiconductor diode that emits incoherent narrowspectrum light when electrically biased in the forward direction of the p-n junction. This
effect is a form of electroluminescence.
An LED is usually a small area source, often with extra optics added to the chip that
shapes its radiation pattern. The color of the emitted light depends on the composition
and condition of the semiconducting material used, and can be infrared, visible, or nearultraviolet. An LED can be used as a regular household light source.

2.20.1 ADVANTAGES OF USING LED:

48

LEDs produce more light per watt than do incandescent bulbs; this is useful in battery
powered or energy-saving devices.

LEDs can emit light of an intended color without the use of color filters that traditional

lighting methods require. This is more efficient and can lower initial costs.

The solid package of an LED can be designed to focus its light. Incandescent and

fluorescent sources often require an external reflector to collect light and direct it in a
usable manner.

When used in applications where dimming is required, LEDs do not change their color

tint as the current passing through them is lowered, unlike incandescent lamps, which
turn yellow.

LEDs are ideal for use in applications that are subject to frequent on-off cycling,

unlike fluorescent lamps that burn out more quickly when cycled frequently, or HID
lamps that require a long time before restarting.

LEDs, being solid state components, are difficult to damage with external shock.

Fluorescent and incandescent bulbs are easily broken if dropped on the ground.

LEDs have an extremely long life span. One manufacturer has calculated the ETTF

(Estimated Time To Failure) for their LEDs to be between 100,000 and 1,000,000 hours.
Fluorescent tubes typically are rated at about 30,000 hours, and incandescent light bulbs
at 1,000-2,000 hours.

LEDs mostly fail by dimming over time, rather than the abrupt burn-out of

incandescent bulbs.

LEDs light up very quickly. A typical red indicator LED will achieve full brightness in

microseconds; LEDs used in communications devices can have even faster response
times.

LEDs can be very small and are easily populated onto printed circuit boards.

49

LEDs do not contain mercury, while compact fluorescent lamps do.

Fig 2.13: Led Types


LEDs are produced in an array of shapes and sizes. The 5 mm cylindrical package (red,
fifth from the left) is the most common, estimated at 80% of world production. The color
of the plastic lens is often the same as the actual color of light emitted, but not always.
For instance, purple plastic is often used for infrared LEDs, and most blue devices have
clear housings. There are also LEDs in extremely tiny packages, such as those found on
blinkies.

2.20.2 DISADVANTAGES OF USING LED:

LEDs are currently more expensive, price per lumen, on an initial capital cost basis,

than more conventional lighting technologies. The additional expense partially stems
from the relatively low lumen output and the drive circuitry and power supplies needed.
However, when considering the total cost of ownership (including energy and
maintenance costs), LEDs far surpass incandescent or halogen sources and begin to
threaten compact fluorescent lamps.

50

LED performance largely depends on the ambient temperature of the operating

environment. Driving an LED hard in high ambient temperatures may result in


overheating of the LED package, eventually leading to device failure. Adequate heatsinking is required to maintain long life. This is especially important when considering
automotive, medical, and military applications where the device must operate over a large
range of temperatures, and are required to have a low failure rate.

LEDs must be supplied with the correct current. This can involve shunt resistors or

regulated power supplies.

LEDs typically cast light in one direction at a narrow angle compared to an

incandescent or fluorescent lamp of the same lumen level.

2.20.3 LED APPLICATIONS:


1. LED panel light source used in an experiment on plant growth. The findings of such
experiments may be used to grow food in space on long duration missions typically cast
light in one direction at a narrow angle compared to an incandescent or fluorescent lamp
of the same lumen level.

2. Single high-brightness LED with a glass lens creates a bright carrier beam that can
stream DVD-quality video over considerable distances.

2.21 VOLTAGE REGULATOR:


Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variable output
voltages. They are also rated by the maximum current they can pass. Negative voltage

51

regulators are available, mainly for use in dual supplies. Most regulators include some
automatic protection from excessive current ( 'overload protection') and overheating
( 'thermal protection'). Many of the fixed voltage regulator ICs have 3 leads and look
like power transistors, such as the 7805 +5V 1A regulator shown on the right.

Fig 2.14: Voltage Regulator


2.22 CAPACITORS:
FUNCTION:
Capacitors store electric charge. They are used with resistors in timing circuits because it
takes time for a capacitor to fill with charge. They are used to smooth varying DC
supplies by acting as a reservoir of charge. They are also used in filter circuits because
capacitors easily pass AC (changing) signals but they block DC (constant) signals.

CAPACITANCE:
This is a measure of a capacitor's ability to store charge. A large capacitance means that
more charge can be stored. Capacitance is measured in farads, symbol F. However 1F is
very large, so prefixes are used to show the smaller values.
Three prefixes (multipliers) are used, (micro), n (nano) and p
(pico):
means 10-6 (millionth), so 1000000F = 1F
n means 10-9 (thousand-millionth), so 1000nF = 1F

52

p means 10-12 (million-millionth), so 1000pF = 1nF


Capacitor values can be very difficult to find because there are many
types of capacitor with different labelling systems!
There are many types of capacitor but they can be split into two
groups, polarised and unpolarised. Each group has its own circuit
symbol.

Polarised capacitors (large values, 1F +)

Examples:

Circuit:

symbol:
ELECTROLYTIC CAPACITORS:
Electrolytic capacitors are polarised and they must be connected the correct way
round, at least one of their leads will be marked + or -. They are not damaged by heat
when soldering.
There are two designs of electrolytic capacitors; axial where the leads are attached to
each end (220F in picture) and radial where both leads are at the same end (10F in
picture). Radial capacitors tend to be a little smaller and they stand upright on the circuit
board.

53

It is easy to find the value of electrolytic capacitors because they are clearly printed with
their capacitance and voltage rating. The voltage rating can be quite low (6V for
example) and it should always be checked when selecting an electrolytic capacitor. If the
project parts list does not specify a voltage, choose a capacitor with a rating which is
greater than the project's power supply voltage. 25V is a sensible minimum for most
battery circuits.

TANTALUM BEAD CAPACITORS:


Tantalum bead capacitors are polarised and have low voltage ratings like electrolytic
capacitors. They are expensive but very small, so they are used where a large capacitance
is needed in a small size.
Modern tantalum bead capacitors are printed with their capacitance, voltage and polarity
in full. However older ones use a colour-code system which has two stripes (for the two
digits) and a spot of colour for the number of zeros to give the value in F. The standard
colour code is used, but for the spot, grey is used to mean 0.01 and white means 0.1
so that values of less than 10F can be shown. A third colour stripe near the leads shows
the voltage (yellow 6.3V, black 10V, green 16V, blue 20V, grey 25V, white 30V, pink
35V). The positive (+) lead is to the right when the spot is facing you: 'when the spot is
in sight, the positive is to the right'.

For example:

blue, grey, black spot

means 68F

For example:

blue, grey, white spot

means 6.8F

For example: blue, grey, grey spot means 0.68F


UNPOLARISED CAPACITORS (SMALL VALUES, UP TO 1F):

54

Examples:

SYMBOL:
Small value capacitors are unpolarised and may be connected either way round. They are
not damaged by heat when soldering, except for one unusual type (polystyrene). They
have high voltage ratings of at least 50V, usually 250V or so. It can be difficult to find the
values of these small capacitors because there are many types of them and several
different labelling systems! Many small value capacitors have their value printed but
without a multiplier, so you need to use experience to work out what the multiplier
should be.
For example 0.1 means 0.1F = 100nF.
Sometimes

the

multiplier

is

used

in

place

of

the

decimal

point:

For example: 4n7 means 4.7nF.

2.23 RELAY:
A relay is an electrically operated switch. Current flowing through the coil of the relay
creates a magnetic field which attracts a lever and changes the switch contacts. The coil

55

current can be on or off so relays have two switch positions and most have double throw
(changeover) switch contacts as shown in the diagram.
Relays allow one circuit to switch a second circuit which can be completely separate
from the first. For example a low voltage battery circuit can use a relay to switch a 230V
AC mains circuit. There is no electrical connection inside the relay between the two
circuits, the link is magnetic and mechanical.

Fig 2.15: Relay showing coil and switch contacts


The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it
can be as much as 100mA for relays designed to operate from lower voltages. Most ICs
(chips) cannot provide this current and a transistor is usually used to amplify the small IC
current to the larger value required for the relay coil. The maximum output current for the
popular 555 timer IC is 200mA so these devices can supply relay coils directly without
amplification.
Relays are usuallly SPDT or DPDT but they can have many more sets of switch contacts,
for example relays with 4 sets of changeover contacts are readily available. For further
information about switch contacts and the terms used to describe them please see the
page on switches.

56

Most relays are designed for PCB mounting but you can solder wires directly to the pins
providing you take care to avoid melting the plastic case of the relay.
The supplier's catalogue should show you the relay's connections. The coil will be
obvious and it may be connected either way round. Relay coils produce brief high voltage
'spikes' when they are switched off and this can destroy transistors and ICs in the circuit.
To prevent damage you must connect a protection diode across the relay coil.
The animated picture shows a working relay with its coil and switch contacts. You can
see a lever on the left being attracted by magnetism when the coil is switched on. This
lever moves the switch contacts. There is one set of contacts (SPDT) in the foreground
and another behind them, making the relay DPDT.
The relay's switch connections are usually labelled COM, NC and NO:
COM = Common, always connect to this, it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is
on.
Connect to COM and NO if you want the switched circuit to be on
when the relay coil is on.
Connect to COM and NC if you want the switched circuit to be on
when the relay coil is of.

FOR EXAMPLE: A 12V supply relay with a coil resistance of 400

passes a

current of 30mA. This is OK for a 555 timer IC (maximum output current


200mA), but it is too much for most ICs and they will require a transistor to
amplify the current.

2.24 SWITCHES
There are three important features to consider when selecting a switch:

57

Contacts (e.g. single pole, double throw)


Ratings (maximum voltage and current)
Method of Operation (toggle, slide, key etc.)

Fig 2.16: Switch Circuit symbol

Several terms are used to describe switch contacts:


Pole - number of switch contact sets.
Throw - number of conducting positions, single or double.
Way - number of conducting positions, three or more.
Momentary - switch returns to its normal position when released.
Open - off position, contacts not conducting.
Closed - on position, contacts conducting, there may be several on positions.
FOR EXAMPLE: The simplest on-off switch has one set of contacts (single pole) and
one switching position which conducts (single throw). The switch mechanism has two
positionts: open (off) and closed (on), but it is called 'single throw' because only one
position conducts.

2.25 L293D (MOTOR DRIVER IC):


L293D is a typical Motor driver or Motor Driver IC which allows DC motor to drive on
either direction. L293D is a 16-pin IC which can control a set of two DC motors

58

simultaneously in any direction. It means that you can control two DC motor with a
single L293D IC. The l293d can drive small and quiet big motors as well.

L293D Pin Diagram:

Fig 2.17: L293D Pin Diagram

2.25.1 CONCEPT:
It works on the concept of H-bridge. H-bridge is a circuit which allows the voltage to be
flown in either direction. As you know voltage need to change its direction for being able

59

to rotate the motor in clockwise or anticlockwise direction, Hence H-bridge IC are ideal
for driving a DC motor.
In a single l293d chip there two h-Bridge circuit inside the IC which can rotate two dc
motor independently. Due its size it is very much used in robotic application for
controlling DC motors.
There are two Enable pins on l293d. Pin 1 and pin 9, for being able to drive the motor,
the pin 1 and 9 need to be high. For driving the motor with left H-bridge you need to
enable pin 1 to high. And for right H-Bridge you need to make the pin 9 to high. If
anyone of the either pin1 or pin9 goes low then the motor in the corresponding section
will suspend working. Its like a switch.

Working of L293D:
The there 4 input pins for this l293d, pin 2,7 on the left and pin 15 ,10 on the right as
shown on the pin diagram. Left input pins will regulate the rotation of motor connected
across left side and right input for motor on the right hand side. The motors are rotated on
the basis of the inputs provided across the input pins as LOGIC 0 or LOGIC 1.In simple
you need to provide Logic 0 or 1 across the input pins for rotating the motor.

CHAPTER-3
PROJECT PROGRAM

60

#include<16f887.h>
#fuses intrc_io,nowdt
#byte porta=0x05 // ADDRESS
#byte trisa=0x85 //ADDRESS
#byte portb=0x06//ADDRESS
#byte trisb=0x86 // ADDRESS
void main()
{
trisa=0xf0; // O/P PORT
porta=0x00; // OFF INTIALLY
portb=0x00; // INTIALLY OFF
trisb=0x00; //INPUT PORT
while(1)
{
if(porta==0x01)
{
}
if(porta==0x02)
{

61

}
if(porta==0x03)
{
}
if(porta==0x04)
{
portb=0x18; // OPEN DVD LOADER
}
if(porta==0x05)
{
}
if(porta==0x06)
{
portb=0x28; // DVD LOADER CLOSE
}
if(porta==0x07)
{
}
if(porta==0x08)

62

{
}
if(porta==0x09)
{
}
}
}

CHAPTER-4
RESULT & DISCUSSION
This unit talks about how the different units of the project working. How motor diver IC
can be interfaced to your telephone and can be used to turn ON and OFF your
equipments such as d.c motors, machines, electricity system or heavy-duty motors. This
project is a teleremote circuit that enables switching ON and OFF of mobile through

63

telephone lines. It can be used to switch appliances from any distance, overcoming the
limited range of infrared and radio remote controls. The circuit described in the project
can be used to open the door corresponding to the digits 0 to 9 of the telephone. This
circuit is based on the DTMF controller circuit. DTMF means dual tone multiple
frequency.The DTMF signals on telephone instrument are used as control signals and
then it goes to microcontroller input in digital form to switch off/on the relay to control
the door.

CHAPTER-5
CONCLUSION AND FUTURE SCOPE
In this age of automation many other devices like microprocessor or micro-controller,
infrared remote, voice controlled devices etc. are used for the automation purposes.
Virtually anything in the home/office that is powered by electricity can be automated
and/or controlled. We can control our electrical devices with our cordless phone from our

64

easy chair. We can turn our porch lights on automatically at dark or when someone
approaches and can see who is at the front door from any nearby television, and talk to
them or unlock the door from any nearby telephone. Have the security system turn off
lights, close drapes and setback the temperature when we leave and turn on the alarm
system. Automation can be used in large companies and firms for the proper mechanism
or smooth running of machines and equipments in the absence of workforce and the
employees.
This product is aimed toward average consumers who wish to control doors remotely
from their cell phones. Like other examples include; enable/disable security systems,
fans, lights, kitchen appliances, and heating/ventilation/air conditioning system. Right
now we have designed the project for opening of the door.

REFERENCES

Ignizio, J.P. and Cavalier, T.M., 1994. embedded C Programming, PrenticeHall, Englewood Cliffs, New Jersey.

PIC microcontrollers (By Martin P.Bates, Lucio Di Jasio, Chuck Hellebuyck,


Dagon Ibrahim, John Morton, D.W. Smith)

Hand book for Digital ICs from Analogic Device

65

PCB designing by David L. Jones Revision A - June 29th 2004

Websites viewed

http://www.atml.com/embeded-projects/pic-16-f-887 project .html

http://en.m.wikipedia.org/wiki/pic_controller#section_footer

http://microchip.com/yms_9500-sensor.html

www.microe.com

66

Вам также может понравиться