zigbee based vehicle access control system
TRANSCRIPT
ZIG-BEE BASED VEHICLE ACCESS CONTROL SYSTEM
A PROJECT REPORT
Submitted by
T.PRASATH (31907106067)
S.PRAVEEN KUMAR (31907106068)
V.SRINATH (31907106098)
in partial fulfillment for the award of the degree
of
BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION
THANGAVELU ENGINEERING COLLEGE, KARAPAKKAM.
ANNA UNIVERSITY: CHENNAI 600025
APRIL 2011
ANNA UNIVERSITY: CHENNAI 600 025
BONAFIDE CERTIFICATE
Certified that this project report “ZIG-BEE BASED VEHICLE ACCESS
CONTROL SYSTEM” is the bonafide work of T.PRASATH (31907106067),
S.PRAVEEV KUMAR (31907106068),V.SRINATH (31907106098) who carried
out the project work under my supervision.
SIGNATURE
SIGNATURE Mrs.M . NIRANJALA B.E.,
HEAD OF THE DEPARTMENT, SUPERVISOR
Department of Electronics and Department of Electronics and
Communication Engineering, Communication Engineering,
Thangavelu Engineering College, Thangavelu Engineering College,
Karapakkam, Chennai – 97. Karapakkam, Chennai – 97.
Submitted for Viva-Voce examination of Anna University, Chennai, held at
Thangavelu Engineering College, Karapakkam on _________
INTERNAL EXAMINER EXTERNAL EXAMINER
ACKNOWLEDGEMENT
We wish to express our sincere thanks and heart felt gratitude to our
founder chairman MR. K.V.THANGKABALU and our chair person
Mrs.JAYANTHI THANGABALU, of THANGAVELU ENGINEERING
COLLEGE, for their support through the institution.
We express our sincere thanks to our principal, DR. FRANKLIN
JEBARAJ M.E, Ph.D and our head of the department of Electronics and
Communication engineering, and MR. MANICKAM, project incharge for their
encouragement.
We dedicate our sincere thanks to our project guide, Mrs. M.NIRANJALA
B.E, Lecturer, of Electronics and Communication Engineering, for being
instrumental in making the project a successful one. Her valuable assistance was
present in all steps of work.
We thank our parents and teachers and all good hearts that inspired us during
our project and made this project a successful one.
Last but not the least we thank the ALMIGHTY.
ABSTRACT
Vehicle access control system is an important sub-system of the
intelligentized residence section. Today, in a growing emphasis on personal and
property safety, the control of vehicles, access authorization and the management
of the vehicles’ access authority, access time and access method via computer, is
safe and convenient. The zigBee based vehicle access control is an advanced
protection technology , that is intended to provide safe transportation of vehicles in
shipping yards prior to their delivery to the customer. This system uses three
technologies for the purpose of authorization. The authorization entities include the
conventional key entry, RFID tag based authorization and, image verification..The
communication part of this unit is being handled by zigBee transmission. This
paper describes a set of vehicle access control system based on ZigBee wireless
technology. In this system, ZigBee coordinator and its terminal nodes installed
respectively in the entrance of the district and the vehicles, together form a ZigBee
wireless sensor network. This paper mainly introduces the overall structure,
hardware platform and software design of this system. The implementation and
performance tests of this system are impressive.
TABLE OF CONTENTS
CHAPTER NO. TITLE PAGE NO.
ABSTRACT i
LIST OF TABLES vii
LIST OF FIGURES vii
LIST OF ABBREVIATIONS ix
1. INTRODUCTION
1.1 General 1
1.2 Objectives of the report 2
1.3 Organization of the report 2
2. LITERATURE REVIEW
2.1 Block Diagram of Remote Field 3
2.2 Circuit Diagram and Explanation 4
2.2.1Explanation 5
2.3 Block Diagram of Control Field 6
2.4 Circuit Diagram and Explanation 7
2.4.1Explanation 8
2.5 PIC16F917 MICROCONTROLLER 8
2.5.1 General 8
2.5.2 Architecture 9
2.5.3 Peripheral Features 10
2.5.4 Input/Output(I/O) Ports 11
2.5.5 Ports 11
2.5.5.1 Port A and TRISHA Register 12
2.5.5.2 Port B and TRISHB Register 12
2.5.5.3 Port C and TRISHC Register 13
2.5.5.4 Port D and TRISHD Register 13
2.5.5.5 Port E and TRISHE Register 13
2.5.6 Pin Description 14
2.5.6.1 Port A Functions 14
2.5.6.2 Port B Functions 14
2.5.6.3 Port C Functions 15
2.5.6.4 Port d Functions 16
2.5.6.5 Port E Functions 16
2.5.6.5 Other Pin Functions 17
2.5.7 Memory Organization 17
2.5.7.a Program Memory 18
2.5.7.b Data Memory 18
2.5.8 Timers 18
2.5.8.1 PreScaler 20
2.5.8.2 Timer 1 Module 20
2.5.8.3 Timer 2 Module 21
2.5.8.4 Watch Dog Timer(WDT) 22
2.5.9 Instruction Set 22
2.5.9.1 Bitwise operation setting 23
2.5.9.2 Increment/ Decrement operations 24
2.5.9.3 Input/ output 24
2.5.10 Performance Overview 25
2.6 RFID 26
2.6.1 General 26
2.6.2 RFID Frequencies 27
2.6.3 RFID Applications 28
2.7 POWER SUPPLY 28
2.7.1 General 28
2.7.2 Power Supply Description 29
2.7.3 Working Principle 30
2.7.4 Bridge Rectifier 30
2.7.5 Advantage of Bridge Rectifier 31
2.7.6 IC Voltage Regulators 32
2.8 SERIAL COMMUNICATION 34
2.8.1 General 34
2.8.2 RS232 Specifications 34
2.8.3 PIN Configuration 36
2.8.4 RS232 Voltage Level 38
2.8.5 MAX232 39
2.8.5.1 PIN Diagram 39
2.8.5.2 Voltages 40
2.8.5.3 Connection of Zigbee to MAX232 41
2.8.5.4 Inside MAX232 42
2.8.5.5 Advantages 42
2.9 ZIGBEE 43
2.9.1 General 43
2.9.2 ZIGBEE Standard 44
2.9.3 802.15.4/ZIGBEE Architecture 45
2.9.4 MAX stream modes of operation 48
2.9.5 Advantage 49
2.10 DRIVER UNIT 50
2.10.1 Relay 50
2.10.2 Wireless Video Camera 52
2.10.3 Transistor 53
2.10.3.1 BC548 53
2.10.4 DC Motor Control 55
2.11 EMBEDDED SOFTWARE 56
2.11.1 General 56
2.11.2 MPLAB IDE 57
2.11.2.1MPLAB IDE Project Creation 57
2.11.2.2 Updating source code 59
2.11.2.3 Building a project 60
2.11.2.4 Programming PIC with MPLAB IDE 61
2.11.2.5 Transfer HEX file to PIC 62
3. CONCLUSION 63
APPENDIX 64
REFERENCES 75
LIST OF TABLES
TABLE NO. TITLE PAGE NO.
1. RS232 Pin Description 37
2. Electrical Characteristics of BC548 54
3. Maximum Ratings of BC548 54
4. Thermal Characteristics of BC548 54
5. DC Characteristics of PIC16F917 71
6. Switching Characteristics of PIC16F917 59
LIST OF FIGURES
FIGURE NO. TITLE PAGE NO.
1. Block Diagram of Remote Field 3
2. Circuit Diagram of Remote Field 4
3. Block Diagram of Control Field 6
4. Circuit Diagram of Control Field 7
5. Architecture of PIC16F917 9
6. RFID Module 26
7. Power supply Block Diagram 29
8. IC Voltage Regulators 33
9. UART PINS 35
10. DB-99-PIN Connector 36
11. MAX232 PIN Diagram 39
12. Connection of Zigbee to MAX23 41
13. Inside MAX232 42
14. ZIGBEE 43
15. ZIGBEE Architecture 45
16. Max-stream ZIGBEE modes of operation 48
17. Relay Diagram 50
18. Wireless Video Camera 52
19. BC548 53
20. DC Motor 55
21. Pin Description of PIC16F917 69
22 Max232 Ic Pin Diagram 72
LIST OF ABBREVIATIONS
EPROM - Erasable Programmable Read Only Memory
SFR - Special Function Register
ISP - In-System Programming
DSSS - Direct Sequence Spread Spectrum
UART - Universal Asynchronous Receiver/Transmitter
CTS - Clear To Send
RTS - Request To Send
DIN - Data In
DOUT - Data Out
IR - Infrared
TTL - Transistor–Transistor Logic
LCD - Liquid Crystal Display
LED - Light Emitting Diode
NO - Normally-Open
NC - Normally-Closed
CO - Change-Over
IDE - Integrated Development Environment
CHAPTER 1
INTRODUCTION
1.1. GENERAL
The ZigBee based vehicle access control is implemented in harbours,
shipyards and places where a large number of vehicles are waited to be shipped.
Those employees who are used for transporting the vehicles within the premises
of the shipping yard are provided with a RFID tag for authorization purposes.
The driver requires one of those right tags inorder to open the door of the car.
Once the engine of the car is turned ON, the video camera positioned within the
car gets activated. The activity of the person within the car is monitored by the
security officer at his room through the television. In case of any discrepancy in
the practices, he will be able to immobilize the vehicle using a computer. The
wireless communication of this whole unit is managed by the zigbee
network.This system serves the purpose upon any scenario such as hard break in
entry, stolen tags, and suspicious activity by the authorized person itself.
1.2 OBJECTIVES OF THE PROJECT
• To provide maximum monitoring and controlling services for vehicles by
using efficient resources at appropriate cost.
• Provide enhanced security for large number of vehicles waiting to be
shipped.
• To make the vehicles adhere to speed limitations of school zones and
prevent over speeding.
1.3 ORGANISATION OF REPORT
The report is organized into three chapters each dealing with specific aspects
related to the project. The first chapter provides the introduction to the work. . The
idea behind PIC16F917 Microcontroller is explained in the second chapter. The
second chapter explains about RFID which is used for human detection. The
facilities and functions of the power supply are also dealt in this chapter. The serial
communication and the enhanced results are narrated and it also explains about the
wireless communication protocol function. The driver units using transistor and
DC motor and its functions are explained in this chapter and the embedded
software is discussed in detail and the design tools of MPLAB IDE have been
studied in this second chapter. The third chapter deals with conclusion and
appendix.
CHAPTER 2
LITERATURE REVIEW
2.1 BLOCK DIAGRAM OF REMOTE FIELD
Figure 1. Block diagram of the remote field sector
2.2CIRCUIT DIAGRAM OF REMOTE FIELD SECTOR
.
V C C
V C C
V C C
V C C
V C C
C 1
1 n
2 0 . O O M H z
12
3
~
~+ -
T1 15
48
12
3
123V I NV O U T
G N D
MCLR
RA0\AN0
RA1\AN1
RA2\AN2
RA3
RA4\AN4
RE0\RD
RE1\WR
RE2\CS
14
15
18
17
16
23
24
RC3
RC2
RC1
RC0
OSC1\CLK IN
OSC2\CLK OUT
RC4\SDI
RC5\SDO
32
12 13
RB6\PGC
RB2
RC6
RD1
RB3
RB0
RD0
RB5
RB4
RB1
RD1
RB7\PGD
RD0
30
27
29
22
21
28
19
20
26
37
39
36
35
38
33
34
16F917PIC
Vcc+5V
1333pf
33pf
6
1
2
5
4
3
8
9
10
11 40
RXD
TXD25
RD4
RD5
1
1
5
3
4
16
15
10uf
10uf
11
12
6 10uf
13
14
RFIDREADER
ZIGBEETRANCEIVER
RELAY
MOTOR
Vcc+5V
RC7
RELAY
CAMERA
1k
1k
10uf
10uf
1k
1k
0.1UF
N
MAX232
DOORBREAKMODE
BUZZER
Figure.2. Circuit diagram of remote field sector.
2.2.1Circuit description
The PIC16F917 microprocessor is the heart of the remote filed
sector. This unit is mounted within the vehicle. The microcontroller is
clocked at 20 MHz. This consist of 3 major segments, the authorization ,
communication, immobilization. The door break switch is used to sense the
authorization breach. This works by pulling the pin 3 of port B to high. The
RFID reader working at a frequency of 125khz is used to detect the genuine
tag and communicate it to one of the serial ports of the micro controller. Pin
7 and pin 6 of port C of the microcontroller are used to connect to the
RFID . another peripheral working for the authorisation part is the video
camera. The camera implemented here is a wireless audio/video camera. This
camera is relay driven by the microcontroller. Pin 5 o port C is pulled to
high in order to turn on the camera. The zigbee module is used for
communication of the unit with the security officer room. Zigbee works on
UART transmission mode at the pin 0 and pin 1 of the port B. a relay driven
motor is used to represent the action of the vehicle’s engine for the demo
purpose. This is triggered by the pin0 of the port E.
2.3 BLOCK DIAGRAM OF CONTROL FIELD
Figure 3. Block diagram of control field
2.4 CIRCUIT DIAGRAM OF CONTROL FIELD SECTOR
Figure 4. Circuit diagram of control field sector
2.4.1 Circuit description
Zigbee is interfaced to a PC through an MAX232 IC. Since the
zigbee module and the PC operates at different voltage ranges , we need an
MAX 232 Ic to provide isolation between them. The serial communication
is interfaced to the computer using MAX232 IC at the serial port. The RS232
cable is used for the connection found between PC and MAX232 IC as
operating voltages of PC is v and controller is operated at + 5v.
2.5 PIC16F917 MICROCONTROLLER
2.5.1 GENERAL
PIC: Programmable Interface Controller/Peripheral Interrupt Controller.
PIC is Microchip product.
PIC is a Microcontroller which is something special when compared to
others.
PIC includes features for entire analog as well as digital form of operations.
PIC microcontroller is a enhanced flash microcontroller.
PIC microcontroller mostly compatible with previous versions.
It available in all packages for customers usage.
PIC microcontroller available 28/40/44 pins.
PIC is a high performance RISC CPU.
2.5.2 ARCHITECTURE
Figure 5. Architecture of PIC16F917
PIC microcontrollers are RISC processors and they use HARVARD
architecture.
Separate memories for program and data. Each with its own busses.
The major advantage with this architecture is that while an instruction is being
executed the next one can be fetched. The execution speed is doubled.
The memory of this chip which was referred to earlier is its data memory
Its program memory has 14 bits in each location
All instructions fit in one program memory location.
An instruction is in other words completely defined with a number between
0x0000 and 0x3FFF.
Data memory data bus has 8 wires and address bus has 9 wires
Program memory data bus has 14 wires and address bus has 13 wires
2.5.3 PERIPHERAL FEATURES
Timer0: 8-bit timer/counter with 8-bit prescaler.
Timer1: 16-bit timer/counter with prescaler, can be incremented during Sleep
via external crystal/clock.
Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.
Two Capture, Compare, PWM modules
o Capture is 16-bit, max resolution is 12.5 ns.
o Compare is 16-bit, max resolution is 200 ns.
o PWM(pulse width modulation)max. Resolution is 10-bit.
Synchronous Serial Port (SSP) with SPI™.
(Master mode) and I2C™ (Master/Slave).
Universal Synchronous Asynchronous Receiver.
Transmitter (USART/SCI) with 9-bit address.
Up to 35 I/O pins and 1 input-only pin:
o High-current source/sink for direct LED drive.
o Interrupt-on-pin change.
o Individually programma.ble weak pull-ups
A/D Converter:
Brown-out detection circuitry for Brown-out Reset (BOR).
2.5.4 INPUT/OUTPUT (I/O) PORTS
A PIC Microcontroller can control outputs and react to inputs. With the
larger devices it's possible to drive LCD’s or seven segment displays with very
few control lines as all the work is done inside the PIC Microcontroller. The
main reason to use PIC in our structural health monitoring project is that it has
an inbuilt ADC (analog to digital converter) so that on can read analogue signal
levels so one does need to add an external devices e.g. you can read an LM35
temperature sensor directly with no interface logic.
2.5.5 PORTS
This family of PIC has 5 I/O ports.
PORTA - Analog and digital I/O (except pin 6)
PORTB - Only digital I/O (Interrupt Functions)
PORTC - Only digital I/O (Serial Communication)
PORTD - Only digital I/O (Parallel Communication)
PORTE - Analog and digital I/O.
2.5.5.1 PORTA and the TRISA Register
PORTA is a 6-bit wide, bidirectional port. The corresponding data direction
register is TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA
pin an input (i.e., put the corresponding output driver in a High-Impedance mode).
Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output
(i.e., put the contents of the output latch on the selected pin).Reading the PORTA
register reads the status of the pins, whereas writing to it will write to the port
latch. All write operations are read-modify-write operations. Therefore, a write to a
port implies that the port pins are read, the value is modified and then written to
the port data latch. Pin RA4 is multiplexed with the Timer0 module clock input to
become the RA4/T0CKI pin. The RA4/T0CKI pin is a Schmitt Trigger input and
an open-drain output. All other PORTA pins have TTL input levels and full
CMOS output drivers. Other PORTA pins are multiplexed with analog input and
the analog VREF input for both the A/D converters and the comparators. The
operation of each pin is selected by clearing/setting the appropriate control bits in
the ADCON1 and/or CMCON registers.The TRISA register controls the direction
of the port pins even when they are being used as analog inputs. The user must
ensure the bits in the TRISA register are maintained set when using them as analog
inputs.
2.5.5.2 PORTB AND TRISB REGISTER
`PORTB is an 8-bit wide, bidirectional port. The corresponding data direction
register is TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB pin
an input (i.e., put the corresponding output driver in a High-Impedance mode).
Clearing a TRISB bit (= 0) will make the corresponding PORTB pin an output (i.e.
put the contents of the output latch on the selected pin).
2.5.5.3 PORTC AND TRISC REGISTER
PORTC is an 8-bit wide, bidirectional port. The corresponding data direction
register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin
an input (i.e., put the corresponding output driver in a High- Impedance mode).
Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an output (i.e.
put the contents of the output latch on pin. PORTC is multiplexed with several
peripheral functions. PORTC pins have Schmitt Trigger input.
2.5.5.4 PORT D and TRISD Registers
PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is
individually configurable as an input or output. PORTD can be configured as an 8-bit
wide microprocessor port (Parallel Slave Port) by setting control bit, PSPMODE
(TRISE<4>).
2.5.5.5 PORT E AND TRISE REGISTERS
PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7)
which are individually configurable as inputs or outputs. These pins have Schmitt
Trigger input buffers.In this mode, the user must make certain that the TRISE<2:0>
bits are set and that the pins are configured as digital inputs. Also, ensure that
ADCON1 is configured for digital I/O. In this mode, the input buffers are TTL.
TRISE register also controls the Parallel Slave Port operation.
2.5.6 DESCRIPTION OF PINS
2.5.6.1 PORT A FUNCTIONS
PORTA consists of 5 pins. Pins 2, 3, 4,5,6,7. PORTA consists of analog digital
I/O functions, except pin6. Pin6 is used only for digital functions.
RA0/AN0 - TTL Input/output or analog input
RA1/AN1 - TTL Input/output or analog input
RA2/AN2/VREF-/CVREF - TTL Input/output or analog input or VREF- or
CVREF.
RA3/AN3/VREF+ - TTL Input/output or analog input or VREF+.
RA4/T0CKI/C1OUT - ST Input/output or external clock input for
Timer0 or comparator output.
RA5/AN4/SS/C2OUT- Input/output or analog input or slave select input for
synchronous serial port or comparator output.
2.5.6.2 PORT B FUNCTIONS
PORT B has 8 I/O pins. These pins are used for digital function only.
Pins 33 to 40 belong to PORTB.
RB0/INT - TTL/STInput/output pin or external interrupt input. Internal software
programmable pull up
RB3/PGM -TTL Input/output pin or programming pin in mode. Internal software
programmable weak pull-up.
RB6/PGC -TTL/STInput/output pin (with interrupt-on-change) or in-circuit
debugger pin. Internal software programmable weak pull-
up.Serial programming clock.
RB7/PGD -TTL/STInput/output pin (with interrupt-on-change) or in-circuit
debugger pin. Internal software programmable weak pull-
up.Serial programming data.
2.5.6.3 PORTC FUNCTIONS
PORTC has 8 I/O pins. They are used only for digital functions. Pins 15 to 18
and pins 23 to 26 belong to PORTC.
RC0/T1OSO/T1CKI - Input/output port pin or Timer1
oscillatoroutput/Timer1 clock input.
RC1/T1OSI/CCP2 - Input/output port pin or Timer1 oscillator input
or Capture2 input/ Compare2 output/PWM2
output.
RC2/CCP1 -Input/output port pin or Capture1
input/Compare1output/PWM1 output.
RC3/SCK/SCL -RC3 can also be the synchronous serial clock for
both SPI and I2C modes.
RC4/SDI/SDA -RC4 can also be the SPI data in (SPI mode) or data
I/O (I2C mode).
RC5/SDO - Input/output port pin or Synchronous Serial Port
data output.
RC6/TX/CK -Input/output port pin or USART asynchronous
transmit or synchronous clock.
RC7/RX/DT -Input/output port pin or USART asynchronous
receive or synchronous data.
2.5.6.4 PORT D FUNCTIONS
PORTD has 8 I/O pins. They are used only for digital functions. Pins 19 to
22 and pins 27 to 30 belong to PORTD.
RD0-RD7/PSP0-PSP7 - Input/output port pin or Parallel Slave Port
2.5.6.5 PORT E FUNCTIONS
PORTE has 3 I/O pins. Pins 8,9,10 belong to PORTE.
RE0/ RD/AN5 - I/O port pin or read control input in Parallel Slave Port
mode or analoginput:RD(BAR)
1 = Idle
0 = Read operation. Contents of PORTD register are output to PORTD I/O pins
(if chip selected).
RE1/WR/AN6 - I/O port pin or write control input in Parallel Slave Port mode or
analog input:
when WR ; 1 = Idle
0 = Write operation. Value of PORTD I/O pins is latched into PORTD register (if chip
selected).
RE2/CS/AN7 - I/O port pin or chip select control input in PSP mode When CS
1 = Device is not selected
0 = Device is selected
2.5.6.5 OTHER PIN FUNCTIONS
MCLR/ VPP (PIN 1) - Master clear reset pin. This pin is an activelow reset.
This pin is to download the program output.
VDD (PIN 11 and PIN32) - This pin is the positive supply for logic and I/O pins.
VSS (PIN 12 and PIN 31) - This pin is the ground reference for logic and I/O pins.
OSC1/ CLK1 (PIN13) - Oscillator 1 input/ external clock inputassociated with
the oscillator.
OSC2/ CLK0 (PIN 14) - Oscillator 2 output/ external clock outputsignal.
2.5.7 MEMORY ORGANIZATION
There are three memory blocks in each of the PIC16F917 devices. The
Harvard architecture provides separate program memory and data memory. This has
two different effects. The first one is that the data and address busses are separate
following an increased flow of data to and from CPU. The data memory of PIC is 8
bit wide while the program memory is 12 , 14 or 16 bit wide.
2.5.7.1 PROGRAM MEMORY
The flash program memory of PIC16F917 is 8K and is 14 bit wide. Therefore
to access this 8K memory, 13 bit address is needed and hence the program counter
is 13 bit wide. Again after reset, the program counter points to 0000H and the
interrupt vector is at 0004H. However call andgotoinstructions have11 bits to
address to support branching within the page.For protecting against unwanted write
operations to flash program memory bit WRT in configuration word may be
programmed to ‘0’. This prevents write operation. This WRT bit cannot be accessed
through user program. For this purpose an external programmer is needed. Further
to erase WRT bit the device has to erase fully.
2.5.7.2 DATA MEMORY
The data memory of PIC 16F917 is divided into four banks. And STATUS
register bits IRP, RP1, RO0 are used to select any banks. Size of each of these four
banks is 128 bytes. There is general purpose registers registered for static RAM.
The lower locations in every bank are reserved for the special function registers.
There are SFRs, PCL, INTCON mirrored in all four banks. OPTION_REG
REGISTER contains the bits corresponding to the TMR0 and watchdog timer.
2.5.8 TIMERS
PIC16F917supports three timers. Timer 0 , timer 1 , timer 2. In addition it has a
watch dog timer too.
The Timer0 module timer/counter has the following features:
• 8-bit timer/counter
• Readable and writable
• 8-bit software programmable prescaler.
• Internal or external clock select.
• Interrupt on overflow from FFh to 00h
• Edge select for external clock
Timer mode is selected by clearing bit T0CS (OPTION_REG<5>). In Timer
mode, the Timer0 module will increment every instruction cycle (without
prescaler). If the TMR0 register is written, the increment is inhibited for the
following two instruction cycles.
Counter mode is selected by setting bit T0CS (OPTION_REG<5>). In
Counter mode, Timer0 will increment either on every rising or falling edge of
pin RA4/T0CKI. The incrementing edge is determined by the Timer0 Source
Edge Select bit, T0SE (OPTION_REG<4>). Clearing bit T0SE selects the
rising edge.
2.5.8.1 PRESCALER
There is only one prescaler available which is mutually exclusively shared
between the Timer0 module and the Watchdog Timer. A prescaler assignment
for the Timer0 module means that there is no prescaler for the Watchdog Timer
and vice versa. This prescaler is not readable or writable (see Figure 5-1). The
PSA and PS2:PS0 bits (OPTION_REG<3:0>) determine the
prescalerassignment and prescale ratio. When assigned to the Timer0 module,
all instructions writing to the TMR0 register (e.g., CLRF 1, MOVWF 1, BSF 1,
x....etc.) will clear the prescaler. When assigned to WDT, a CLRWDT
instruction will clear the prescaler along with the Watchdog Timer. The
prescaler is not readable or writable.
2.5.8.2TIMER 1 MODULE
The Timer1 module is a 16-bit timer/counter consisting of two 8-bit registers
(TMR1H and TMR1L) which are readable and writable. The TMR1 register pair
(TMR1H:TMR1L) increments from 0000h to FFFFh and rolls over to 0000h. The
TMR1 interrupt, if enabled, is generated on overflow which I latched in interrupt
flag bit, TMR1IF (PIR1<0>). This interrupt can be Enabled / disabled by
setting/clearing TMR1 interrupt enable bit, TMR1IE (PIE1<0>).
Timer1 can operate in one of two modes:
As a Timer
As a Counter
The operating mode is determined by the clock select.
In Timer mode, Timer1 increments every instruction cycle while in Counter mode,
it increments on every rising, edge of the external clock input.
Timer1 can be enabled/disabled by setting/clearing control bit, TMR1ON
(T1CON<0>). Timer1 also has an internal “Reset input”. This Reset can be generated by
either of the two CCP modules. When the Timer1 oscillator is enabled (T1OSCEN is set),
the RC1/T1OSI/CCP2 and RC0/T1OSO/T1CKI pins become inputs.
2.5.8.3 TIMER 2 MODULE
Timer2 is an 8-bit timer with a prescaler and a postscaler. It can be used as the
PWM time base for the PWM mode of the CCP module(s). The TMR2 register is
readable and writable and is cleared on any device Reset.
The input clock (FOSC/4) has a prescale option of 1:1, 1:4 or 1:16, selected by control
bits T2CKPS1:T2CKPS0 (T2CON<1:0>).
The Timer2 module has an 8-bit period register, PR2. Timer2 increments from 00h
until it match PR2 and then resets to 00h on the next increment cycle. PR2 is a readable
and writable register. The PR2 register is initialized to FFh upon Reset.
The match output of TMR2 goes through a 4-bit postscaler (which gives a 1:1 to 1:16
scaling inclusive) to generate a TMR2 interrupt (latched in flag bit, TMR2IF (PIR1<1>)).
Timer2 can be shut-off by clearing control bit, TMR2ON (T2CON<2>), to minimize
power consumption.
2.5.8.4 WATCH DOG TIMER (WDT)
Watchdog timer is to prevent the processor from endless loop. The watchdog timer
will reset the PIC microcontroller if the instruction CLRWDT is not executed
periodically.
The CLRWDT instruction sets the timeout bit (TO) in the status register. This bit is
set during the power up procedure. The WDT can reset the TO bit.
This possibly happens when the CLRWDT instruction is not executed periodically.
The normal time out period of the PIC Watch dog timer is around 18ms.the internal RC
oscillator drives the watchdog timer. The watchdog timer is enabled at the time of device
programming, and once enabled the watchdog timer cannot be turned off. Similarly if
disabled at the time of device programming the watchdog timer cannot be turned off at
any means.
2.5.9 INSTRUCTION SET
The PIC16 instruction set is comprised of three basic categories:
• Bit-oriented operations
• Increment, decrement operations
Input and outputs
In PIC microcontrollers the operations are with the W registers and any of the RAM
file registers.
For example, to load the working register and then add with the file register the
instruction is as follows:
movlw B’00000001
addwf H’ 12,W
The above instruction has two operands. The first one is the source operand (H’12)
and the W register is the destination. The result of addition will be in W. As per the
Microchip technologies, the mnemonics are written in lowercase letters, RAM
variables and special register names are written in upper case letters.
2.5.9.1 Bitwise operation setting or clearing the bit
Instruction bcf f, b can clear the bit b of the f register, where f stands or file
register and b be any number in the range 0 to 7. For example, to clear the bit 0 of the
PORTB the instruction will be written as:
Bcf PORTB, 0;
Clear PORTB bit0
Similarly to set any bit one can use the instruction bsf f, b .Again note that PORTB is
a special register and written in upper case letters.
Bsf PORTB, 0; Set PORTB bit 0
To set the carry bit in the STATUS register the instruction is
bsf STATUS , C;Set carry bit
These instructions execute in a single cycle and no no status bits (flags) are affected.
2.5.9.2Increment/ Decrement operations
Pic instructions incfanddecfallow to increment or decrement a special purpose
register and store the result in either F or W. For incrementing the PORTA register
one may use the instruction. F stands for the destination to be the source register it. In
other case W can also be the destination.
incf PORTA , F;
increment PORTA by 1
Increment and decrement instructions are single cycle instructions and affect only
Z flag in the status register.
2.5.9.3 Input/ output
These are I/O registers namely TRISA , TRISB , TRISC that are loaded with the
contents of the working register W using movlwandmovwf instructions. If the 1 is
written in the input output control register the respective pin is configured as
input.After reset these I/O control registers are set to 1 and the default state of the I/O
pins is input. These I/O registers can only be written.
2.5.10 PERFORMANCE OVERVIEW
The PIC16F917 masters over the performance of other suitable competitors
due to the following features. It’s a high performance RISC CPU which has only
35 instructions to learn. It has an operating frequency of 20MHz .this CPU
hasprogram memory read capability. It also features, direct, indirect and
addressing modes. The precision internal oscillator is factory calibrated to +/-1%.
It also has features like power saving sleep mode, which prevents battery drain in
vehicles. Power on reset, power up timer, and oscillator start up timer are some
other noticeable features portrayed by this microcontroller. The peripheral features
of this chip includes, LCD display module, and 35 I/O pins, and also with an
analog comparator module including two analog comparators. Communication part
of the PIC has an addressable universal synchronous asynchronous receiver.
transmitter.(AUSART).
]
2.6 RFID
Figure 6. RFID receiver module
2.6.1 GENERAL
RFID stands for Radio Frequency Identification. RFID is one member
in the family of Automatic Identification and Data Capture ( AIDC )
technologies and is a fast and reliable means of identifying objects. There are
two main components: The Interrogator (RFID Reader) which transmits and
receives the signal and the Transponder (tag) that is attached to the object.
An RFID tag is composed of a miniscule microchip and antenna. RFID tags
can be passive or active and come in a wide variety of sizes, shapes, and
forms. Communication between the RFID Reader and tags occurs wirelessly
and generally does not require a line of sight between the devices.
An RFID Reader can read through most anything with the exception
of conductive materials like water and metal.
Radio-Frequency Identification tags are used to identify and locate
items using radio signals.They consist of a microchip and an antenna which
transmit a signal to a 'reader'. RFID tags have been suggested as
replacements for barcodes in some areas: because they use radio waves,
RFID tags can be 'read' out of the line of sight and at distances ranging from
a few centimetres to over 100 metres. They also enable individual items to be
given a unique identification number, rather than just a product code.
2.6.2 RFID FREQUENCIES
Electrical currents that oscillate at RF have special properties not
shared by direct current signals. One such property is the ease with which it
can ionize air to create a conductive path through air. This property is
exploited by 'high frequency' units used in electric arc welding. Another
special property is an electromagnetic force that drives the RF current to the
surface of conductors, known as the skin effect. Another property is the
ability to appear to flow through paths that contain insulating material, like
the dielectric insulator of a capacitor. The degree of effect of these properties
depends on the frequency of the signals.
Radio waves are the carriers of data between the reader and tags. The
approach generally adopted for RFID communication is to allocate
frequencies depending on application. The frequencies used cover a wide
spectrum.These specified bands are
• Very long wave 9 - 135 kHz
• Short wave 13.56 MHz
• UHF 400-1200 MHz
• Microwave 2.45 and 5.8 GHz
2.6.3 RFID APPLICATIONS
RFID is used for many applications such as
• Automated electronic toll stations which can identify vehicles passing
through without having to stop and then debits their account.
• Identify and monitor rail cars and containers.
2.7 POWER SUPPLY
2.7.1 GENERAL
In normal operation, microcontrollers are sourced by a regulated and found
somehow stabilized power supply. This power supply ensures a supply voltage to
the 8051 microcontroller, which lies in the range of the microcontroller’s special
specification.
2.7.2 POWER SUPPLY DESCRIPTION
The ac voltage, typically 220V rms, is connected to a transformer, which steps
that ac voltage down to the level of the desired dc output. A diode rectifier then
provides a full-wave rectified voltage that is initially filtered by a simple capacitor
filter to produce a dc voltage. This resulting dc voltage usually has some ripple or
ac voltage variation.
A regulator circuit removes the ripples and also remains the same dc value
even if the input dc voltage varies, or the load connected to the output dc voltage
changes. This voltage regulation is usually obtained using one of the popular
voltage regulator IC units.
The input to the circuit is applied to the diagonally opposite corners of the
given network, and the output is taken from the remaining two corners. A diode
that rectifies provides a full-wave rectified voltage that is initially filtered by a
simple capacitor filter to produce a dc voltage.
Figure 7. Block diagram of the power supply unit
LOADIC REGULATORFILTERRECTIFIERTRANSFORMER
2.7.3 WORKING PRINCIPLE
Transformer
The potential transformer will step down the power supply voltage (0-230V)
to (0-6V) level. Then the secondary of the potential transformer will be connected
to the precision rectifier, which is constructed with the help of op–amp. The
advantages of using precision rectifier are it will give peak voltage output as DC;
rest of the circuits will give only RMS output.
2.7.4 Bridge rectifier
When four diodes are connected as shown in figure, the circuit is called as the
bridge rectifier. The input to the circuit is applied to the diagonally opposite
corners of the network, and the output is taken from the remaining two corners.
Let u now assume that the transformer is working properly and there is a positive
potential, at point A and a negative potential at point B. the positive potential at
point A now will forward bias D3 and reverse bias D4. The negative potential at
point B will forward bias D1 and reverse D2. At this time D3 and D1 are forward
biased and will allow at current flow to pass through them; D4 and D2 are reverse
biased and will block current flow. The path for current flow is from point B
through D1, up through RL, through D3, through the secondary of the transformer
back to point B. this path is indicated by the solid arrows. Waveforms (1) and (2)
can be observed across D1 and D3.
One-half cycle later the polarity across the secondary of the transformer
reverse, forward biasing D2 and D4 and reverse biasing D1 and D3. Current
flow will now be from point A through D4, up through RL, through D2, through
the other end of secondary T1, and back to point A. This path is indicated by
the broken arrows. Waveforms (3) and (4) can be observed across D2 and D4. The
current flow through RL is always in the same direction. In flowing through RL
this current will develops a voltage corresponding to that shown waveform (5).
Since current f lows through the load (RL) during both half cycles of the applied
voltage, this bridge rectifier is a full-wave rectifier.
2.7.5 ADVANTAGE OF BRIDGE RECTIFIER
A bridge rectifier over a conventional full-wave rectifier is that with a given
transformer the bridge rectifier produces a voltage output that is nearly twice that
of the conventional full-wave circuit. This may be shown by assigning values to
some of the components shown in views A and B. Assume that the same
transformer is used in both circuits. The peak voltage developed between points X
and y is 1000 volts in both circuits. In the conventional full-wave circuit shown in
view A, the peak voltage from the center tap to either X or Y is 500 volts. Since
only one diode can conduct at any instant, the maximum voltage that can be
rectified at any instant is 500 volts. With both circuits using the same
transformer, the bridge rectifier circuit produces a higher output voltage than
the conventional full-wave rectifier circuit.
2.7.6 IC VOLTAGE REGULATORS
Voltage regulators comprise a class of widely used ICs. Regulator IC units
contain the circuitry for reference source, comparator amplifier, control device, and
overload protection all in a single IC. IC units provide regulation of either a fixed
positive voltage, a fixed negative voltage, or an adjustable set voltage.
The regulators can be selected for operation with load currents from hundreds
ofmill amperes to tens of amperes, corresponding to power ratings from milliwatts
to tens of watts. The current flow through RL is always in the same direction.
The current which is flowing through RL this current develops a voltage found
corresponding to that shown waveform. Since current flows through the load (RL)
during both half cycles of the applied voltage, this bridge rectifier is a full-wave
rectifier.
The duty cycle of the pulses increase if the output of the regulator needs to
supply more load current to maintain the output voltage and decreases if the output
needs to be reduced. Switching regulators are more efficient than linear regulators
because they only support power when necessary.
Fig 8Circuit Diagram of Power Supply
A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi,
applied to one input terminal, a regulated dc output voltage, Vo, from a second
terminal, with the third terminal connected to ground.
The series 78 regulators provide fixed positive regulated voltages from 5 to
24 volts. Similarly, the series 79 regulators provide fixed negative regulated
voltages from 5 to 24 volts.
For ICs, microcontroller --------- 5 volts.
For relay circuits ---------- 12 volts.
2.8 SERIAL COMMUNICATION
2.8.1 GENERAL
Serial communication is basically the transmission or reception of data
one bit at a time. Today's computers generally address data in bytes or some
multiple thereof. A byte contains 8 bits. A bit is basically either a logical 1 or
0. Every character on this page is actually expressed internally as one byte.
The serial port is used to convert each byte to a stream of ones and zeros as
well as to convert the streams of ones and zeroes to bytes. The serial port
contains an electronic chip named as UART, (Universal Asynchronous
Synchronous Receiver Transmitter).
2.8.2 RS 232 SPECIFICATIONS
Zigbeemodule connects to PC by using RS232 cable.
RS232 is a protocol which supports half-duplex.
Synchronous/asynchronous, serial communication.
UART pins
The UART always transmits data on pin P3.3/TX
The UART always receives data on pin P3.2/RX
The RS-232 standard defines lots of other signals other than TX and RX
areUsed for handshaking.
PC ZIGBEE
COM 1 port
RS232
MAX232 UART
Figure8. connection of pc tozigbee
Description
Here the personal computer and zigbee cannot be directly connected as they
work in different voltage levels. Any voltage surge from pc must not affect the
zigbeemodule. Hence we use the MAX232 IC.
RS232 STANDARD
RS232 is an interfacing standard which is set by the Electronics
Industries Association (EIA) in 1960.
RS232 is the most widely used serial I/O interfacing standard.
RS232A (1963), RS232B (1965) and RS232C (1969), now is RS232E
2.8.3 PIN CONFIGURATION
PC ZIGBEE
COM 1 port
RS232
MAX232 UART
DB-9 9-Pin Connector
Figure 10.DB-99pin connector
PIN DESCRIPTION
Pin Description
1 Data carrier detect (DCD)
2 Received data (RxD)
3 Transmitted data (TxD)
4 Data terminal ready
(DTR)
5 Signal ground (GND)
6 Data set ready (DSR)
7 Request to send (RTS)
8 Clear to send (CTS)
9 Ring indicator (RI)
RS232 HAND SHAKING SIGNAL
They are not supported by the 8051 UART chips. Many of the pins of the
RS232 connector are used for handshaking signals.
DTR (data terminal ready)
DSR (data set ready)
RTS (request to send)
CTS (clear to send)
RTS and CTS are hardware control flow signals.
DCD (carrier detect, or data carrier detect)
RI (ring indicator)
2.8.4 RS232 VOLTAGE LEVEL
The input and output voltage of RS232 is not of the TTL compatible.
RS232 is older than TTL.
We must use voltage converter (also referred to as line driver) Such as
MAX232 to convert the TTL logic levels to the RS232
Voltage level, and vice versa.
MAX232, TSC232, ICL232.
2.8.5 MAX232
The MAX232 is an integrated circuit that converts signals from RS232 serial
port to signals suitable for use in TTL compatible digital logic
circuits.TheMAX232 is a dual driver/receiver and 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 the 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 as complicated just for driving the RS-232 in this
case.
2.8.5.1 PIN Diagram
V D D
R X
TX T2 O U T
R 2 I N
U 1M A X2 3 2
1 38
1 11 0
1345
2
6
1 291 47
16
15
R 1 I NR 2 I NT1 I NT2 I N
C +C 1 -C 2 +C 2 -
V+
V -
R 1 O U TR 2 O U TT1 O U TT2 O U T
VC
CG
ND
C 1 1 0 u F
C 41 0 u F
C 31 0 u F
C 21 0 u F
Figure11.Max232 pin Diagram
Circuit Working Description
In this circuit the MAX 232 IC used as level logic converter. The MAX232 is
a dual driver/receiver that includes a capacitive voltage generator to supply EIA
232 voltage levels from a single 5v supply. Each receiver converts EIA-232 to 5v
TTL/CMOS levels. Each driver converts TLL/CMOS input levels into EIA-232
levels.
2.8.5.2 Voltages
The USART input/output uses 0V for logic 0 and 5V for logic 1.
The RS-232 standard (and the COM port) use +12V for logic 0 and –12V for
logic 1.
To convert between these voltages levels we need an additional integrated
circuit (such as Maxim’s MAX232).
MAX232 uses a +5V power source which is the same as the source Voltage
for the PIC16F917
2.8.5.3Connection of ZIGBEE to MAX232
Figure12.connection of zigbee to max232
MAX232 has two sets of line drivers. Shows the inside of MAX232.
MAX232 requires four capacitors ranging from 1 to 22 mF. The
2.8.5.4 Inside MAX232
ZIGBEE
MAX232
P3.1
TxD
DB-9
P3.0
RxD
11 11
10 12
14
13
2
3
5
2.8.5.5 Advantages
The data is sent one bit at a time (slow).
Long distance (rarely distortion).
The cost is very cheap.
MAX233
7
15
10
11
16
5
4
18
19
2
3
1
20
6
VCC
12
17
14
9TTL side RS232 side
T1IN
R1OUT
T2IN
R2OUT
T1OUT
R1IN
T2OUT
R2IN
13
2.9 ZIGBEE
2.9.1 GENERAL
Figure14.ZIGBEE
The X Bee and X Bee-PRO OEM RF Modules were engineered to meet
IEEE802.15.4 Standards and support the unique needs of low-cost, low-power
wireless sensor networks. The modules require Minimal power and provide
reliable for the Delivery of data between devices. The modules operate within
frequency of 2.4 GHz Frequency band and are Pin-for-pin compatible with each
other.
2.9.2 ZIGBEE STANDARD
Technological Standard Created for Control and Sensor Networks
Based on the IEEE 802.15.4 Standard
Created by the ZIGBEE Alliance
FEATURES
Market name : ZIGBEE
Standard : 802.15.4
Application focus : monitoring &control
System resources : 4KB – 32KB
Battery life (days) : 100-1,000+
Network size : unlimited
Band width : 20-250
Transmission range : 1-100+
Success metrics : reliability, power, cost.
2.9.3 802.15.4/ZIGBEE ARCHITECTURE
802.15.4 Architecture
IEEE 802.15.4 MAC
Applications
IEEE 802.15.4
2400 MHz
PHY
IEEE 802.15.4
868/915 MHz
PHY
• Network Routing• Address translation• Packet Segmentation
• Profiles
ZigBee
© 2008 Pantech Solutions™ | All rights reserved
Figure15.ZIGBEE Architecture
Data Flow
The XBee®/XBee-PRO OEM RF Modules interface to a host device through a
logic-level asynchronous serial port. Through its serial port, the module can
communicate with any logic and voltage compatible UART; or through a level
translator to any serial device (For example: Through a Digit proprietary RS-232
or USB interface board).
What does ZIGBEE do?
• Designed for wireless control and sensor.
• Operates in Personal Area Networks (PAN’s) and device-to-device networks
• Connectivity between small packet devices
• Control of lights, switches, thermostats, appliances, etc.
How does ZIGBEE works?
• Topology
Star
Cluster Tree
Mesh
• Network coordinator, routers, end devices
• States of operation
Active
Sleep
• Devices
Full Function Devices (FFD’s)
Reduced Function Devices (RFD’s)
Mode of operation
Beacon
Non-beacon
• Beacon Mode
Coordinator, Routers, and End Devices sleep for pre-determined
intervals (15ms to 252s) before transmitting.
Coordinator usually battery-powered
• Non-Beacon Mode
Coordinator always listening, Routers and End Devices
broadcast at random yet regular intervals
Coordinator usually has “unlimited” power source.
Typical ZIGBEE Device
Operating Frequency 2.4 GHz
250 Kbps O-QPSK in 5 MHz channels
Sensitivity ~-91 dbm
Output programmable from -27 to 4 dbm
Sleep Power = .5 UW
Transmit Power = 81 mW
Receive Power = 99 mW
2.9.4 MAXSTREAM ZIGBEE MODES OF OPERATION
Figure16.Max stream ZIGBEE modes of operation
Idle mode:
When not receiving or transmitting data the RF module is in idle mode.
Transmit mode:
When serial data is received and is ready for packetizationofthe RF module
will exit idle mode and attempt to transmit data.
Receive mode:
If a valid RF packet is received the data is transferred to the serial
transmit buffer.
Command mode:
TO modify or read RF module parameters the module first enters into
command mode.
Sleep mode:
Sleep mode allows the module to enter a low power state.
2.9.5 ADVANTAGE
• Low Price
• 5 Total Modules
– 2 Modules are XBee PRO (long range)
• Local Company (Linden, UT)
• In Stock
• Comes as a Development Kit
• Reprogrammable
• Testing of functionality, e.g. acknowledgements, retransmissions, broadcast
Messages, etc.
• Implementation size, i.e. memory usage and code size.
2.10 DRIVER UNIT
2.10.1 RELAY
A relay is an electrical switch that opens and closes under the control of
another electrical circuit. In the original form, the switch is operated by an
electromagnet to open or close one or many sets of contacts.
Figure17.Reley Diagram
RELAY OPERATION
Diagram that a relay uses an electromagnet. This is a device consisting of a
coil of wire wrapped around an iron core. When electricity is applied to the coil of
wire it becomes magnetic, hence the term electromagnet. The A B and C terminals
are an SPDT switch controlled by the electromagnet. When electricity is applied to
V1 and V2, the electromagnet acts upon the SPDT switch so that the B and C
terminals are connected.
When the electricity is disconnected, then the A and C terminals are
connected. It is important to note that the electromagnet is magnetically linked to
the switch but the two are NOT linked electrically
Pole & Through
Normally-open (NO) contacts connect the circuit when the relay is
activated; the circuit is disconnected when the relay is inactive. It is also
called a Form A contact or "make" contact.
Normally-closed (NC) contacts disconnect the circuit when the relay is
activated; the circuit is connected when the relay is inactive. It is also
called a Form B contact or "break" contact.
SPST - Single Pole Single Throw. These have two terminals which can
be connected or disconnected. Including two for the coil, such a relay has
four terminals in total. It is ambiguous whether the pole is normally open
or normally closed. The terminology "SPNO" and "SPNC" is sometimes
used to resolve the ambiguity.
SPDT - Single Pole Double Throw. A common terminal connects to
either of two others. Including two for the coil, such a relay has five
terminals in total.
2.10.2WIRELESS VIDEO CAMERA
Figure18Wirelessvideocam
era
KEY SPECIFICATIONS
1) System: PAL/CCIR NTSC/EIA
2) Validity pixel: PAL: 628 x 582; NTSC:4.69x3.45mm
3) Horizontal definition: 380 lines
4) Scan frequency: PAL /CCIR: 50Hz; NTSC/EIA: 60Hz
5) Minimum illumination: 3 LUX
6) Sensitivity: +18DB-AGL ON-OFF
7) Output power: 50MW
8) Output frequency: 0.9G/1.2G
9) Wireless range: 50-100m
10) Voltage: DC+8V
11) Current: 200mA
12) Power consumption: ≤400mW
13) Dimensions: 20 x 20 x 20mm
14) Camera apparatus: 1/3, 1/4 picture sensor
2.10.3 TRANSISTOR
A transistor is a semi-conductor device which is found to be
switch electronic signals. It is made of a solid piece of semiconductor material,
with at least three terminals for connection to an external circuit. A voltage or
current applied to one pair of the transistor's terminals changes the current flowing
through another pair of terminals. Because the controlled (output) power can be
much more than the controlling (input) power, the transistor
provides amplification of a signal. Some transistors are packaged individually but
many more are found embedded in integrated circuits.
2.10.2.1 BC548
The BC548 is an npn transistor. The operation of the transistor as a
switch is intended in our project. Hence this transistor is used as the relay
driver here.
Figure19.Pin Diagram Of BC548
2.10.3 DC MOTOR CONTROL
Figure20.DCMotor
In any electric motor, operation is based on simple electromagnetism.
A current-carrying conductor generates a magnetic field; when this is then
placed in an external magnetic field, it will experience a force proportional to
the current in the conductor, and to the strength of the external magnetic field.
As you are well aware of from playing with magnets as a kid, opposite (North
and South) polarities attract, while like polarities (North and North, South and
South) repel. The internal configuration of a DC motor is designed to harness
the magnetic interaction between a current-carrying conductor and an external
magnetic field to generate rotational motion
2.11 EMBEDDED SOFTWARE
2.11.1 GENERAL
High Level Languages such as C is extensively being used for the Embedded Software Development. As it has the benefit of Processor Independence, which allows Programmers to concentrate on Algorithms and Applications, rather than of the Details of Processor Architecture. In an Embedded System, assigning functions to Hardware and Software is a vital consideration.
2.11.2 MPLAB IDE SOFTWARE
• A project must be created for implementation
Specify your device Create and edit your files Compile and link your project Program the device
• To create a project
ProjectProject Wizard…
2.11.2.1MPLAB IDE PROJECT CREATION
• Step 1:Begin project and specify device
• Step 2: Select Microchip MPASM Toolsuite
• Step 3: Create New Project File
• Step 4: Add project files
ASM file
• Starting point for assembly code
• <device name>tmpo.asm
Linker script
• <device name>.lkr
• Step 5:Finish project creation and return to IDE
View project details :ViewProject
2.11.2.2UPDATING SOURCE CODE
• Modify .asm files
o Under ‘Source Files’ folder in project window
o Open and edit files to implement new functionality
o Additional files can be created and added
2.11.2.3BUILDING A PROJECT
• ProjectBuild All (or Ctrl+F10)
• Output window indicates success or failure
• HEX file generated when project is built
o Used to program the device
2.11.2.4PROGRAMMING PIC WITH MPLAB IDE
• New ‘PICkit’ 2 tab appears in the output window
• New options appear in the Programmer menu and tool bar
2.11.2.5 TRANSFER HEX FILE TO PIC
o ProgrammerProgram
CHAPTER 3
CONCLUSION
The Zigbee based vehicle access system was implemented and its
performance was evaluated on the basis of cost, protection, attaining its goal
and fool proof nature of the system. This equipment being a security system
needs to be fool proof in order to avoid override methods and tweaking. The
security personnel in the security room was clearly able to notice the
activities inside the vehicle once the ignition of the vehicle was turned on.
The remote immobilization of the vehicle by the security personnel was
found to be working as expected.
The engineering of such a security system for management of large
scale vehicles was made a success with the support of a flawless design and
précised assembly of the peripherals. The software program was made into a
simple and effective one to avoid power wastage due to more processing
involved and to ensure long life of the product. The PIC16F917 was put to
work in an energy efficient manner.
The constructed design was demonstrated and its performance was evaluated
in various important parameters. The working and the performance of this
system was found to be very good, and the results were impressive.
APPENDIX
Figure21.Pin Diagram of PIC 16F917
CODING
#include<16f917.h>
#device ICD=true
#include<stdio.h>
#fuses HS,NOPROTECT,NOWDT
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7) //Initialization for RFID uart
#use rs232(baud=9600,xmit=pin_d0,rcv=pin_d1) // Initialization for Zigbee uart
char ar;
char arr;
char rf[9];
void port_init(void);
void rcv_rfid(void);
void stepcam_ON(void);
void check_rcv(void); //Function Declerations
void zigbee_send1(void);
void zigbee_send2(void);
void main()
{
port_init(); //Tris and Port Initialization for PIC
while(1)
{
rcv_rfid();
stepcam_ON(); //Continuos Checking for Entry
check_rcv();
}
}
void port_init()
{
set_tris_b(0x00); //Function Definition for Port Initialization
output_b(0x00);
delay_ms(1000);
}
void rcv_rfid()
{
#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7)
gets(rf); //Get the RF indentification Number From uart
delay_ms(1000);
}
void stepcam_ON()
{
output_high(pin_d6); //Switch ON the Camera and Car
delay_ms(1000);
output_high(pin_d4);
delay_ms(1000);
}
void check_rcv()
{
#use rs232(baud=9600,xmit=pin_d0,rcv=pin_d1) //Function Definition for checking person
if(rf[7]=='9' || rf[8]=='9')
{
Zigbee_send1();
delay_ms(1000);
while(ar!='B')
{
#users232(baud=9600,xmit=pin_d0,rcv=pin_d1)
ar=getc();
}
output_low(pin_d6);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
}
else
{
zigbee_send2();
delay_ms(1000);
while(arr!='B')
{
#use rs232(baud=9600,xmit=pin_d0,rcv=pin_d1)
arr=getc();
}
output_low(pin_d6);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
}
}
void Zigbee_send1()
{
#use rs232(baud=9600,xmit=pin_d0,rcv=pin_d1)//Send Condition 1 Alert message to Monitor
Section
printf("Car Moved Safely\n\r");
}
void zigbee_send2()
{
#use rs232(baud=9600,xmit=pin_d0,rcv=pin_d1)
printf("UNAUTHORAISED PERSON ENTERED\r\n");//Send Condition 1 Alert message to Monitor
Section
}
Table 4-PIC16F917 DC Characteristics
MAX232 IC Pin description
Figure22.Max232 Ic Pin Diagram
REFERENCES
1. W. Wolf, B. Ozer “Vehicle controlling Embedded Systems,” IEEE
computer, Volume 35, Issue 9, pp. 48-53, Sep 2002.
2. M. Bamberger, J. Brunner, B. Renner and H. Schwabach, “Real-Time Video
Analysis on an Embedded Smart Camera for Traffic Surveillance,”
Proceedings of the 10th IEEE Real-Time and Embedded Technology and
Applications Symposium, pp. 174-181, 2004.
3. M. Bramberger, B. Rinner and H. Schwabach, “A Mobile Agent-based
System for Dynamic Task Allocation in Clusters of Embedded Smart
Cameras,” Third International Workshop on Intelligent Solutions in
Embedded Systems, pp. 17-26, 20 May 2005.
4. M. Bramberger, A. Doblander, A. Maier, B. Rinner, H. Schwabach,
“Distributed embedded smart cameras for surveillance applications,”
Computer Volume 39, Issue 2, pp. 68-75, Feb. 2006.
5. Pearson’s Publications , “microcontroller PIC16F917”.
6. Rong-Zhou, Chunyne Zhao, Lili Fu, Ao Chen and Meiqian Ye College of
information and electronic engineering Zhejiang Gongshang University,
Hangzhoou , China. “Zigbee Based Vehicle Access control”. Email:
.
7. www.microchip.com , www.alldatasheets.in , www.google.co.in
.