final main

Upload: sahil-sethi

Post on 03-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Final Main

    1/34

    1

    Chapter 1

    INTRODUCTION

    The objective of the project is to develop a device with the help of which we can

    authenticate a specified person or a group of persons to enter any authenticated area or

    just recognising them on the basis of RFID tags they are holding.

    The user will waive his tag over the RFID antenna and the 14 byte number on the tag

    will be read and it will be shown that he or she is authenticated or not.

    The project basically works on the radio frequency identification mechanism. The RFID

    module is the main part of the project and the microcontroller used is obviously the heart

    of it. We may divide the whole project into two parts. First is the design process. Design

    process basically contains the software work related to the printed circuit board. The

    ORCAD is the software used to design the whole pcb and the other hardware part is

    done with hands. The whole theory thus is divided into 2 parts.

    1) The hardware construction and programming of the microcontroller.2) The design process to design the schematic of the printed circuit board.

    TECHNICAL DETAILS

    The major part of the project will be an RFID READER module which is basically used

    for reading the RFID tags which the user holds. By reading, we mean to say that using

    radio frequency identification, the 14 bytes of data is read by the module and

    transmitted to the controller(we wish to use pic16f877a). Then the controller reads the

    data and we can manipulate the results by reading the bytes and programming the

    controller.

    The RFID reader module is a radio frequency identification based module which is used

    to read the tags possessed by the user. The basic fundamental is RFID. The antenna

    keeps poling for the data and it works with 125khz frequency. The baud rate is 9600 bps.

    That means the module sends the data with this speed.

    Whenever the tag comes in the limiting area of the antenna, the 14 bytes of the tag data is

    instantaneously transmitted to the controller by TTL logic. It is our wish to convert the

  • 7/29/2019 Final Main

    2/34

    2

    TTL logic into serial logic i.e. using MAX232 ic and a serial port to communicate with

    the computer.

    PIC16f87XA

    PIC16f87XA is a member of 8 bit microcontroller family. Some of the features of this

    controller are as given____

    High-Performance RISC (REDUCED INSTRUCTION SET CONTROLLER)

    CPU:

    1. Only 35 single-word instructions to learn2. All single-cycle instructions except for program branches, which are two-cycle3. Operating speed: DC20 MHz clock input DC200 ns instruction cycle4. Up to 8K x 14 words of Flash Program Memory, Up to 368 x 8 bytes of Data

    Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory

    5. Pin out compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXXmicrocontroller.

    The Block diagram of the module is given as under.

    fig no. 1

  • 7/29/2019 Final Main

    3/34

    3

    USEFULLNESS

    The project we propose has a lot of uses in the industry, any educational institute or at

    home. As security is the major aspect in todays world. It can be used in

    *industries, where some areas must be restricted to engineers or higher authorities.

    *educational institutes, for example a library where the record of incoming and outgoing

    persons is to be taken care of.

    *at home, only family can be authorised to enter the house and nobody else.

    And a lot of circumstances may appear where we may use the security system like this.

    MARKET POTENTIAL AND COMPETITIVE ADVANTAGE

    As seen with the view of industrial uses, the usefulness has been discussed above.

    The important criterion on the basis of which a product finds its place is the reliability.

    Hacking the above system is however not impossible but very difficult and it is a highly

    reliable device which authorises only the predefined personalities and we can also keep a

    database of the visitors. Secondly, as a system similar to this is already in use in metro

    stations where your card is used to charge you for your journey.

    The peripherals used are as follows:-

    1) RFID reader module.2) HD44780 LCD section.3) PIC 16F877A controller.4) RFID ANTENNA.5) POWER SUPPLY SECTION.

  • 7/29/2019 Final Main

    4/34

    4

    Chapter 2

    CIRCUIT DIAGRAM & WORKING

    Circuit diagram:

    fig no. 2

  • 7/29/2019 Final Main

    5/34

    5

    Work to be done

    The purpose of the project is to be done rf based authentication. Which are mostly

    provided in metro trains, in MNCs etc.To fulfil this purpose we generally used here rf

    module system. which is the heart of this project. The another component that we used

    here is pic16f887microcontroller.

    1. So the main work to be done here is to make the layout of this project. The layoutcan be get with the help of software ORCAD.

    2. Now we have to implement this layout on PCB.For this purpose we make thelayout on PCB with the help of pen by putting the carbon paper on PCB.After

    that we have mark this layout with black sketch.

    3. The etching of project can be done with the help of ferric chloride solution byputting the PCB in this solution, now this solution has to place under the sunlight.

    So that etching can be done fast.

    4. Now we have to drill the PCB where necessary connection is required.component required for this purpose is rf module system ,IC16f887 ,LCD

    display ,Resister1k, 10k,capacitor100mf ,Regulatlar7805

    ,Diodes,Connectors,Led,Transformer etc.

    5. To run this project first of all we have to make the power supply.The requiredcomponent for power supply is resister of 1k,4 diodes,regulator7805,LED,step

    down transformer etc.

    6. The microcontroller that we used here is PIC 16f887.The first pin of mc willattach to reset switch and capacitor and resister.

    7. Pin no 9 and 10 attach to two capacitor and connected to vcc.8. Pin no 19,20,27,28,29,30,32 connected to LCD display.9. Last but not least, we have to make the source code with the help of PIC burner.10.Now we have to make the project report of this project.

  • 7/29/2019 Final Main

    6/34

    6

    Work done

    1.

    The layout and etching of project is done with the help of

    Project Guide=vishesh gupta

    Team member=Srishti Thakur, Navneet kaur Rathore

    2. Drilling is done with the help ofTeam member= Srishti Thakur, Navneet kaur Rathore,

    3. Power supply is run with the help ofTeam member=Srishti Thakur, Navneet kaur Rathore

    4. Soldering of another component is done with the help ofTeam member=Pallavi shree

    5. Source code is made with the help ofProject Guide=vishesh gupta

    Team member= Srishti Thakur, Navneet kaur Rathore,Pallavi shree

    6. Project report is made byTeam member= Srishti Thakur, Navneet kaur Rathore,Pallavi shree

  • 7/29/2019 Final Main

    7/34

    7

    RFID Reader Test Circuit

    In this tutorial we will create most basic circuit for testing RFID Reader. Once you

    complete this successfully, you know how to get data from RFID Reader. You will also

    have working code that you may use will other more useful projects.

    The test circuit will be built around PIC16F877Amicrocontroller. The output device

    will be a16x2 lcd module. So we set up a basic PIC16F877A circuit. The circuit will

    have the following :-

    1. PIC16F887A MCU2. 20MHz Crystal3. Reset Circuit.4. 5v Power Supply Circuit.5. ISP (For programming)6. LCD Module.7. LCD Module Contrast adjust pot.

    Please note that power supply circuit is NOT shown in the above schematic. You will

    need a 7805 voltage regulatorIC in order to generate 5v from any source of 8-18v.

    The above circuit is so common that you may require it as a base for several projects and

    experiment.

    TROUBLESHOOTING

    1. NO Display on LCDi. Make sure AVR Studio Project is set up for clock frequency of 20MHz

    (20000000Hz)

    ii. Adjust the Contrast Adj Pot.2. RFID Reader is NOT reading card.

    i. Make sure you have bought compatible 125KHz tags.ii. Use only 16MHz crystal (for other value you need to change the program)

    iii. Fuse bits are set as told above.

    http://extremeelectronics.co.in/avr-tutorials/part-i-introduction/http://extremeelectronics.co.in/avr-tutorials/part-i-introduction/http://shop.extremeelectronics.co.in/product_info.php?cPath=25&products_id=32http://shop.extremeelectronics.co.in/product_info.php?cPath=25&products_id=32http://shop.extremeelectronics.co.in/product_info.php?cPath=24_29&products_id=45http://shop.extremeelectronics.co.in/product_info.php?cPath=24_29&products_id=45http://shop.extremeelectronics.co.in/product_info.php?cPath=25&products_id=32http://extremeelectronics.co.in/avr-tutorials/part-i-introduction/
  • 7/29/2019 Final Main

    8/34

    8

    3. Compiler Errorsi. Many people these days has jumped to embedded programming without a solid

    concept of computer science and programming. They don't know the basics of

    compiler and have very less experience. To learn basic of compilers and their

    working PC/MAC/Linux( I mean a desktop or laptop) are great platform. But

    embedded system is not good for learning about compilers and programming

    basics. It is for those who already have these skills and just want to apply it.

    1. Make sure all files belonging to the LCD Library are added to the "Project".2. Make sure all files belonging to the USART Library are added to the "Project".

    The RFID Reader is used to read the tags. The tags can be used to identify

    peoples. For example in a electronic door lock, the user just need to bring a tag

    (which can be a card or keychain) near the antenna. The system identify the user

    and present a welcome message (like "Welcome Mr. Steve"), then it prompts for

    password. Its like your ATM card but the advantage is that you don't need to

    bring it out from your wallet. Just touch the wallet to the antenna, and that's it!

    The USB to TTL Module is used to connect the RFID reader to PC.

    Connect the RFID reader to USB/TTL Converter as show in in the image below.

    fig no. 3

    The connection is simple. All the PIN names are written on the PCBs itself so no

    confusion while wiring. After that attach the antenna to the RFID reader module.

    http://shop.extremeelectronics.co.in/product_info.php?cPath=54&products_id=238http://shop.extremeelectronics.co.in/product_info.php?cPath=54&products_id=238
  • 7/29/2019 Final Main

    9/34

    9

    RFID Antenna

    fig no. 4

    RFID Antenna Connected

    fig no. 5

  • 7/29/2019 Final Main

    10/34

    10

    Now make sure the data mode select jumper is towards the 'U' side.

    Finally connect the USB to Serial Converter to your PCs USB port.

    On RealTerm Window, go to port tab and select the settings as shown below.

    1. Baud = 96002. Port = Port Number Assigned to the CP2102 Module. (Can be found out from, Right

    Click My Computer, Properties->Hardware->Device Manager->Ports)

    3. Parity = None4. Data bits = 8+5. Stop Bits =16. Hardware Flow Control =NONE

    The Top black portion on the Realterm window shows the data received from the port.

    When you bring a tag near the Antenna, the green LED on the RFID Reader will blink

    and the data will be shown on real term. The above images shows three data packets. The

    same tag was brought close three times.

    INTERPRETING RFIDDATA PACKET.

    The RFID data packet is made up of 14 bytes. The first is a start byte whose ASCII value

    is decimal 2. This is shown in RealTerm as STX. Then their are 10 ASCII chars which is

    the ID of tag in HEX format. After that their is a two byte check sum, this is also in hex.

    Finally their is a end byte whose ASCII value in decimal is 3. It is shown in RealTerm as

    ETX.

    For example in our case card data is 3D006217D7 so the checksum is calculated as

    follows.

    (3D) XOR (00) XOR (62) XOR (17) XOR (D7)

    You can use Windows Calculator is Scientific Mode (View -> Scientific) to calculate the

    above. Make sure the calculator is in HEX mode.

    The result comes to be 9F

    Which you can see is present as checksum in the above packet (shown in RealTerm)

  • 7/29/2019 Final Main

    11/34

    11

    To convert the tag number to decimal leave the first two digits on the tag data and take

    the rest 8 digits. Ex

    Tag Data 3D006217D7. Leave 3D and take 006217D7. Paste that in Windows calculator

    (in HEX mode) and change to Decimal mode by clicking "Dec" which is placed next to

    "Hex". Calculator will convert the data to decimal number. You can confirm that this

    number is also printed on the tag. In our case it comes to be

    6428631

    Which was printed on our tag!

  • 7/29/2019 Final Main

    12/34

    12

    Chapter 3

    LITERATURE REVIEW

    The project basically works on the radio frequency identification mechanism. The RFID

    module is the main part of the project and the microcontroller used is obviously the heart

    of it. We may divide the whole project into two parts. First is the design process. Design

    process basically contains the software work related to the printed circuit board. The

    ORCAD is the software used to design the whole pcb and the other hardware part is

    done with hands. The whole theory thus is divided into 2 parts.

    1. The hardware construction and programming of the microcontroller.2. The design process to design the schematic of the printed circuit board.

    The explanation of the first part will contain the full hardware processes and the

    peripherals details.

    The hardware construction and programming of the microcontroller

    The heart of the project is obviously the microcontroller. The MCU used here is

    PIC16F877A. 40 pin PDIP IC to control everything in the circuit process. The details of

    the controller used is as follows.

    PIC16f87XA

    PIC16f87XA is a member of 8 bit microcontroller family. Some of the features of this

    controller are as given____

    High-Performance RISC (REDUCED INSTRUCTION SET CONTROLLER)

    CPU:

    1. Only 35 single-word instructions to learn2. All single-cycle instructions except for program branches, which are two-cycle3. Operating speed: DC20 MHz clock input DC200 ns instruction cycle4. Up to 8K x 14 words of Flash Program Memory, Up to 368 x 8 bytes of Data

    Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory

    5. Pin out compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXXmicrocontroller.

  • 7/29/2019 Final Main

    13/34

    13

    6. Peripheral Features:1. Timer0: 8-bit timer/counter with 8-bit prescaler.2. Timer1: 16-bit timer/counter with prescaler that can be incremented during Sleep via

    external crystal/clock.

    3. Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.4. Two Capture, Compare, PWM modules.5. Capture is 16-bit, max. Resolution is 12.5 ns.6. Compare is 16-bit, max. Resolution is 200 ns.7. PWM max. Resolution is 10-bit.8. Synchronous Serial Port (SSP) with SPI (Master mode) and I2C (Master/Slave).9. Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit

    address detection.

    10.Brown-out detection circuitry for Brown-out Reset (BOR).Analog Features:

    1. 10-bit, up to 8-channel Analog-to-Digital Converter (A/D)2. Brown-out Reset (BOR)3. Analog Comparator module with:

    i. Two analog comparators.ii. Programmable on-chip voltage reference (VREF) module.

    iii. Programmable input multiplexing from device Inputs and internal voltagereference.

    iv. Comparator outputs are externally accessible.Special Microcontroller Features:

    1. 100,000 erase/write cycle Enhanced Flash program memory typical2. 1,000,000 erase/write cycle Data EEPROM memory typical3. Data EEPROM Retention > 40 years4. Self-reprogrammable under software control5. In-Circuit Serial Programming (ICSP) via two pins6. Single-supply 5V In-Circuit Serial Programming7. Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation

  • 7/29/2019 Final Main

    14/34

    14

    8. Programmable code protection9. Power saving Sleep mode10.Selectable oscillator options11.In-Circuit Debug (ICD) via two pinsFollowing is a comparison table b/w different 16f member.

    Table no. 1

  • 7/29/2019 Final Main

    15/34

    15

    pic16f887

    fig no. 6

    The pic16f887a comes in different packages. One of them is PDIP that is dual inline

    package. That is shown above. We have used the same package in the project.

  • 7/29/2019 Final Main

    16/34

    16

    LIQUID CRYSTAL DISPLAY (HD44780)

    LCDDisplayLiquid crystal displays (LCD) are widely used in recent years as compares to LEDs. This

    is due to the declining prices of LCD, the ability to display numbers, characters and

    graphics, incorporation of a refreshing controller into the LCD, their by relieving the

    CPU of the task of refreshing the LCD and also the ease of programming for characters

    and graphics. HD 44780 based LCDs are most commonly used.

    LCD pin description

    The LCD discuss in this section has the most common connector used for the Hitatchi

    44780 based LCD is 14 pins in a row and modes of operation and how to program and

    interface with microcontroller is describes in this section.

    Table no. 2

    Pin Symbol I/O Description

    1 VSS - Ground

    2 VCC - +5V power supply

    3 VEE - Power supply to control contrast4 RS I RS=0 to select command register, RS=1 to select data

    register.

    5 R/W I R/W=0 for write, R/W=1 for read

    6 E I/O Enable

    7 PB0 I/O The 8 bit data bus

    8 PB1 I/O The 8 bit data bus

    9 DB2 I/O The 8 bit data bus

    10 DB3 I/O The 8 bit data bus

    11 DB4 I/O The 8 bit data bus

    12 DB5 I/O The 8 bit data bus

    13 DB6 I/O The 8 bit data bus

    14 DB7 I/O The 8 bit data bus

  • 7/29/2019 Final Main

    17/34

    17

    VCC, VSS, VEE

    The voltage VCC and VSS provided by +5V and ground respectively while VEE is used for

    controlling LCD contrast. Variable voltage between Ground and Vcc is used to specify

    the contrast (or "darkness") of the characters on the LCD screen.

    RS (register select)

    There are two important registers inside the LCD. The RS pin is used for their selection

    as follows. If RS=0, the instruction command code register is selected, then allowing to

    user to send a command such as clear display, cursor at home etc.. If RS=1, the data

    register is selected, allowing the user to send data to be displayed on the LCD.

    R/W (read/write)

    The R/W (read/write) input allowing the user to write information from it. R/W=1, when it read

    and R/W=0, when it writing.

    EN (enable)

    The enable pin is used by the LCD to latch information presented to its data pins. When

    data is supplied to data pins, a high power, a high-to-low pulse must be applied to this

    pin in order to for the LCD to latch in the data presented at the data pins.

    D0-D7 (data lines)

    The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents

    of the LCDs internal registers. To displays the letters and numbers, we send ASCII

    codes for the letters A-Z, a-z, and numbers 0-9 to these pins while making RS =1. There

    are also command codes that can be sent to clear the display or force the cursor to the

    home position or blink the cursor.

    We also use RS =0 to check the busy flag bit to see if the LCD is ready to receive the

    information. The busy flag is D7 and can be read when R/W =1 and RS =0, as follows: if

    R/W =1 and RS =0, when D7 =1(busy flag =1), the LCD is busy taking care of internal

    operations and will not accept any information. When D7 =0, the LCD is ready to

    receive new information.

  • 7/29/2019 Final Main

    18/34

    18

    POWER SUPPLY DESCRIPTION:

    fig no.7

    The power supply circuit comprises of four basic parts:

    The transformer steps down the 220 V a/c. into 12 V a/c. The transformer work on the

    principle of magnetic induction, where two coils: primary and secondary are wound

    around an iron core. The two coils are physically insulated from each other in such a way

    that passing an a/c. current through the primary coil creates a changing voltage in the

    primary coil and a changing magnetic field in the core. This in turn induces a varying

    a/c. voltage in the secondary coil.

    The a/c. voltage is then fed to the bridge rectifier. The rectifier circuit is used in most

    electronic power supplies is the single-phase bridge rectifier with capacitor filtering,

    usually followed by a linear voltage regulator. A rectifier circuit is necessary to convert a

    signal having zero average value into a non-zero average value. A rectifier transforms

    alternating current into direct current by limiting or regulating the direction of flow of

    current. The output resulting from a rectifier is a pulsating D.C. voltage. This voltage is

    not appropriate for the components that are going to work through it.

    The ripple of the D.C. voltage is smoothened using a filter capacitor of 1000 microF25V. The filter capacitor stores electrical charge. If it is large enough the capacitor will

    store charge as the voltage rises and give up the charge as the voltage falls. This has the

    effect of smoothing out the waveform and provides steadier voltage output. A filter

    capacitor is connected at the rectifier output and the d.c voltage is obtained across the

    capacitor. When this capacitor is used in this project, it should be twice the supply

    voltage. When the filter is used, the RC charge time of the filter capacitor must be short

    VOLTAGE

    REGULATORSHUNT

    CAPACITOR

    BRIDGE

    RECTIFIERTRANSFORMER

  • 7/29/2019 Final Main

    19/34

    19

    and the RC discharge time must be long to eliminate ripple action. In other words the

    capacitor must charge up fast, preferably with no discharge.

    1. When the rectifier output voltage is increasing, the capacitor charges to the peakvoltage Vm. Just past the positive peak, the rectifier output voltage starts to fall

    but at this point the capacitor has +Vm voltage across it. Since the source voltage

    becomes slightly less than Vm, the capacitor will try to send current back through

    the diode of rectifier. This reverse biases the diode. The diode disconnects or

    separates the source the source form load. The capacitor starts to discharge

    through load. This prevents the load voltage from falling to zero. The capacitor

    continues to discharge until source voltage becomes more than capacitor voltage.

    The diode again starts conducting and the capacitor is again charged to peak

    value Vm. When capacitor is charging the rectifier supplies the charging through

    capacitor branch as well as load current, the capacitor sends currents through the

    load. The rate at which capacitor discharge depends upon time constant RC. The

    longer the time constant, the steadier is the output voltage. An increase in load

    current i.e. decrease in resistance makes time constant of discharge path smaller.

    The ripple increase and d.c output voltage V dc decreases. Maximum capacity

    cannot exceed a certain limit because the larger the capacitance the greater is the

    current required to charge the capacitor.

    The voltage regulator regulates the supply if the supply if the line voltage increases or

    decreases. The series 78xx regulators provide fixed regulated voltages from 5 to 24 volts.

    An unregulated input voltage is applied at the IC Input pin i.e. pin 1 which is filtered bycapacitor. The out terminal of the IC i.e. pin 3 provides a regular output. The third

    terminal is connected to ground. While the input voltage may vary over some

    permissible voltage range, and the output voltage remains constant within specified

    voltage variation limit. The 78xx ICs are positive voltage regulators whereas 79xx ICs

    are negative voltage regulators.

  • 7/29/2019 Final Main

    20/34

    20

    These voltage regulators are integrated circuits designed as fixed voltage regulators for a

    wide variety of applications. These regulators employ current limiting, thermal shutdown

    and safe area compensation. With adequate heat sinking they can deliver output currents

    in excess of 1 A. These regulators have internal thermal overload protection. It uses

    output transistor safe area compensation and the output voltage offered is in 2% and 4%

    tolerance.

    The rfid section

    RFID is a great technology, has may uses and become very cheap and easy to implement

    these days. Very interesting and useful project can be made by using RFID technology.

    In our tutorial series on RFID we will get introduced to this magical technology and

    practically create RFID based solutions.

    In RFID or Radio Frequency Identification their is a tag (or label) which has a unique ID

    stored on it. We can read this ID by using a RFID reader. Not much fun yet? Well the

    features which makes magical are :-

    1. The RFID tag does not need to make any electrical contact with reader (Wow!)2. The RFID Tag is an active device which has a chip and antenna but does NOT

    need any power and are low cost!(Some tags need battery)

    3. RFID tags are very small, don't need battery so can be put in cards (looks like acredit/ATM cards) or key chains.

  • 7/29/2019 Final Main

    21/34

    21

    RFID Example

    For example RFID may be used to identify a person in a secure access system as shown

    below.

    RFID SECURITYSYSTEM

    fig no. 8

    As soon as a RFID Tag (Which may be a card or a key chain) is brought near the system,

    it recognize the person and grant access.

    The great thing is that you don't have to open your wallet and bring out the card (as you

    do for credit or ATM cards), just bring out the wallet and bring it near the system that's

    it!

    The images below shows some example of RFID Tags. Note that the pen and the Credit

    Card are not tags they are just for scale.

    UART Based Plug and Play RFID Reader.

    In order to read any RFID tag you need a RFID Reader. We have agreat UART based

    Card Reader Moduleat very low cost. It is a complete module with Antenna and Logic

    Chip (which handles everything). The module does everything and sends the final

    decoded card number (in HEX format) via UART. As you may know UART is a

    hardware which sends and receive data in a protocol called RS-232. RS232 is the

    http://shop.extremeelectronics.co.in/product_info.php?products_id=132http://shop.extremeelectronics.co.in/product_info.php?products_id=132http://shop.extremeelectronics.co.in/product_info.php?products_id=132http://shop.extremeelectronics.co.in/product_info.php?products_id=132http://shop.extremeelectronics.co.in/product_info.php?products_id=132http://shop.extremeelectronics.co.in/product_info.php?products_id=132
  • 7/29/2019 Final Main

    22/34

    22

    simplest serial protocol. It is so common that nearly all MCU supports RS232 via one or

    more USARTs(also called UART).

    UART Communication involves just 2 data lines. One of them is called RxD (Receiving

    Data) and Another is called TxD (Transmitting Data). One more line called "common" is

    also necessary between two isolated systems. Normally GND is kept common between

    all devices and modules. Since RFID Reader Module only sends data and does not

    receive any data, only Tx line from RFID is used.

    Typical Interface Between MCU and RFID Reader

    fig no. 9

    In the previous diagram please note the following facts

    1. Microcontroller board is powered from an external source like DC adaptor orbattery.

    2. Microcontroller board has 5v regulator built in.3. 5v Output is available from above regulator.4. The 5v out is feed to the RFID reader which powers the module.5. Tx line from RFID reader is feed to the Rx line of MCU.6. Tx line of MCU and Rx line of RFID Reader are unused.

    Now when a Card (tag) is brought near the RFID reader, it tries to communicate with the

    tag, receives the data and decodes it. Finally it send the data over the Tx line. The UART

    module in MCU receives the data and USART library buffers it into the internal

  • 7/29/2019 Final Main

    23/34

    23

    memory. The user program running on the MCU wait till the USART library informs it

    that sufficient data is available (in this case more than 13 bytes). When data is available,

    user program can read and validate the data. After that it can be used as per application

    requirement. For example if card number matches internally stored card number, the user

    is granted access to the system or open a door and log the entry time of that person in a

    database.

    PIN Configuration of RFID Reader

    Fig no.10

    PIN1 : Tx

    PIN2: Rx

    PIN3: Not Connected.

    PIN4: GND

    PIN5: Vcc (5v) InputThe antenna that comes bundled with the module can be easily

    connected by just plugging it in.

  • 7/29/2019 Final Main

    24/34

    24

    Chapter 4

    Programming and Result

    At last we can state that the module is quite simple to use and with a little programming

    skill we can do wonders with it. It can be interfaced with the stepper motor or simple dc

    motors to open the door for someone authorised and with gsm technology interfaced,

    when a wrong person tries to enter, the module will not only ring the alarm but also will

    call you or the nearest police station. The basic source code used for the controller is as

    follows...

    SOURCE CODE USED IN THE CONTROLLER

    /* THE PROGRAM FOR

    RFID READER MODULE

    VIP

    DATE STARTED= 1-11-2012*/

    #include

    // #fuses HS

    #byte intcon = 0x0b

    #byte pir1 = 0x0c

    #byte rcsta = 0x18

    #byte pie1 = 0x8c

    #byte txsta = 0x98

    #byte spbrg= 0x99

  • 7/29/2019 Final Main

    25/34

    25

    #byte port_c = 0x07

    #byte tris_c = 0x87

    #byte txreg = 0x19

    #byte rcreg = 0x1a

    #byte port_d = 0x08

    #byte tris_d = 0x88

    #byte port_e = 0x09

    #byte tris_e = 0x89

    #byte tris_b=0x86

    #byte port_b=0x06

    #byte option=0x81

    #byte intcon=0x8b

    void lcd_command(unsigned char cmd);

    void lcd_data(unsigned char dat);

    unsigned int32 i,j=0,grant=0,deny=0;

    unsigned char ch,array[20];

    #INT_RDA

    receive()

  • 7/29/2019 Final Main

    26/34

    26

    {

    array[j]=rcreg;

    //pir1 &= 0xdf;

    lcd_data(array[j]);

    j++;

    }

    #INT_EXT

    function()

    {

    lcd_command(0x02);

    lcd_command(0x01);

    lcd_command(0x38);

    lcd_command(0x0e);

    lcd_command(0x06);

    lcd_command(0x80);

    lcd_data("denied=");

    lcd_command(0x88);

    lcd_data(deny+48);

  • 7/29/2019 Final Main

    27/34

    27

    lcd_command(0xc0);

    lcd_data("granted=");

    lcd_command(0xc9);

    lcd_data(grant+48);

    for(i=0;i

  • 7/29/2019 Final Main

    28/34

    28

    tris_c |= 0xc0;

    tris_d = 0x00;

    tris_e = 0x00;

    tris_b &= 0x01;

    option = 0xbf;

    pie1 |= 0x20;

    intcon = 0xd0;

    lcd_command(0x02);

    lcd_command(0x01);

    lcd_command(0x38);

    lcd_command(0x0e);

    lcd_command(0x06);

    lcd_command(0xc0);

    lcd_data("PLZ SHOW UR CARD");

    lcd_command(0x80);

    while(1)

  • 7/29/2019 Final Main

    29/34

    29

    {

    if(j>=14)

    {

    j=0;

    for(i=0;i

  • 7/29/2019 Final Main

    30/34

    30

    lcd_command(0x01);

    lcd_command(0x38);

    lcd_command(0x0e);

    lcd_command(0x06);

    lcd_command(0xc0);

    lcd_data("access granted");

    lcd_command(0x80);

    grant++;

    break;

    case '7':

    lcd_data("CARD 2");

    for(i=0;i

  • 7/29/2019 Final Main

    31/34

    31

    lcd_command(0x80);

    deny++;

    break;

    }

    }

    }

    }

    void lcd_command(unsigned char cmd)

    {

    port_e = 0x00;

    port_d = cmd;

    port_e |= 0x04;

    for(i=0;i

  • 7/29/2019 Final Main

    32/34

    32

    void lcd_data(unsigned char dat)

    {

    port_e = 0x01;

    port_d = data;

    port_e |= 0x04;

    for(i=0;i

  • 7/29/2019 Final Main

    33/34

    33

    Chapter 5

    Conclusion and future scope

    As seen with the view of industrial uses, the usefulness has been discussed above.

    The important criterion on the basis of which a product finds its place is the reliability.

    Hacking the above system is however not impossible but very difficult and it is a highly

    reliable device which authorises only the predefined personalities and we can also keep a

    database of the visitors. Secondly, as a system similar to this is already in use in metro

    stations where your card is used to charge you for your journey.

    The scope for security purpose for this project is enormous. These RFID tags used can be

    miniaturised and put into your household things like wallet, briefcase so that its only

    identity remains with you. You collar your dog with rfid tag and its easy to unauthorized

    him to go into the garden or anything else. The point is, in daily life, its future scope is

    vital.

  • 7/29/2019 Final Main

    34/34

    REFRENCES

    PIC16F877A datasheet.

    HD47780 datasheet.

    www.extremeelectronics.co.in

    http://shop.extremeelectronics.co.in/product_info.php?cPath=54&products_id=238

    http://shop.extremeelectronics.co.in/product_info.php?cPath=34&products_id=132

    www.wikipedia.org

    http://www.extremeelectronics.co.in/http://www.extremeelectronics.co.in/http://shop.extremeelectronics.co.in/product_info.php?cPath=54&products_id=238http://shop.extremeelectronics.co.in/product_info.php?cPath=54&products_id=238http://shop.extremeelectronics.co.in/product_info.php?cPath=34&products_id=132http://shop.extremeelectronics.co.in/product_info.php?cPath=34&products_id=132http://www.wikipedia.org/http://www.wikipedia.org/http://www.wikipedia.org/http://shop.extremeelectronics.co.in/product_info.php?cPath=34&products_id=132http://shop.extremeelectronics.co.in/product_info.php?cPath=54&products_id=238http://www.extremeelectronics.co.in/