107621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
CHAPTER-1
INTRODUCTION
B.TECH ECE IV YEAR Aurora’s Engineering College
207621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
1.1 Embedded System
An embedded system is a special-purpose computer system designed to perform one or
a few dedicated functions, sometimes with real-time computing constraints. It is usually
embedded as part of a complete device including hardware and mechanical parts. In contrast, a
general-purpose computer, such as a personal computer, can do many different tasks
depending on programming. Embedded systems have become very important today as they
control many of the common devices we use.
Since the embedded system is dedicated to specific tasks, design engineers can
optimize it, reducing the size and cost of the product, or increasing the reliability and
performance. Some embedded systems are mass-produced, benefiting from economies of
scale.
Physically, embedded systems range from portable devices such as digital watches and
MP3 players, to large stationary installations like traffic lights, factory controllers, or the
systems controlling nuclear power plants. Complexity varies from low, with a single
microcontroller chip, to very high with multiple units, peripherals and networks mounted
inside a large chassis or enclosure.
In general, "embedded system" is not an exactly defined term, as many systems have
some element of programmability. For example, Handheld computers share some elements
with embedded systems — such as the operating systems and microprocessors which power
them — but are not truly embedded systems, because they allow different applications to be
loaded and peripherals to be connected.
1.2 Applications Of Embedded System
We are living in the Embedded World. You are surrounded with many embedded
products and your daily life largely depends on the proper functioning of these gadgets.
Television, Radio, CD player of your living room, Washing Machine or Microwave Oven in
B.TECH ECE IV YEAR Aurora’s Engineering College
307621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
your kitchen, Card readers, Access Controllers, Palm devices of your work space enable you
to do many of your tasks very effectively. Apart from all these, many controllers embedded in
your car take care of car operations between the bumpers and most of the times you tend to
ignore all these controllers.
1.3 Introduction To The Project
Now-a-days, identification of the person has become a challenging task in this busy world. Security has become the prior factor of any country in the conditions of increasing terrorism and anti social elements. As technology improves, it is becoming easier to verify the citizenship documentation of individuals. Security is a growing issue in international travel for both travelers and governments.
In this the details of the person would be fed into the RFID cards (passports in RFID
form). The RFID reader reads the details of the RFID passport and sends the data wirelessly
with the help of ZigBee transceiver. On the other side the other ZigBee receiver receives the
details and sends to the microcontroller. Here, the controllers compares with the data already
there. If it matches than the person is allowed, less he would be termed as a criminal by giving
an alarm/buzzing signal.
RFID is only one of numerous technologies grouped under the term Automatic
Identification (Auto ID), such as bar code, magnetic inks, optical character recognition, voice
recognition, touch memory, smart cards, biometrics etc. Auto ID technologies are a new way
of controlling information and material flow, especially suitable for large production
networks.
ZigBee is a specification for a suite of high level communication protocols using
small, low-power digital radios based on the IEEE 802.15.4-2003 standard for wireless
personal area networks (WPANs), such as wireless light switches with lamps, electrical meters
with in-home-displays, consumer electronics equipment via short-range radio. The technology
defined by the ZigBee specification is intended to be simpler and less expensive than other
B.TECH ECE IV YEAR Aurora’s Engineering College
407621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
WPANs, such as Bluetooth. ZigBee is targeted at radio-frequency (RF) applications that
require a low data rate, long battery life, and secure networking.
The dual technology of ZIGBEE and RFID is also used in “Blind Navigation”, which
is helpful in navigating blind people through the rush areas. This is also used in industries as a
device for secured data communication i.e, data can be transmitted/received by an
authenticated person.
1.4 Block Diagram
Fig 1.4: Block diagram of entire system
B.TECH ECE IV YEAR Aurora’s Engineering College
AT89S52 Microcontroller
RFID Reader
DISPLAY
ZigBee
Transceiver
PC
RFID Tag
ZigBee Transceiver
507621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
CHAPTER-2
THEORITICAL ANALYSIS
B.TECH ECE IV YEAR Aurora’s Engineering College
607621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
2.1 List of components
PCB Resistors Capacitors LED’s Potentiometer Relays Diodes AT89S52- microcontroller RS232 LM7805 –voltage regulator RFID module ZIGBEE module Male and Female connectors Buzzer/Alarm LCD display Oscillator Bridge rectifier Transformer
B.TECH ECE IV YEAR Aurora’s Engineering College
707621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
2.2 Microcontroller: AT89S52
2.2.1 Features
• Compatible with MCS®-51 Products
• 8K Bytes of In-System Programmable (ISP) Flash Memory
– Endurance: 10,000 Write/Erase Cycles
• 4.0V to 5.5V Operating Range
• Fully Static Operation: 0 Hz to 33 MHz
• Three-level Program Memory Lock
• 256 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Full Duplex UART Serial Channel
• Low-power Idle and Power-down Modes
• Interrupt Recovery from Power-down Mode
• Watchdog Timer • Dual Data Pointer
• Power-off Flag • Fast Programming Time
• Flexible ISP Programming (Byte and Page Mode)
• Green (Pb/Halide-free) Packaging Option
B.TECH ECE IV YEAR Aurora’s Engineering College
807621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
2.2.2 Description
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K
bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s
high-density nonvolatile memory technology and is compatible with the industry standard
80C51 instruction set and pinout. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory programmer.
By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic
chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and
cost-effective solution to many embedded control applications. The AT89S52 provides the
following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog
timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt
architecture, a full duplex serial port, on-chip oscillator, and clock circuitry.
In addition, the AT89S52 is designed with static logic for operation down to zero frequency
and supports two software selectable power saving modes. The Idle Mode stops the CPU
while allowing the RAM, timer/counters, serial port, and interrupt system to continue
functioning. The Power-down mode saves the RAM con-tents but freezes the oscillator,
disabling all other chip functions until the next interrupt or hardware reset.
B.TECH ECE IV YEAR Aurora’s Engineering College
907621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
2.2.3 Pin Configurations
B.TECH ECE IV YEAR Aurora’s Engineering College
1007621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Fig 2.2.3: Pin diagram of microcontroller
2.2.4 Pin Description
VCC : Supply voltage.
GND :Ground.
Port 0 :
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance
inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during
accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0
also receives the code bytes during Flash programming and outputs the code bytes dur-ing
program verification.
External pull-ups are required during program verification.
Port 1 :
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers can
sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the
inter-nal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being
pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1
can be configured to be the timer/counter 2 external count input (P1.0/T2) and the
timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the follow-ing table. Port
1 also receives the low-order address bytes during Flash programming and verification.
B.TECH ECE IV YEAR Aurora’s Engineering College
1107621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Tab 2.2.4(a): Various functions of port 1
Port 2 :
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can
sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the
inter-nal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-
order address byte during fetches from external program memory and dur-ing accesses to
external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2
uses strong internal pull-ups when emitting 1s. During accesses to external data memory that
use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function
Register. Port 2 also receives the high-order address bits and some control signals during Flash
program-ming and verification.
Port Pin Alternate Functions :
P1.0 T2 (external count input to Timer/Counter 2), clock-out P1.1 T2EX (Timer/Counter 2
capture/reload trigger and direction control) P1.5 MOSI (used for In-System Programming)
P1.6 MISO (used for In-System Programming) P1.7 SCK (used for In-System Programming)5
1919D–MICRO–6/
B.TECH ECE IV YEAR Aurora’s Engineering College
1207621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Port 3 :
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by
the inter-nal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being
pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control
signals for Flash programming and verification. Port 3 also serves the functions of various
special features of the AT89S52, as shown in the following table.
Tab 2.2.4(b): Various functions of port 3
RST :
Reset input. A high on this pin for two machine cycles while the oscillator is running resets
the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The
DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default
state of bit DISRTO, the RESET HIGH out feature is enabled.
ALE/PROG:
Address Latch Enable (ALE) is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG) during
B.TECH ECE IV YEAR Aurora’s Engineering College
1307621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped dur-ing each access to external data memory. If desired, ALE operation
can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only
during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the
ALE-disable bit has no effect if the microcontroller is in external execution mode.
PSEN:
Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to exter-nal
data memory.
EA/VPP:
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be
strapped to VCC for internal program executions. This pin also receives the 12-volt
programming enable voltage (VPP) during Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2 :
Output from the inverting oscillator amplifier.
Special Function Registers:
A map of the on-chip memory area called the Special Function Register (SFR) space is
shown in Table 5-1. Note that not all of the addresses are occupied, and unoccupied addresses
may not be imple-mented on the chip. Read accesses to these addresses will in general return
B.TECH ECE IV YEAR Aurora’s Engineering College
1407621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
random data, and write accesses will have an indeterminate effect. User software should not
write 1s to these unlisted locations, since they may be used in future products to invoke new
features. In that case, the reset or inactive values of the new bits will always be 0.
Timer 2 Registers:
Control and status bits are contained in registers T2CON (shown in Table 5- 2) and
T2MOD (shown in Table 10-2) for Timer 2. The register pair (RCAP2H, RCAP2L) are the
Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.
Interrupt Registers:
The individual interrupt enable bits are in the IE register. Two priorities can be set for each
of the six interrupt sources in the IP register.Memory Organization MCS-51 devices have a
separate address space for Program and Data Memory. Up to 64K bytes each of external
Program and Data Memory can be addressed.
Program Memory:
If the EA pin is connected to GND, all program fetches are directed to external memory.
On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through
1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to
external memory.
Data Memory:
The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a
parallel address space to the Special Function Registers. This means that the upper 128 bytes
have the same addresses as the SFR space but are physically separate from SFR space. When
an instruction accesses an internal location above address 7FH, the address mode used in the
instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space.
Instructions which use direct addressing access the SFR space. For example, the following
direct addressing instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H,
#data Instructions that use indirect addressing access the upper 128 bytes of RAM. For
B.TECH ECE IV YEAR Aurora’s Engineering College
1507621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the
data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data Note
that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM
are available as stack space.
Watchdog Timer (One-time Enabled with Reset-out):
The WDT is intended as a recovery method in situations where the CPU may be subjected
to software upsets. The WDT consists of a 14-bit counter and the Watchdog Timer Reset
(WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, a
user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H).
When the WDT is enabled, it will increment every machine cycle while the oscillator is
running. The WDT timeout period is dependent on the external clock frequency. There is no
way to disable the WDT except through reset (either hardware reset or WDT overflow reset).
When WDT over-flows, it will drive an output RESET HIGH pulse at the RST pin.
Using the WDT:
To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST
register (SFR location 0A6H). When the WDT is enabled, the user needs to service it by
writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter overflows
when it reaches 16383 (3FFFH), and this will reset the device. When the WDT is enabled, it
will increment every machine cycle while the oscillator is running. This means the user must
reset the WDT at least every 16383 machine cycles.
To reset the WDT the user must write 01EH and 0E1H to WDTRST. WDTRST is a write-
only register. The WDT counter cannot be read or written. WhenWDT overflows, it will
generate an output RESET pulse at the RST pin. The RESET pulse dura-tion is 98xTOSC,
where TOSC = 1/FOSC. To make the best use of the WDT, it should be serviced in those
sections of code that will periodically be executed within the time required to prevent a WDT
reset.
B.TECH ECE IV YEAR Aurora’s Engineering College
1607621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
WDT During Power-down and Idle:
In Power-down mode the oscillator stops, which means the WDT also stops. While in
Power-down mode, the user does not need to service the WDT. There are two methods of
exiting Power-down mode: by a hardware reset or via a level-activated external interrupt
which is enabled prior to entering Power-down mode. When Power-down is exited with
hardware reset, servicing the WDT should occur as it normally does whenever the AT89S52 is
reset. Exiting Power-down with an interrupt is significantly different.
The interrupt is held low long enough for the oscillator to stabilize. When the interrupt is
brought high, the interrupt is serviced. To prevent the WDT from resetting the device while
the interrupt pin is held low, the WDT is not started until the interrupt is pulled high. It is
suggested that the WDT be reset during the interrupt service for the interrupt used to exit
Power-down mode. To ensure that the WDT does not overflow within a few states of exiting
Power-down, it is best to reset the WDT just before entering Power-down mode.
Before going into the IDLE mode, the WDIDLE bit in SFR AUXR is used to determine
whether the WDT continues to count if enabled. The WDT keeps counting during IDLE
(WDIDLE bit = 0) as the default state. To prevent the WDT from resetting the AT89S52 while
in IDLE mode, the user should always set up a timer that will periodically exit IDLE, service
the WDT, and reenter IDLE mode. With WDIDLE bit enabled, the WDT will stop to count in
IDLE mode and resumes the count upon exit from IDLE.
UART :
The UART in the AT89S52 operates the same way as the UART in the AT89S52 and
AT89C52.
Timer 0 and 1:
Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer 0 and Timer 1 in the
AT89S52 and AT89C52.
B.TECH ECE IV YEAR Aurora’s Engineering College
1707621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Timer 2:
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter.
The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 5-2). Timer
2 has three operating modes: capture, auto-reload (up or down counting), and baud rate
generator. The modes are selected by bits in T2CON, as shown in Table 10-1. Timer 2
consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is
incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the
count rate is 1/12 of the oscil-lator frequency.
Tab 2.2.4(c): Timer 2 operating modes
In the Counter function, the register is incremented in response to a 1-to-0 transition at its
corre-sponding external input pin, T2. In this function, the external input is sampled during
S5P2 of every machine cycle. When the samples show a high in one cycle and a low in the
next cycle, the count is incremented. The new count value appears in the register during S3P1
of the cycle following the one in which the transition was detected. Since two machine cycles
(24 oscillator periods) are required to recognize a 1-to-0 transition, the maximum count rate is
1/24 of the oscillator frequency. To ensure that a given level is sampled at least once before it
changes, the level should be held for at least one full machine cycle.
B.TECH ECE IV YEAR Aurora’s Engineering College
1807621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Capture Mode:
In the capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0,
Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON. This bit can
then be used to generate an interrupt. If EXEN2 = 1, Timer 2 performs the same operation, but
a 1-to-0 transition at external input T2EX also causes the current value in TH2 and TL2 to be
captured into RCAP2H and RCAP2L, respectively. In addition, the transition at T2EX causes
bit EXF2 in T2CON to be set. The EXF2 bit, like TF2, can generate an interrupt. The capture
mode is illus-trated in Figure 10-1.
Auto-reload (Up or Down Counter):
Timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload
mode. This feature is invoked by the DCEN (Down Counter Enable) bit located in the SFR
T2MOD (see Table 10-2). Upon reset, the DCEN bit is set to 0 so that timer 2 will default to
count up. When DCEN is set, Timer 2 can count up or down, depending on the value of the
T2EX pin.
Baud Rate Generator:
Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON
(Table 5-2). Note that the baud rates for transmit and receive can be different if Timer 2 is
used for the receiver or transmitter and Timer 1 is used for the other function. Setting RCLK
and/or TCLK puts Timer 2 into its baud rate generator mode, as shown in Figure 11-1. The
baud rate generator mode is similar to the auto-reload mode, in that a rollover in TH2 causes
the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and RCAP2L,
which are preset by software.
The baud rates in Modes 1 and 3 are determined by Timer 2’s overflow rate according to
the fol-lowing equation. The Timer can be configured for either timer or counter operation. In
most applications, it is con-figured for timer operation (CP/T2 = 0). The timer operation is
different for Timer 2 when it is used as a baud rate generator. Normally, as a timer, it
B.TECH ECE IV YEAR Aurora’s Engineering College
1907621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
increments every machine cycle (at 1/12 the oscillator frequency). As a baud rate generator,
however, it increments every state time (at 1/2 the oscillator frequency).
The baud rate formula is given below. where (RCAP2H, RCAP2L) is the content of
RCAP2H and RCAP2L taken as a 16-bit unsigned integer. Timer 2 as a baud rate generator is
shown in Figure 11-1. This figure is valid only if RCLK or TCLK = 1 in T2CON. Note that a
rollover in TH2 does not set TF2 and will not generate an inter-rupt. Note too, that if EXEN2
is set, a 1-to-0 transition in T2EX will set EXF2 but will not cause a reload from (RCAP2H,
RCAP2L) to (TH2, TL2).
Thus, when Timer 2 is in use as a baud rate generator, T2EX can be used as an extra
external interrupt. Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate
generator mode, TH2 or TL2 should not be read from or written to. Under these conditions,
the Timer is incremented every state time, and the results of a read or write may not be
accurate. The RCAP2 registers may be read but should not be written to, because a write
might overlap a reload and cause write and/or reload errors. The timer should be turned off
(clear TR2) before accessing the Timer 2 or RCAP2 registers.
Fig 2.2.4(a): Timer 2 in Baud Rate Generator Mode
B.TECH ECE IV YEAR Aurora’s Engineering College
2007621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Programmable Clock Out:
A 50% duty cycle clock can be programmed to come out on P1.0, as shown in Figure 12-1.
This pin, besides being a regular I/O pin, has two alternate functions. It can be programmed to
input the external clock for Timer/Counter 2 or to output a 50% duty cycle clock ranging from
61 Hz to 4 MHz (for a 16-MHz operating frequency). To configure the Timer/Counter 2 as a
clock generator, bit C/T2 (T2CON.1) must be cleared and bit T2OE (T2MOD.1) must be set.
Bit TR2 (T2CON.2) starts and stops the timer. The clock-out frequency depends on the
oscillator frequency and the reload value of Timer 2 capture registers (RCAP2H, RCAP2L), as
shown in the following equation. In the clock-out mode, Timer 2 roll-overs will not generate
an interrupt. This behavior is similar to when Timer 2 is used as a baud-rate generator. It is
possible to use Timer 2 as a baud-rate gen-erator and a clock generator simultaneously. Note,
however, that the baud-rate and clock-out frequencies cannot be determined independently
from one another since they both use RCAP2H and RCAP2L
Fig 2.2.4(b): Timer 2 in clock-out mode
B.TECH ECE IV YEAR Aurora’s Engineering College
2107621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Interrupts:
The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1),
three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts are all
shown in Figure 13-1. Each of these interrupt sources can be individually enabled or disabled
by setting or clearing a bit in Special Function Register IE. IE also contains a global disable
bit, EA, which disables all interrupts at once. Note that Table 13-1 shows that bit position IE.6
is unimplemented.
User software should not write a 1 to this bit position, since it may be used in future AT89
products. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register
T2CON. Nei-ther of these flags is cleared by hardware when the service routine is vectored to.
In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated
the interrupt, and that bit will have to be cleared in software. The Timer 0 and Timer 1 flags,
TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then
polled by the circuitry in the next cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is
polled in the same cycle in which the timer overflows.
Tab 2.2.4(d):Interrupt Enable Register
B.TECH ECE IV YEAR Aurora’s Engineering College
2207621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that
can be configured for use as an on-chip oscillator, as shown in Figure 16-1. Either a quartz
crystal or ceramic resonator may be used. To drive the device from an external clock source,
XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 16-2. There
are no requirements on the duty cycle of the external clock signal, since the input to the
internal clock- ing circuitry is through a divide-by-two flip-flop, but minimum and maximum
voltage high and low time specifications must be observed.
Idle Mode:
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active.
The mode is invoked by software. The content of the on-chip RAM and all the special
functions regis-ters remain unchanged during this mode. The idle mode can be terminated by
any enabled interrupt or by a hardware reset. Note that when idle mode is terminated by a
hardware reset, the device normally resumes pro-gram execution from where it left off, up to
two machine cycles before the internal reset algorithm takes control. On-chip hardware
inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To
eliminate the possibility of an unexpected write to a port pin when idle mode is terminated by
a reset, the instruction following the one that invokes idle mode should not write to a port pin
or to external memory
Power-down Mode:
In the Power-down mode, the oscillator is stopped, and the instruction that invokes Power-
down is the last instruction executed. The on-chip RAM and Special Function Registers retain
their values until the Power-down mode is terminated. Exit from Power-down mode can be
initiated either by a hardware reset or by an enabled external interrupt. Reset redefines the
SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is
restored to its normal operating level and must be held active long enough to allow the
oscillator to restart and stabilize.
B.TECH ECE IV YEAR Aurora’s Engineering College
2307621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Oscillator Connections:
2.2.4(c): configuration of oscillator
Programming the Flash – Parallel Mode:
The AT89S52 is shipped with the on-chip Flash memory array ready to be programmed.
The programming interface needs a high-voltage (12-volt) program enable signal and is
compatible with conventional third-party Flash or EPROM programmers. The AT89S52 code
memory array is programmed byte-by-byte.
Programming Algorithm:
Before programming the AT89S52, the address, data, and control signals should be set up
according to the “Flash Programming Modes” (Table 22-1) and Figure 22-1 and Figure 22-2.
B.TECH ECE IV YEAR Aurora’s Engineering College
2407621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
To program the AT89S52, take the following steps: 1. Input the desired memory location on
the address lines. 2. Input the appropriate data byte on the data lines. 3. Activate the correct
combination of control signals. 4. Raise EA/VPP to 12V. 5. Pulse ALE/PROG once to
program a byte in the Flash array or the lock bits. The byte-write cycle is self-timed and
typically takes no more than 50 μs. Repeat steps 1 through 5, changing the address and data
for the entire array or until the end of the object file is reached.
Data Polling:
The AT89S52 features Data Polling to indicate the end of a byte write cycle. During a write
cycle, an attempted read of the last byte written will result in the complement of the written
data on P0.7. Once the write cycle has been completed, true data is valid on all outputs, and
the next cycle may begin. Data Polling may begin any time after a write cycle has been
initiated.
Ready/Busy:
The progress of byte programming can also be monitored by the RDY/BSY output signal.
P3.0 is pulled low after ALE goes high during programming to indicate BUSY. P3.0 is pulled
high again when programming is done to indicate READY.
Program Verify:
If lock bits LB1 and LB2 have not been programmed, the programmed code data can be
read back via the address and data lines for verification.
The status of the individual lock bits can be verified directly by reading them back.
Reading the Signature Bytes:
The signature bytes are read by the same procedure as a nor-mal verification of locations
000H, 100H, and 200H, except that P3.6 and P3.7 must be pulled to a logic low. The values
returned are as follows. (000H) = 1EH indicates manufactured by Atmel (100H) = 52H
indicates AT89S52 (200H) = 06H
B.TECH ECE IV YEAR Aurora’s Engineering College
2507621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Chip Erase:
In the parallel programming mode, a chip erase operation is initiated by using the proper
combination of control signals and by pulsing ALE/PROG low for a duration of 200 ns - 500
ns. In the serial programming mode, a chip erase operation is initiated by issuing the Chip
Erase instruction. In this mode, chip erase is self-timed and takes about 500 ms. During chip
erase, a serial read from any address location will return 00H at the data output.
Programming the Flash – Serial Mode:
The Code memory array can be programmed using the serial ISP interface while RST is
pulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO (output).
After RST is set high, the Programming Enable instruction needs to be executed first before
other operations can be executed. Before a reprogramming sequence can occur, a Chip Erase
operation is required. The Chip Erase operation turns the content of every memory location in
the Code array into FFH. Either an external system clock can be supplied at pin XTAL1 or a
crystal needs to be connected across pins XTAL1 and XTAL2. The maximum serial clock
(SCK) frequency should be less than 1/16 of the crystal frequency. With a 33 MHz oscillator
clock, the maximum SCK frequency is 2 MHz.
Serial Programming Algorithm:
To program and verify the AT89S52 in the serial programming mode, the following
sequence is recommended: 1. Power-up sequence: a. Apply power between VCC and GND
pins. b. Set RST pin to “H”. If a crystal is not connected across pins XTAL1 and XTAL2,
apply a 3 MHz to 33 MHz clock to XTAL1 pin and wait for at least 10 milliseconds. 2. Enable
serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5.
The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock
at XTAL1 divided by 16. 3. The Code array is programmed one byte at a time in either the
Byte or Page mode. The write cycle is self-timed and typically takes less than 0.5 ms at 5V. 4.
B.TECH ECE IV YEAR Aurora’s Engineering College
2607621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Any memory location can be verified by using the Read instruction which returns the content
at the selected address at serial output MISO/P1.6. 5. At the end of a programming session,
RST can be set low to commence normal device operation. Power-off sequence (if needed): 1.
Set XTAL1 to “L” (if a crystal is not used). 2. Set RST to “L”. 3. Turn VCC power off.
Data Polling:
The Data Polling feature is also available in the serial mode. In this mode, during a write
cycle an attempted read of the last byte written will result in the complement of the MSB of
the serial output byte on MISO.
2.3 Voltage Regulator
A variable regulated power supply, also called a variable bench power supply, is one
where you can continuously adjust the output voltage to your requirements. Varying the
output of the power supply is the recommended way to test a project after having
double checked parts placement against circuit drawings and the parts placement guide.
This type of regulation is ideal for having a simple variable bench power supply.
Actually this is quite important because one of the first projects a hobbyist should
undertake is the construction of a variable regulated power supply. While a dedicated
supply is quite handy e.g. 5V or 12V, it's much handier to have a variable supply on
hand, especially for testing.
Most digital logic circuits and processors need a 5 volt power supply. To use these
parts we need to build a regulated 5 volt source. Usually you start with an unregulated
power To make a 5 volt power supply, we use a LM7805 voltage regulator IC
(Integrated Circuit). The IC is shown below.
B.TECH ECE IV YEAR Aurora’s Engineering College
2707621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Fig 2.3.voltage regulator LM7805
The LM7805 is simple to use. You simply connect the positive lead of your
unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin,
connect the negative lead to the Common pin and then when you turn on the power,
you get a 5 volt supply from the Output pin.
2.3.1 CIRCUIT FEATURES
Brief description of operation: Gives out well regulated +5V output, output current
capability of 100 mA.
Circuit protection: Built-in overheating protection shuts down output when regulator
IC gets too hot.
Circuit complexity: Very simple and easy to build.
Circuit performance: Very stable +5V output voltage, reliable operation.
Availability of components: Easy to get, uses only very common basic components.
B.TECH ECE IV YEAR Aurora’s Engineering College
2807621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Design testing: Based on datasheet example circuit, I have used this circuit succesfully
as part of many electronics projects.
Applications: Part of electronics devices, small laboratory power supply.
Power supply voltage: Unreglated DC 8-18V power supply.
Power supply current: Needed output current + 5 mA.
Component costs: Few dollars for the electronics components + the input transformer
cost.
2.3.2 BLOCK DIAGRAM
Fig 2.3.2: Block Diagram of a power supply
The above block diagram will shows the regulated power supply in this the power
supply can be given from 230V AC supply which will be given to the 12v-0-12v step
down transformer whose output voltage 12V AC. Again this voltage can be converted
B.TECH ECE IV YEAR Aurora’s Engineering College
2907621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
into DC voltage by using the Bridge rectifier, but this voltage is a pulsating DC voltage
and this can be converting into pure DC by connecting the capacitors, and this pure
12V DC will be given to the 7805 voltage regulators whose output voltage is an 5V DC
and this can be given to the microcontroller as a power supply.
2.4 RS232
2.4.1 Serial Communication
Computers transfer data in two ways: parallel and serial. In parallel data transfers, often 8
or more lines (wire conductors) are used for transferring data to a device that is only a few feet
away. Examples of parallel transfers are printers and hard disks, each uses cables with many
wire strips. Although in such cases a lot of data can be transferred in a short amount of time by
using many wires in parallel, the distance cannot be great.
To transfer the data to a device located many meters away, the serial method is used. In
serial communication, the data is sent one bit at a time, in contrast to parallel communication,
in which the data is sent a byte or more at a time. The 8051 has serial communication
capability built into it, thereby making possible fast data transfer using only a few wires.
When a microprocessor communicates with the outside world, it provides the data in byte –
sized chunks. In some cases, such as printers, the information is simply grabbed from the 8-bit
data bus of the printer. This can work only if the cable is not too long,since long cables
diminish and even distort signals. Furthermore, an 8-bit data path is expensive. For these
reasons, serial communication is used for transferring data between two systems located at
distancs of hundreds of feet to millions of miles apart. The figures shows serial vs parallel data
transfers.
Serial data communication uses two methods, asynchronous and synchronous. The
synchronous method transfers a block of data (characters) at a time while the asynchronous
transfers a single byte at a time. It is possible to write software to use either of these methods,
but the programs can be tedious and long. For this reason, there are special IC chips made by
B.TECH ECE IV YEAR Aurora’s Engineering College
3007621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
many manufacturers for serial data communications. These chips are commonly referred to as
UART (Universal Asynchronous Receiver-Transmitter) and USART (Universal Synchronous-
Asynchronous Receiver-Transmitter). The 8051 chip has a built-in UART.
Fig 2.4: RS 232
2.4.2 MAX 232
The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals.
The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single + 5 V supply via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range, as power supply design does not need to be made more complicated just for driving the RS-232 in this case.
The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard 5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V.
The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors – 0.1 μF in place of the 1.0 μF capacitors used with the original device.
The newer MAX3232 is also backwards compatible, but operates at a broader voltage range, from 3 to 5.5V.
B.TECH ECE IV YEAR Aurora’s Engineering College
3107621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
2.4.3Voltage levels
It is helpful to understand what occurs to the voltage levels. When a MAX232 IC receives a TTL level to convert, it changes a TTL Logic 0 to between +3 and +15V, and changes TTL Logic 1 to between -3 to -15V, and vice versa for converting from RS232 to TTL. This can be confusing when you realize that the RS232 Data Transmission voltages at a certain logic state are opposite from the RS232 Control Line voltages at the same logic state. To clarify the matter, see the table below. For more information see RS-232 Voltage Levels.
Fig 2.4.2(a): MAX 232
B.TECH ECE IV YEAR Aurora’s Engineering College
RS232 Line Type & Logic Level RS232 Voltage TTL Voltage to/from MAX232
Data Transmission (Rx/Tx) Logic 0 +3V to +15V 0V
Data Transmission (Rx/Tx) Logic 1 -3V to -15V 5V
Control Signals (RTS/CTS/DTR/DSR) Logic 0 -3V to -15V 5V
Control Signals (RTS/CTS/DTR/DSR) Logic 1 +3V to +15V 0V
3207621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Fig 2.4.2(b): Circuit diagram of MAX 232
2.4.4 An RS232 to TTL level Converter
The circuit shown will convert logic level voltages to and from RS232 serial voltages levels.
Fig 2.4.4:. Circuit diagram of RS 232 to TTL converter
For basic serial comms between a Microchip PIC and a PC or other device you generally only need to connect the Gnd, Txd and Rxd lines.
This little circuit will work with a supply voltage of 3.3v to 5v making it ideal for interfacing with a PIC.
B.TECH ECE IV YEAR Aurora’s Engineering College
3307621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
It derives the negative supply for the RS232 transmit data from the serial RS232 receive data line in a parasitic fashion. This means that the device it's connected to must use voltage levels within the RS232 specification. You can't for example connect two of these back to back since nothing is supplying the negative voltage.
The RS232 physical specification gives a logic 1 at the receiver input as -3 to -25 volts and logic 0 as +3 to +25 volts. You may find that the reliable transmission over long cables, especially in electrically noisy environments with a 3.3v supply is not possible
2.5 LCD Display 16x2
This is the first interfacing example for the Parallel Port. We will start with something simple. This example doesn't use the Bi-directional feature found on newer ports, thus it should work with most, if no all Parallel Ports. It however doesn't show the use of the Status Port as an input. So what are we interfacing? A 16 Character x 2 Line LCD Module to the Parallel Port. These LCD Modules are very common these days, and are quite simple to work with, as all the logic required to run them is on board.
Fig 2.5(a): Circuit diagram of LCD display interfacing with parallel port
2.5.1 Circuit Description
Above is the quite simple schematic. The LCD panel's Enable and Register Select is connected to the Control Port. The Control Port is an open collector / open drain output. While most Parallel Ports have internal pull-up resistors, there are a few which don't. Therefore by
B.TECH ECE IV YEAR Aurora’s Engineering College
3407621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
incorporating the two 10K external pull up resistors, the circuit is more portable for a wider range of computers, some of which may have no internal pull up resistors.
We make no effort to place the Data bus into reverse direction. Therefore we hardwire the R/W line of the LCD panel, into write mode. This will cause no bus conflicts on the data lines. As a result we cannot read back the LCD's internal Busy Flag which tells us if the LCD has accepted and finished processing the last instruction. This problem is overcome by inserting known delays into our program.
The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. As with all the examples, I’ve left the power supply out. You can use a bench power supply set to 5v or use a onboard +5 regulator. Remember a few de-coupling capacitors, especially if you have trouble with the circuit working properly.
Fig 2.5(b): LCD display 16x2
2.5.2 Interfacing an LCD to 8051 Microcontroller
An 8051 program must interact with the outside world using input and output devices
that communicate directly with a human being. One of the most common devices attached to
an 8051 is an LCD display. Some of the most common LCDs connected to the 8051 are 16x2
and 20x2 displays. This means 16 characters per line by 2 lines and 20 characters per line by 2
lines, respectively.
B.TECH ECE IV YEAR Aurora’s Engineering College
3507621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Tab 2.5.2: pin description of LCD
The standard requires 3 control lines as well as either 4 or 8 I/O lines for the data
bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data
bus. If a 4-bit data bus is used the LCD will require a total of 7 data lines (3 control lines plus
the 4 lines for the data bus). If an 8-bit data bus is used the LCD will require a total of 11 data
lines (3 control lines plus the 8 lines for the data bus).
2.5.3 Sending data/command in 4-bit Mode
We will now look into the common steps to send data/command to LCD when working in
4-bit mode. As i already explained in 4-bit mode data is sent nibble by nibble, first we send
higher nibble and then lower nibble. This means in both command and data sending function
we need to separate the higher 4-bits and lower 4-bits.
The common steps are:
Mask lower 4-bits
Send to the LCD port
Send enable signal
B.TECH ECE IV YEAR Aurora’s Engineering College
3607621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Mask higher 4-bits
Send to LCD port
Send enable signal
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the LCD that we are
sending it data. To send data to the LCD, our program should make sure this line is low (0)
and then set the other two control lines and/or put data on the data bus. When the other lines
are completely ready, bring EN high (1) and wait for the minimum amount of time required by
the LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.
The RS line is the "Register Select" line. When RS is low (0), the data is to be treated
as a command or special instruction (such as clear screen, position cursor, etc.). When RS is
high (1), the data being sent is text data which should be displayed on the screen. For example,
to display the letter "T" on the screen we would set RS high.
The RW line is the "Read/Write" control line. When RW is low (0), the information on
the data bus is being written to the LCD. When RW is high (1), the program is effectively
querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command.
All others are write commands--so RW will almost always be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation
selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1,
DB2, DB3, DB4, DB5, DB6, and DB7.
2.5.4 Initialising the LCD
Before we may really use the LCD, we must initialize and configure it. This is
accomplished by sending a number of initialization instructions to the LCD.
B.TECH ECE IV YEAR Aurora’s Engineering College
3707621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
The first instruction we send must tell the LCD whether we'll be communicating with it
with an 8-bit or 4-bit data bus. We also select a 5x8 dot character font. These two options are
selected by sending the command 38h to the LCD as a command. As we will recall from the
last section, we mentioned that the RS line must be low if we are sending a command to the
LCD.
There are also instruction command codes that can be sent to the LCD to clear the
display or force the cursor to the home position or blink the cursor. Table lists the instruction
command code.
Tab 2.5.4: Instruction command code table
To send data we simply need to select the data register. Everything is same as the command
routine. Following are the steps:
Move data to LCD port
select data register
select write operation
B.TECH ECE IV YEAR Aurora’s Engineering College
3807621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
send enable signal
wait for LCD to process the data
2.6 Buzzer Circuit
2.6.1 Details
A Buzzer or beeper is a signaling device, usually electronic, typically used in automobiles, household appliances such as microwave oven. It most commonly consists of a number of switches or sensors connected to a control unit that determines if and which button was pushed or a preset time has lapsed, and usually illuminates a light on the appropriate button or control panel, and sounds a warning in the form of a continuous or intermittent buzzing or beeping sound. Initially this device was based on an electromechanical system which was identical to an electric bell without the metal gong(which makes the ringing noise). Often these units were anchored to a wall or ceiling and used the ceiling or wall as a sounding board. Nowadays, it is more popular to use a ceramic-based piezoelectric sounder like a Sonalert which makes a high-pitched tone. Usually these were booked up to “driver” circuits which varied the pitch of the sound or pulsed the sound on and off.
In game shows it is also known as a “lockout system”, because when one person signals (“buzzes in”), all others are locked out from signaling. Several game shows have large buzzer buttons which are identified as “plungers”.
The word “buzzer” comes from the rasping noise that buzzers made when they were electromechanical devices, operated from stepped-down AC line voltage at 50 or 60 cycles.
2.7 Relays
2.7.1 Relay Description
Solid state relay and semiconductor relay are both names of relay like device which works like a normal relay. Those are usually called also with short name SSR. An SSR is a semiconductor device that can be used in place of a mechanical relay to switch electricity to a load in many applications. Solid-state relays are purely electronic, normally composed of a low current control side (equivalent to the coil on an electromechanical relay) and a high current load side (equivalent to the contact on a conventional relay).SSRs typically also feature electrical isolation to several thousand volts between the control and load sides. Because of this isolation, the load side of the realy is actually powered by the switch line; both line voltage and a load (not to mention a control signal) must be present for the relay to
B.TECH ECE IV YEAR Aurora’s Engineering College
3907621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
operate.
An SSR contains one or more LEDs in the input section. The SSR provides optical coupling to a phototransistor or photodiode array, which in turn connects to driver circuitry that provides an interface to the switching device or devices at the output. The switching device is typically a MOSFET or TRIAC. the following circuit diagrams show typical block diagrams of TRIAC and FET based SSR circuits.
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 off.
Fig 2.7. Circuit diagram of a relay
2.7.2 Benefits of Semiconductor relays
No mechanical moving parts No arching in contacts No contact materials which will appear out in frequent use No inductors on control side No contact bounce Possible to always turn on and off only at zero phase
B.TECH ECE IV YEAR Aurora’s Engineering College
4007621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
High switching speed High reliability Resistance to shock and vibration
2.7.3 Advantages of electromagnetic relay over SSR
Electromagnetic relays usually has an edge over SSRs in applications requiring extremely high voltages and currents. SSRs can’t match the current- carrying capacity and low on resistance of the biggest electromechanical relays.
2.8 Transformer
2.8.1 principle and working
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.
If a load is connected to the secondary, an electric current will flow in the secondary winding and electrical energy will be transferred from the primary circuit through the transformer to the load. In an ideal transformer, the induced voltage in the secondary winding (VS) is in proportion to the primary voltage (VP), and is given by the ratio of the number of turns in the secondary (NS) to the number of turns in the primary (NP) as follows:
By appropriate selection of the ratio of turns, a transformer thus allows an alternating current (AC) voltage to be "stepped up" by making NS greater than NP, or "stepped down" by making NS less than NP.
In the vast majority of transformers, the windings are coils wound around a ferromagnetic core, air-core transformers being a notable exception.
2.8.1Transformer 24v, 1A(12-0-12)
B.TECH ECE IV YEAR Aurora’s Engineering College
4107621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
12-0-12 means that the voltage or the potential difference (p.d.) between each of the end terminal of the secondary winding and the mid-point of the secondary winding of the transformer is 12V. And, between the two ends of the secondary winding, you will get 12 + 12 = 24V. 1A means the current delivery capability of the secondary winding of the transformer. Normally it is said in VA. The ratings are arrived at based on the requirements of the loads that are to be connected to the transformer. The limiting criteria is the winding wire thickness and the insulation of the winding.
Fig 2.8: Structure of transformer
2.9 Rectifier
A rectifier is an electrical device that converts alternating current (AC) to direct current (DC), a process known as rectification. Rectifiers have many uses including as components of power supplies and as detectors of radio signals. Rectifiers may be made of solid state diodes, vacuum tube diodes, mercury arc valves, and other components.
2.9.1 Half-wave rectification
In half wave rectification, either the positive or negative half of the AC wave is passed, while the other half is blocked. Because only one half of the input waveform reaches the output, it is very inefficient if used for power transfer. Half-wave rectification can be achieved with a single diode in a one-phase supply, or with three diodes in a three-phase supply.
B.TECH ECE IV YEAR Aurora’s Engineering College
4207621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Fig 2.9.1: Half wave rectifiers and their waveforms
The output DC voltage of a half wave rectifier can be calculated with the following two ideal equations:
2.9.2 Full-wave rectification
A full-wave rectifier converts the whole of the input waveform to one of constant polarity (positive or negative) at its output. Full-wave rectification converts both polarities of the input waveform to DC (direct current), and is more efficient. However, in a circuit with a non-center tapped transformer, four diodes are required instead of the one needed for half-wave rectification. Four diodes arranged this way are called a diode bridge or bridge rectifier:
Fig 2.9.2(a): Graetz bridge rectifier: a full-wave rectifier using 4 diodes.
For single-phase AC, if the transformer is center-tapped, then two diodes back-to-back (i.e. anodes-to-anode or cathode-to-cathode) can form a full-wave rectifier. Twice as many windings are required on the transformer secondary to obtain the same output voltage compared to the bridge rectifier above.
B.TECH ECE IV YEAR Aurora’s Engineering College
4307621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Fig 2.9.2(b): Full-wave rectifier using a transformer and 2 diodes.
CHAPTER-3
ZIGBEE AND RFID
B.TECH ECE IV YEAR Aurora’s Engineering College
4407621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
3.1 RFID
RFID (Radio Frequency Identification) tec hnology has been around for many years.
Prior to the year 2000, common uses for RF-ID in the USA included toll way passes, access
ID cards and the tiny ID chips that are inserted in animals for identification. The recent
introduction of RFID in the supply chain as well as several mandates has added to the
awareness and value of this technology.
RFID tags operate at several different frequencies. The majority of RFID tags operate at
either 13 MHZ or 900 MHZ. Think of these two frequencies as the AM and FM bands on your
radio. Each one has its advantages. For example, one works better when surrounded by metal
while the other will work better over long distances.
13 MHZ (HF) tags are generally better at penetrating liquids and are usually used for
access control such as in security cards and wristbands. The read range at this frequency is
about 3 feet or 1 meter.
900 MHZ (UHF) tags operate better when reading multiple tags simultaneously, and thus
are generally the tag type of choice for inventory purposes. The read range at this frequency is
about 3-10 feet or more depending on what type of reader, interrogator or access point is used.
Most RFID tags do not contain any data in them after they are manufactured; they are
similar to a blank label waiting for information to be printed on them. To place information in
the tag, an encoder must be used. One of the most popular methods of encoding is with an
RFID Capable Label Printer that has a built-in encoder and RFID Capable Barcode Label
Software. There are basically three types (called classes) of tags:
Class 0 - these tags are like a license plate in that they are read only and are encoded with data
when they are manufactured.
B.TECH ECE IV YEAR Aurora’s Engineering College
4507621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Class 1 - these tags allow you to write the data in the tag and are usually one time
programmable (OTP). These are available in either HF or UHF versions and are known as
GEN1.
Class 1 GEN2 EPC (GEN2) - these tags are the latest type of UHF tag and are the types of
tags most referred to in this document. They are also the tags required for mandates by various
suppliers such as Wal-Mart and the US Department of Defense (DOD). In the industry, we
refer to these tags simply as GEN2. These tags are 96 bits or larger and contain advanced
features such as lock after write and CRC read verification.
The following components are required to write data (encode) to class 1 tags:
Software Application à Encoder Software à Tag Encoder à RFID Tag
The following components are required to read data from the tag:
RFID Tag à Reader, Interrogator or Access Point à Decoding Software à Software
Application.
IDAutomation.com provides some components of this system including Software
Applications, Encoder Software and Tag Writers.
3.1.1 RFID vs Barcodes
Barcoding is a mature technology that has been around for many years, unlike RFID which
is still in its infancy. Additionally, the components used to read and write bar codes have come
down in price because of this maturity and sales volume. There are many additional issues to
consider with RFID, such as those listed below in the Disadvantages of RFID section.
However,all things considered, RFID has many advantages over barcoding. In some cases,
these advantages outweigh the disadvantages and high cost of the components. Decision
makers must carefully consider whether RFID really provides an advantage over barcoding in
their business model.
B.TECH ECE IV YEAR Aurora’s Engineering College
4607621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
3.1.2 Advantages and Disadvantages of RFID
Advantages:
Inventory efficiency - Because line of sight is not required to read RFID tags, inventory
can be performed in a highly efficient method. For example, pallets in a warehouse can be
read, inventoried, and their location can be determined no matter where the tag is placed on
the pallet. This is because the radio waves from the reader are strong enough for the tag to
respond regardless of location.
Return on investment - Though the cost may be high at first, the total cost of ownership
should go down over the years and provide a return on investment (ROI), if the
implementation provides a significant method to improve business processes.
Vulnerability to damage minimized - barcodes can be damaged in many ways. Although,
2D barcode types such as Data Matrix can be read even when up to 40% of the barcode is
damaged.
Disadvantages:
Dead areas and orientation problems - RFID works similar to the way a cell phone or
wireless network does. Just like these technologies, there may be certain areas that have
weaker signals or interference. In addition, poor read rates are sometimes a problem when the
tag is rotated into an orientation that does not align well with the reader. These issues can
usually be minimized by properly implementing multiple readers and using tags with multiple
axis antennas.
B.TECH ECE IV YEAR Aurora’s Engineering College
4707621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Security concerns - Because RFID is not a line of sight technology like barcoding, new
security problems could develop. For example, a competitor could set up a high gain
directional antenna to scan tags in trucks going to a warehouse. From the data received, this
competitor could determine flow rates of various products. Additionally, when RFID is used
for high security operations such as payment methods, fraud is always a possibility.
Ghost tags - In rare cases, if multiple tags are read at the same time the reader will
sometimes read a tag that does not exist. Therefore, some type of read verification, such as a
CRC, should be implemented in either the tag, the reader or the data read from the tag.
Proximity issues - Tags cannot be read well when placed on metal or liquid objects or
when these objects are between the reader and the tag. Nearly any object that is between the
reader and the tag reduces the distance the tag can be read from.
High cost - Because this technology is new, the components and tags are expensive
compared to barcodes. In addition, software and support personnel that are needed to install
and operate the RFID reading systems (in a warehouse for example) may be more costly to
employ.
Unread tags - When reading multiple tags at the same time, it is possible that some tags
will not be read and there is no sure method of determining this when the objects are not in
sight. This problem does not occur with barcodes, because when the barcode is scanned, it is
instantly verified when read by a beep from the scanner and the data can then be entered
manually if it does not scan.
B.TECH ECE IV YEAR Aurora’s Engineering College
4807621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Vulnerable to damage - Water, static discharge or high power magnetic surges (such as from
a close lightning strike) may damage the tags.
Fig 3.1: RFID module
3.2 ZigBee
ZigBee is a specification for a suite of high level communication protocols using small,
low-power digital radios based on the IEEE 802.15.4-2003 standard for wireless personal area
networks (WPANs), such as wireless headphones connecting with cell phones via short-range
radio. The technology defined by the ZigBee specification is intended to be simpler and less
expensive than other WPANs, such as Bluetooth. ZigBee is targeted at radio-frequency (RF)
applications that require a low data rate, long battery life, and secure networking.
3.2.1 Overview
ZigBee is a low-cost, low-power, wireless mesh networking proprietary standard. The low
cost allows the technology to be widely deployed in wireless control and monitoring
applications, the low power-usage allows longer life with smaller batteries, and the mesh
networking provides high reliability and larger range.
The ZigBee Alliance, the standards body that defines ZigBee, also publishes application
profiles that allow multiple OEM vendors to create interoperable products. The current list of
application profiles either published or in the works are:
B.TECH ECE IV YEAR Aurora’s Engineering College
4907621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
* Home Automation
* ZigBee Smart Energy
* Commercial Building Automation
* Telecommunication Applications
* Personal, Home, and Hospital Care
* Toys
The relationship between IEEE 802.15.4 and ZigBee is similar to that between IEEE
802.11 and the Wi-Fi Alliance. The ZigBee 1.0 specification was ratified on 14 December
2004 and is available to members of the ZigBee Alliance. Most recently, the ZigBee 2007
specification was posted on 30 October 2007. The first ZigBee Application Profile, Home
Automation, was announced 2 November 2007.
ZigBee operates in the industrial, scientific and medical (ISM) radio bands; 868 MHz in
Europe, 915 MHz in the USA and Australia, and 2.4 GHz in most jurisdictions worldwide.
The technology is intended to be simpler and less expensive than other WPANs such as
Bluetooth.
ZigBee chip vendors typically sell integrated radios and microcontrollers with between
60K and 128K flash memory, such as the Jennic JN5148, the Freescale MC13213, the Ember
EM250, the Texas Instruments CC2430, the Samsung Electro-Mechanics ZBS240 and the
Atmel ATmega128RFA1. Radios are also available stand-alone to be used with any processor
or microcontroller. Generally, the chip vendors also offer the ZigBee software stack, although
independent ones are also available.
Because ZigBee can activate (go from sleep to active mode) in 15 msec or less, the latency
can be very low and devices can be very responsive — particularly compared to Bluetooth
wake-up delays, which are typically around three seconds. [2] Because ZigBees can sleep
most of the time, average power consumption can be very low, resulting in long battery life.
B.TECH ECE IV YEAR Aurora’s Engineering College
5007621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
The first stack release is now called ZigBee 2004. The second stack release is called ZigBee
2006, and mainly replaces the MSG/KVP structure used in 2004 with a "cluster library". The
2004 stack is now more or less obsolete.
ZigBee 2007, now the current stack release, contains two stack profiles, stack profile 1
(simply called ZigBee), for home and light commercial use, and stack profile 2 (called ZigBee
Pro). ZigBee Pro offers more features, such as multi-casting, many-to-one routing and high
security with Symmetric-Key Key Exchange (SKKE), while ZigBee (stack profile 1) offers a
smaller footprint in RAM and flash. Both offer full mesh networking and work with all
ZigBee application profiles.
ZigBee 2007 is fully backward compatible with ZigBee 2006 devices: A ZigBee 2007
device may join and operate on a ZigBee 2006 network and vice versa. Due to differences in
routing options, ZigBee Pro devices must become non-routing ZigBee End-Devices (ZEDs)
on a ZigBee 2006 or ZigBee 2007 network, the same as ZigBee 2006 or ZigBee 2007 devices
must become ZEDs on a ZigBee Pro network. The applications running on those devices work
the same, regardless of the stack profile beneath them.
3.2.2 Uses:
ZigBee protocols are intended for use in embedded applications requiring low data rates
and low power consumption. ZigBee's current focus is to define a general-purpose,
inexpensive, self-organizing mesh network that can be used for industrial control, embedded
sensing, medical data collection, smoke and intruder warning, building automation, home
automation, etc. The resulting network will use very small amounts of power — individual
devices must have a battery life of at least two years to pass ZigBee certification.
Typical application areas include
* Home Entertainment and Control — Smart lighting, advanced temperature control,
safety and security, movies and music.
* Home Awareness — Water sensors, power sensors, energy monitoring, smoke and fire
detectors, smart appliances and access sensors.
B.TECH ECE IV YEAR Aurora’s Engineering College
5107621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
* Mobile Services — m-payment, m-monitoring and control, m-security and access control,
m-healthcare and tele-assist.
* Commercial Building — Energy monitoring, HVAC, lighting, access control.
* Industrial Plant — Process control, asset management, environmental management,
energy management, industrial device control.
Fig 3.2: Structure of zigbee module
CHAPTER-4
SCHEMATIC DIAGRAM
&
WORKING
B.TECH ECE IV YEAR Aurora’s Engineering College
5207621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
4.1 SCHEMATIC DIAGRAM
B.TECH ECE IV YEAR Aurora’s Engineering College
5307621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Fig 4.1: Circuit Diagram of the system
4.2 Hardware Description
4.2.1 Interfacing RFID and ZigBee
The emerging technology of radio frequency identification (RFID) promises to be a comprehensive approach to data collection. One of its potential applications includes the improvement of supply-chain operations, offering a more automated and informative alternative to barcode. RFID technology is an identification method that remotely reads data stored on devices called RFID tags using interrogator devices called RFID readers. Each tag contains an identification number, a unique value attributed to it. Collecting these IDs in a
B.TECH ECE IV YEAR Aurora’s Engineering College
5407621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
central location has the potential of enabling a virtual representation of an up-to-date inventory.
As extensive as the possibilities of the technology are, they are limited by the anticipated difficulties of implementation. For typical applications, such as deployment in a retail setting, multiple RFID readers are densely distributed throughout a store with a single central node to control the network and manage the vast amount of data collected.
Because of the number of readers transmitting their data to the central node through hardwired connections, installing a complete wired infrastructure is necessary to accommodate the data transmission. This increases the installation cost and the hassle of implementation, detracting from the appeal of RFID. To improve this situation, the major ambition of this project is to enable a wireless communication between the central node and the RFID readers. Having RFID readers that wirelessly update the inventory would lower installation costs and increase the flexibility of the system.
The first step in allowing the central node and readers to communicate wirelessly is to choose the protocol to use. The relatively new ZigBee standard, specified by IEEE 802.15.4, is fitting because it is designed for low cost and low power applications in particular. Choosing a standards-based technology over a proprietary solution is beneficial because it offers more flexibility and universal functionality. Of the available wireless standards, ZigBee was determined to be the appropriate solution because Wi-Fi and Bluetooth were more expensive and had higher power consumption due to the bandwidth and system resources offered.
The next critical decision in the design process was how to implement the ZigBee standard. It was concluded that the most desirable method was to purchase preassembled development boards with the IEEE 802.15.4 and ZigBee protocol preloaded. This saved valuable implementation time. A development kit from Silicon Laboratories with six modules was chosen to serve as the ZigBee component to enable the wireless communication within an RFID system.
This integration of ZigBee and RFID has the potential to offer the retail industry a cost-efficient solution to installing an RFID system by eliminating the need for a wired infrastructure. The prototype created in this project demonstrates that ZigBee technology is a viable option to use for an RFID system to communicate wirelessly.
4.3 Principle and working of the project
B.TECH ECE IV YEAR Aurora’s Engineering College
5507621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
In this project we are using the different hardware modules RFID Tag and Reader, ZigBee
module and ARM7 based microcontroller .i.e., LPC2148. Buzzer and LCD display unit. And
the power supply here we are using is Regulated power supply.
The Passive RFID Tag consists of antenna and chip. The chip is programmed according the
application we are using and the tag is activated when it comes in to the range of RFID reader.
The RFID reader will be is connected to the microcontroller module and that information
which is gathered by using the RFID reader will be transmitted to other microcontroller
module by using zigbee wireless protocol. That microcontroller will process and compare the
data with predefined information. Buzzer will be blow if there is mismatch of the data.
This RFID tag is programmed and will be placed in the person’s passport at the time of
issuing of the passport. When this person’s passport is copied by another person he can’t copy
the data which is written to RFID Tag. Microcontroller module which consists of RFID reader,
ZigBee and LPC2148 microcontroller and this will be placed at the entrance gate of
AIRPORT checking place. When ever the person crossing the gate that tag information will be
read by the reader and microcontroller module will check for authentication and the same
information is passed to the immigration department. If it is not authenticated alarm sound is
given.
B.TECH ECE IV YEAR Aurora’s Engineering College
5607621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
CHAPTER-5
SOFTWARE
5.1 Keil compiler
B.TECH ECE IV YEAR Aurora’s Engineering College
5707621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
The Keil compiler has been written to allow C programmers to get code running quickly on 8051 systems with little or no learning curve. However, to get the best from it,some appreciation of the underlying hardware is desirable.
C can be a rather terse and mystifying language. Widely quoted as being a high level language,C does indeed contain many such features like structured programming, defined procedure calling, parameter passing, powerful control structures etc. However much of the power of C lies in its ability to combine simple, low-level commands into complicated high-level language-like functions and allow access to the actual bytes and words of the host processor.
Keil software is pleased to announce simulation support for the Atmel AT91 ARM family of microcontrollers. The Keil µVision Debugger simulates the complete ARM instruction-set as well as the on-chip peripherals for each device in the AT91 ARM/Thumb microcontroller family. The integrated simulator provides complete peripheral simulation. Other new features in the µ Vision Debugger include:
An integrated Software Logic Analyzer that measures I/O signals as well as program variables and helps developers to create complex signal processing algorithms.
An Execution Profiler that measures time spent in each function, source line, and assembler instruction. Now developers can find exactly where programs spend the most time.
Using nothing more than the provided simulation support and debug scripts, developers can create a high-fidelity simulation of their actual target hardware and environment. No extra hardware or test equipment is required. The Logic Analyzer and Execution Profiler will help developers when it comes time to develop and tune signaling algorithms.
B.TECH ECE IV YEAR Aurora’s Engineering College
5807621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
The following chart shows the Keil development tools and how they interface to each other.
Third-Party Utilities extend the functions and capabilities of µVision.
Keil PK51 is a complete software development environment for classic and extended 8051 microcontrollers. Like all Keil tools, it is easy to learn and use.
RTX Real-Time Kernels enables the development of real-time software.
Fig 5.1: Software tools
5.2 μVision Debugger
The μVision Debugger is completely integrated into the μVision IDE. It provides the
following features:
Disassembly of the code on C/C++ source- or assembly-level with program execution in
various stepping modes and various view modes, like assembler, text, or mixed mode
Multiple breakpoint options including access and complex breakpoints
Bookmarks to quickly find and define your critical spots
Review and modify memory, variable, and register values
List the program call tree including stack variables
Review the status of on-chip microcontroller peripherals
B.TECH ECE IV YEAR Aurora’s Engineering College
5907621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Debugging commands or C-like scripting functions
Execution Profiling to record and display the time consumed, as well as the cycles needed
for each instruction
Code Coverage statistics for safety-critical application testing
Various analyzing tools to view statistics, record values of variables and peripheral I/O
signals, and to display them on a time axis
Instruction Trace capabilities to view the history of executed instructions
Define personalized screen and window layouts
Fig 5.2: overview of keil software
5.3 Micro Controller Flash Programmer
To program our micro-controller we’ve to go for in system programming. Systems programming (or system programming) is the activity of programming system software. The primary distinguishing characteristic of systems programming when compared to application programming is that application programming aims to produce software which provides services to the user (e.g. word processor), whereas systems programming aims to produce software which provides services to the computer hardware(disk defragmenter). It also requires a greater degree of hardware awareness.
B.TECH ECE IV YEAR Aurora’s Engineering College
6007621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
ISP is a way to serially program our microcontroller, while it resides in its place, in other words, without removing the chip from your board. ISP (In System Programming) will provide you a simple and affordable home made solution to program and debug microcontroller based project.
Sometimes, ISP can become very useful, when adjusting some delays, frequencies or any other values that one would intend to find by trial and error.
5.3.2 Pins Used For ISP
MOSI : data input MISO : data output SCK :clock input RESET :used to activate the serial programming
Fig 5.3: overview of flash magic
5.3.1 Features
B.TECH ECE IV YEAR Aurora’s Engineering College
6107621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
Reads the device signature
Erases part or all of the flash memory
Programs a hex file into the device
Verifies a hex file was programmed into the device
Reads the security bits
Programs the security bits
Checks a section or all of the flash memory is blank
Reads data from the flash memory
Reads the boot vector and status byte
Erases the boot vector and status byte
Programs the boot vector
Programs the status byte
Reads data from the flash memory into a buffer
Resets the device
Selects a debug mode for the DLL
B.TECH ECE IV YEAR Aurora’s Engineering College
6207621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
CHAPTER-6
CONCLUSION
B.TECH ECE IV YEAR Aurora’s Engineering College
6307621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
6.1 Conclusion
The project “RFID & Zigbee Based Passport Verification” has been successfully designed and tested.
It has been developed by integrating features of all the hardware components used.
Presence of every module has been reasoned out and placed carefully thus contributing to the
best working of the unit.
Secondly, using highly advanced IC’s and with the help of growing technology the
project has been successfully implemented.
6.2 Applications:
6.2.1 Applications based on dual technology
The dual technology project using Zigbee and RFID is new to the technological arena. Therefore, there are not many applications based on the interfacing of both.
Some of them are:
Data Communication in companies can be carried through this process. This interfacing technology is also used in hospital automation. This is also used in logistics management.
6.2.2 Applications of RFID:
RFID based location management. Mobile tracking using RFID. Blind navigation system based on RFID. Intelligent Parallel Parking of a Car-like Mobile Robot Using RFID Technology . An Elementary Electronic Voting Protocol Using RFID
6.2.3 Applications of ZigBee:
B.TECH ECE IV YEAR Aurora’s Engineering College
6407621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
A ZigBee-Based Power Monitoring System with Direct Load Control Capabilities. ZigBee Device Access Control & Reliable Data Transmission in ZigBee Based Health
Monitoring System. A zigbee network-based multi-channel heart rate monitoring system for exercising
rehabilitation patients . Design and Implementation of ZigBee based URC Applicable to Legacy Home
Appliances.
6.2.4 Applications of AT89S52:
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory.
The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory pro-grammer.
By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.
B.TECH ECE IV YEAR Aurora’s Engineering College
6507621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
CHAPTER-7
BIBILIOGRAPHY
B.TECH ECE IV YEAR Aurora’s Engineering College
6607621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
\
Books referred:
The 8051 Micro controller and Embedded Systems -Muhammad Ali Mazidi Janice Gillispie Mazidi
The 8051 Micro controller Architecture, Programming & Applications
-Kenneth J.Ayala
Fundamentals Of Micro processors and Micro computers
-B.Ram
Micro processor Architecture, Programming & Applications
-Ramesh S.Gaonkar
Electronic Components
-D.V.Prasad
Wireless Communications - Theodore S. Rappaport
References on the Web:
www.national.comwww.nxp.com
B.TECH ECE IV YEAR Aurora’s Engineering College
6707621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
www.8052.com www.microsoftsearch.comwww.geocities.comwww.embeddedsystems.comwww.wikipedia.org
CHAPTER-8
APPENDIX
B.TECH ECE IV YEAR Aurora’s Engineering College
6807621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
8.1 Source Code
8.1.1RFID
# include "LcdV2.h"# include "define.h"# include "stdio.h"
void sendstring(unsigned char *);
sbit Mux = P2^0;
# define NO_OF_CARDS 5 # define OPEN 0# define CLOSE 1# define RX_BUF_SIZE 20# define RFID_CODE_SIZE 10# define CR_LF_SIZE 2
# define DEBUG 1
unsigned char gucAccessCards[NO_OF_CARDS][10] = { {'1','D','0','0','B','D','2','0','5','D'}, {'1','D','0','0','4','5','2','4','0','4'} };
unsigned char gucCardNumber[10];unsigned char gucRxBuf[RX_BUF_SIZE];unsigned char gucRxCount = 0;unsigned char gucReadFlag = 0;
void DisplayVersion();void SerialInit(void);void ReadCard(void);unsigned char CheckCard(void);void sendchar(unsigned char);void serial0() interrupt 4{
if(RI == 1)
B.TECH ECE IV YEAR Aurora’s Engineering College
6907621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
{P2_6 = !P2_6;gucRxBuf[gucRxCount] = SBUF;gucRxCount++;if(gucRxCount >= (RFID_CODE_SIZE + CR_LF_SIZE)){
gucRxCount = 0;gucReadFlag = 1;
}RI = 0;
}}
void main(void){
unsigned int i = 0;unsigned int j = 0;
IE = 0x82;SerialInit();DisplayVersion();
for(j = 0; j < 15; j++)for(i = 0; i < 10000; i++);
while(1){
Mux = 0;for(i = 0; i < RX_BUF_SIZE; i++)gucRxBuf[i] = 0x00;gucRxCount = 0;LcdInit();LcdPuts("Show ur Card: ");
ReadCard();
LcdInit();Mux = 1;if(!CheckCard()){
LcdPuts("Access Denied ... ");LcdCmd(NEW_LINE);LcdPuts("Try Again ... ");
B.TECH ECE IV YEAR Aurora’s Engineering College
7007621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
sendstring("Denied");sendchar('\n');
}else{
sendstring("Accepted");sendchar('\n');
LcdPuts("Access Granted .");LcdCmd(NEW_LINE);LcdPuts("Lock is Opened .");for(j = 0; j < 10; j++)
for(i = 0; i < 10000; i++);LcdInit();LcdPuts("Locking Again .... ");for(j = 0; j < 15; j++)
for(i = 0; i < 10000; i++);}for(j = 0; j < 10; j++)
for(i = 0; i < 5000; i++);}
}
void SerialInit(void){
TMOD = 0x10;TH1 = 0xfd;SCON = 0x10;TR1 = 1;
}
void sendstring(unsigned char *str){
while(*str !='\0'){SBUF = *str;while(!TI);TI=0;str++;}SBUF = '\n';
while(!TI);TI=0;
}
B.TECH ECE IV YEAR Aurora’s Engineering College
7107621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
void DisplayVersion(){
LcdInit();LcdPuts(" PASS PORT");LcdCmd(NEW_LINE);LcdPuts(" VERIFICATION");
}
void ReadCard(void){
unsigned char i = 0;// LOCK_PORT = OPEN;
while(gucReadFlag == 0);
for(i = 0; i < RFID_CODE_SIZE; i++){
gucCardNumber[i] = gucRxBuf[i];}gucReadFlag = 0;
}
unsigned char CheckCard(void){
unsigned char i = 0;unsigned char j = 0;
for(i = 0; i < NO_OF_CARDS; i++){
for(j = 0; j < RFID_CODE_SIZE; j++){
if(gucCardNumber[j] != gucAccessCards[i][j])break;
if(j == RFID_CODE_SIZE-1)return 1;
}}return 0;
}
void sendchar(unsigned char ch){
SBUF =ch;
B.TECH ECE IV YEAR Aurora’s Engineering College
7207621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
while(!TI);TI=0;
}
8.1.2 LCD v2
# include <8052.h>
# ifndef __LCD_V1__# define __LCD_V1__
/* ******************************************************************** Macro Definitions */# define LCD_DELAY 400
# define LCD_PORT P0# define RS P0_0# define RW P0_1# define EN P0_2
# define INIT_CMD 0x0F# define NEW_LINE 0xC0
/* ********************************************************************* Global Variables */bit gbStatus = 0;
/* *************************************************************************************** */void Delay(unsigned int j){
unsigned int i;for(i = 0; i < j ; i++);
}
/* *************************************************************************************** */void LcdInitWrite(unsigned char ucCmd){
RS = 1;
B.TECH ECE IV YEAR Aurora’s Engineering College
7307621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
RW = 1;LCD_PORT = ucCmd;EN = 1;Delay(LCD_DELAY);EN = 0;
}
/* *************************************************************************************** */void LcdCmd(unsigned char ucCmd){
unsigned char ucTemp; if(gbStatus) {
gbStatus=0;goto NEXT;
}RS = 1;
NEXT:RW = 1;ucTemp = ucCmd;ucTemp &= 0xf0;LCD_PORT &= 0x0f;LCD_PORT |= ucTemp;EN = 1;Delay(LCD_DELAY);EN = 0;ucTemp = (ucCmd << 4);ucTemp &= 0xf0;LCD_PORT &= 0x0f;LCD_PORT |= ucTemp;EN = 1;Delay(LCD_DELAY);EN = 0;
}
/* *************************************************************************************** */void LcdData(unsigned char ucData){
gbStatus = 1;
B.TECH ECE IV YEAR Aurora’s Engineering College
7407621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
RS = 0;LcdCmd(ucData);
}
/* *************************************************************************************** */void LcdInit(void){
Delay(LCD_DELAY);LcdInitWrite(0x30);Delay(LCD_DELAY);LcdInitWrite(0x30);Delay(LCD_DELAY);LcdInitWrite(0x30);Delay(LCD_DELAY);LcdInitWrite(0x20);Delay(LCD_DELAY);LcdCmd(0x28);Delay(LCD_DELAY);LcdCmd(4);Delay(LCD_DELAY);LcdCmd(0x85);Delay(LCD_DELAY);LcdCmd(6);Delay(LCD_DELAY);LcdCmd(1);Delay(LCD_DELAY);LcdCmd(INIT_CMD);Delay(LCD_DELAY);
}
/* *************************************************************************************** */void LcdPuts(unsigned char *ucStr){
unsigned int i;
for(i = 0; ucStr[i] !=0 ; i++)LcdData(ucStr[i]);
}
B.TECH ECE IV YEAR Aurora’s Engineering College
7507621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
/* *************************************************************************************** */void LcdPutc(unsigned char ucCh){
LcdData(ucCh);}
/* *************************************************************************************** */void LcdGotoXy(unsigned char x, unsigned char y){
if(x == 0){
LcdCmd(0x80 + y);}if(x == 1){
LcdCmd(0xc0 + y);}
}/* *************************************************************************************** */void LcdClear(void){
LcdCmd(0x01);}/* *************************************************************************************** */void LcdPutc_dec(unsigned char ucCh){
unsigned char d1;d1 = ucCh % 10;LcdData(d1+0x30);
}/* *************************************************************************************** */void LcdPutc_dec1(unsigned char ucCh){
unsigned char d1,d2;
B.TECH ECE IV YEAR Aurora’s Engineering College
7607621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
d1 = ucCh % 10;d2 = ucCh / 10;LcdData(d1+0x30);LcdData(d2+0x30);
}/* *************************************************************************************** */# endif
8.1.3 DEFINE
# ifndef __DEFINE_H__# define __DEFINE_H__
# define KEIL_C51
# ifndef KEIL_C51
# else# include <reg52.h># endif
//# include <p89c51rd2.h>
# define U8 unsigned char# define S8 char# define U32 unsigned int# define S32 int# define U16 unsigned int# define S16 int# define U32_8051 unsigned long
extern void ToAsciiDecimal(U32 uiValue, S8 *ucAscii);
# ifdef KEIL_C51
sbit P0_0 = P0^0;sbit P0_1 = P0^1;sbit P0_2 = P0^2;sbit P0_3 = P0^3;sbit P0_4 = P0^4;sbit P0_5 = P0^5;sbit P0_6 = P0^6;
B.TECH ECE IV YEAR Aurora’s Engineering College
7707621A0425 Passport Verification Using ZIGBEE And RFID Technology
07621A0432
sbit P0_7 = P0^7;
sbit P1_0 = P1^0;sbit P1_1 = P1^1;sbit P1_2 = P1^2;sbit P1_3 = P1^3;sbit P1_4 = P1^4;sbit P1_5 = P1^5;sbit P1_6 = P1^6;sbit P1_7 = P1^7;
sbit P2_0 = P2^0;sbit P2_1 = P2^1;sbit P2_2 = P2^2;sbit P2_3 = P2^3;sbit P2_4 = P2^4;sbit P2_5 = P2^5;sbit P2_6 = P2^6;sbit P2_7 = P2^7;
sbit P3_0 = P3^0;sbit P3_1 = P3^1;sbit P3_2 = P3^2;sbit P3_3 = P3^3;sbit P3_4 = P3^4;sbit P3_5 = P3^5;sbit P3_6 = P3^6;sbit P3_7 = P3^7;
# define __reentrant # define __code # endif
# endif
B.TECH ECE IV YEAR Aurora’s Engineering College