Click here to load reader

User Guide Card Reader Demo · PDF file 2016. 2. 1. · Card Reader Guide Card Reader Guide has magnetic sensor inside it which reads track data during swipe. During the swipe, make

  • View
    0

  • Download
    0

Embed Size (px)

Text of User Guide Card Reader Demo · PDF file 2016. 2. 1. · Card Reader Guide Card...

  •  

    1      

    MICROCHIP

    User Guide Card Reader

    Demo

  •  

    2      

    Revision History REV DATE ORIGINATOR DESCRIPTION OF CHANGE

    0.1 08.03.15 Shilpa Ganganna

    Venkatesh Bengeri Initial Version

    0.2 09.15.15 Shilpa Ganganna Updated the schematic and BOM section to accommodate the “Device Sleep” feature.

    0.3 10.15.15 Shilpa Ganganna Updated the user guide to include PIC24F solution.

  •  

    3      

    Contents      

    Revision  History  ......................................................................................................................................  2  

    1.   Introduction  ...............................................................................................................................  4  

    2.   Card Reader Background  .......................................................................................................  4  

    2.1. Data Encoding  ......................................................................................................................  4  

    2.2. Data Format  ..........................................................................................................................  4  

    3.   Hardware  ..................................................................................................................................  5  

    3.1. Operational Amplifiers (Op-amp)  .......................................................................................  5  

    3.2. On chip ADC  .........................................................................................................................  5  

    3.3. RS-232 Connectivity  ............................................................................................................  5  

    4.   Software:  ...................................................................................................................................  5  

    4.1. For dsPIC solution  ...............................................................................................................  6  

    4.2. For PIC24F solution  .............................................................................................................  8  

    5.   Device specifications  ..............................................................................................................  9  

    5.1. For dsPIC solution  ...............................................................................................................  9  

    5.2. For PIC24F solution  .............................................................................................................  9  

    6.   Hardware Requirements  .......................................................................................................  10  

    6.1. For dsPIC solution  .............................................................................................................  10  

    6.2. For PIC24F solution  ...........................................................................................................  12  

    7.   Hardware Connections  .........................................................................................................  14  

    7.1. For dsPIC solution  .............................................................................................................  14  

    7.2. For PIC24F solution  ...........................................................................................................  14  

    8.   Demo Instructions  ..................................................................................................................  15  

    9.   Demo Instructions for Card Reader with Software AES-128 Encryption  ......................  18  

    I.   APPENDIX A  ..........................................................................................................................  22  

    A.   For dsPIC solution:  ............................................................................................................  22  

    B.   For PIC24F solution:  .........................................................................................................  24  

    II.   APPENDIX  B  ..........................................................................................................................  25  

    A.   Steps for programming hex file using MPLABX IDE  ....................................................  25  

       

     

     

     

  •  

    4      

    1. Introduction

    With the common use of cards instead of cash, Credit Card Reader (MSR, mag stripe/swipe readers) are an essential part of any POS system. MSRs can read any card with magnetic stripes, including some driver's licenses, gift cards, and other IDs.

    Magnetic Card Readers (also known as Magnetic Stripe Readers or MSRs) read data from a 3-track magnetic stripe via a peak detection circuit and process that data for downstream users. After extracting data from the magnetic stripe, it is converted to binary data and formatted for encryption. They feed the swiped information to applications management software and connect through USB, RS-232, or PS/2 connections.

    This demonstration shows the Magnetic Stripe Reader using Microchip’s dsPIC and PIC24F device and displays the card data on the serial terminal.

    2. Card Reader Background

    2.1. Data Encoding There are number of different formats used for encoding information on magnetic stripes. Data encoded on the magnetic stripe using ISO/IEC-7811 standard is known as "Frequency/double frequency (F2F)" or “Aiken Bi-Phase” encoding. The serial data encoded is self-clocking. Each bit of data on a track has a fixed physical length on the magnetic stripe. Bits are encoded serially on the magnetic stripe using a series of magnetic flux transitions. The presence or absence of an additional peak in the middle of the bit determines whether it is a ‘1’ or a ‘0’.

    Figure 1. Magnetic Stripe Encoding

    2.2. Data Format The data format specified by ISO/IEC-7811 encodes 7-bit (6 bits + parity) characters on Track 1, and 5-bit (4 bits + parity) decimal characters on Track 2. Track 3 contains 5-bit encoding. Characters are written to the stripe LSB-first, with the parity bit written last. All tracks contain leading and trailing zeroes at the ends of the stripe to aid the clock recovery process. When read in the forward direction, a typical track contains information in the following order: 1. Clocking zeroes 2. A start sentinel character 3. Data characters 4. An end sentinel character 5. A longitudinal redundancy check character 6. Clocking zeroes

  •  

    5      

    3. Hardware It includes Op-amp circuitry, power supply and RS-232 connectivity.

    3.1. Operational Amplifiers (Op-amp) In dsPIC solution, Internal OP-amps of the device is used amplify and shift the signals from Magnetic Read Head such that the signal is read by on chip ADC. In the case of PIC24F solution, external Op-amps are used to amplify and shift the signals from Magnetic Read Head such that the signal is read by on chip ADC.

    Track outputs from Magnetic Guide Head are connected to the Inverting terminal of the Op-ampT1, T2 and T3 respectively. Output of Op-amp is connected to the analog channels of the Microcontroller. OP-amp circuit connections for tracks 1 is shown in figure 2.

    Figure 2: Op-amp connections for Track 1

    3.2. On chip ADC The Op-amp output signals corresponding to Track1, Track2 and Track3 data are read by Analog-to-digital converter (ADC).

    3.3. RS-232 Connectivity dsPIC solution: Mini-USB port on the demo board can be connected to a PC. PIC24F solution: External MCP2200 Serial-to-USB converter is used for connecting PC to demo board. Note: dsPIC based demo board has integrated MCP2200.

    4. Software:  

    An exponential averaging technique is applied to filter the noise prior to the signal detection algorithm. While the card is swiped, the software algorithm performs the F2F decoding and stores the time between consecutive peaks into RAM. After a swipe has finished, the read data is decoded and checked for the errors. Universal asynchronous receiver/transmitter (UART) is used to transfer the decoded data from the controller to the PC terminal application.

  •  

    6      

    The basic flowchart which shows the working of the card reader is shown below:

    4.1. For dsPIC solution dsPIC solution is interrupt based solution. In order to save power, the device is put into sleep mode. It wakes up during the swipe, decodes the track and prints it on Serial Terminal and goes back to sleep mode.

    main loop

    No

    Start

    Configure ADC, UART, TIMERs, Internal OP- AMPs and comparator

    Configure ADC interrupt

    Is SLP Jumper P1 connected?

    Sleep

    Y e s  

     

     

Search related