How to Interface Swipe Card Reader with AVR


Swipe Card Reader Interface




Swipe Cards are used nowadays at many locations that include Point of Sale Terminals, Access Control, ATM Machines, Motorway Toll, Airline Tickets Verification, Vending Machines, etc. They connect to the host Microprocessor through Direct I/O interface, RS-232 serial ports or USB.
Swipe Cards used in Financial Transaction have a defined size, Track Encoding and card Data Format. Debit Card and Credit Card are example of Financial Transaction Card.

As the Financial Transaction Cards and information related to them are available easily, they are used in this project. Details of FTC are provided as under.
Card Dimensions, Encoding and Data Format for credit cards as per ISO7813






Swipe Card Reader Connector

Magtek is world renowned swipe card manufacturer. Card reader used in this project is Magtek Part number 2105004 which is 101mm compatible, Dual Track (Track 1 & 2) Swipe card reader with cover. The Card has TTL compatible direct I/O interface, as detailed below:

Signal Timing

The timing of signal on CARD PRESENT, STROBE and DATA is as under


Connecting Card Reader to the AVR Project Board
Below is the schematic of the wiring of the card to the AVR project board to capture the track 1 of the card.


J1 in the schematic is the swipe card 8 pin connector.
Note: Remove the MAX 232 from the project board, or use any other port pin for DATA signal as the PD0 and PD1 are directly connected to the MAX 232.
TRACK 1 DATA FORMAT

The following is typical for Track 1 data.
The Track 1 data format includes the following items:

  1. Approximately 62 leading clocking zeros
  2. The Start Sentinel "%"
  3. Up to 76 alphanumeric characters selected by the user
  4. The end sentinel "?"
  5. The LRC (longitudinal redundancy check character)
  6. Trailing clocking zeros (minimum of 62) to the end of the card

Each data character is in a 7-bit (6 plus parity) alphanumeric format. The data is in the format "parity, 32, 16, 8, 4, 2, 1". Parity is odd (an odd number of "one's" in each character).
The character is written "backwards" on the card starting with the least significant digit and ending with the parity bit. The card data format is "1, 2, 4, 8, 16, 32, parity".


Decoding Reader Output
The usual way to gather card data from a TTL (Transistor-Transistor Logic) swipe magnetic card reader as described in the Magtek Application Note is as follows:

  1. Connect the strobe line to an interrupt port on the CPU that is programmed to interrupt on the falling edge of the strobe.
  2. Connect the data line to an ordinary CPU port pin.
  3. Connect the card present line to another ordinary CPU port pin.

All three of the above signals are quiescently high (VCC). When a card is swiped, the first signal to go low (active) is Card Present. It will go low after 14 to 15 head flux reversals have been read. These initial strobes are not output on the strobe line. After Card Present goes low, the strobes are output on the strobe line. Storing data should not begun until the data line goes low (indicating a one) and the strobe line falls. When this occurs, the CPU starts to store the data in RAM (Random Access Memory) until the strobes stop because the card has cleared the head. Approximately 150ms later, Card Present returns to VCC. When this occurs, the CPU analyzes the data in RAM and converts it to the ASCII.


Software for Decoding Track 1
The Software that does this is listed below. Note that the code listed here has some limitation as below

  • It decodes Track 1 only
  • It does not calculate the parity check
  • It does not calculate the LRC
  • Card only can be swiped in one way (one that is shown on the card reader) to get valid output.
  • The listed code does not output data to any console or somewhere so that it can be seen by the user. In order to see the data, user has to connect JTAG Board and Host computer to the AVR Project Board and use the debugging features of the AVR Project Board. After a card is swiped, he has to halt the code and see the appropriate variables in the watch window in order to check the output. Alternatively user may write his own code to send the data to some display.
  • It does not check for “start sentinel” to begin data collection, which is more reliable way of gathering data.


Click Here For Source Code
4 Comments
Disqus
Fb Comments
Comments :

4 comments:

  1. Great post....Thank you for posting the great content……I found it quiet interesting, hopefully you will keep posting such blogs…
    If you Want more details kindly Visit us

    ReplyDelete
  2. Do ATM Hacking Exist ?
    Yes, you can actually hack an atm and make it dispense free money but not with any trick like:
    ATM HACKING USING CANDLE WAX,HACKING ATM WITH USB,ATM HACKING USING IPHONE OR SAMSUNG GALAXY,ATM HACKING USING SIM CARD. ATM hacking does not involve any master passwords or hack codes.
    THE REAL ATM HACKING GUIDE.
    Now you might be wondering what’s the working method to hack atm. I will be explaining briefly on how an atm machine can be hacked but this is not for dummies. So at the end of this post you should decide whether to buy our blank atm cards or do the hack yourself.
    ATM hacking can be achieved using skimmers(atm keypad) which is mostly undetected. It is installed secretly on the atm and it will grab your card data once you slot in your card and enter your pin.
    Once the hacker has this data, your atm card can be cloned using a writer (MRS606) and some software.
    ATM HACKING- The blank atm card
    Blank atm cards with writer (mrs606)
    embossed atm cards
    If you want to do this on your own, it’s risky for a newbie. Think about the security camera on the atm and beside you haven’t done this before.
    OUR SERVICES
    We are a professional carding team with a large ring around the globe. With over 2 million ATM infected with our malware and skimmers, we can grab bank card data which include the track 1 and track 2 with the card pin. We in turn clone this cards using the grabbed data into real ATM cards which can be used to withdraw at the ATM or swipe at stores and POS. We sell this cards to all our customers and interested buyers worldwide, the card has a daily withdrawal limit of $2500 on ATM and up to $50,000 spending limit on in stores.
    Here is our price lists for the ATM CARDS :
    BALANCE: PRICE
    $10,000: $980
    $20,000: $1830
    $35,000: $2850
    $50,000: $4960
    $100,000: $9800
    The prices include the shipping fees and charges, order now: Contact us: atm.h@hackermail.com or atmhacking01@gmail.com
    FREQUENTLY ASKED QUESTIONS (FAQ)
    On the course of rendering this services, we have come across so many clients with different questions so this is aimed at answering few questions you might have:
    1: Are you selling money?
    No, we are not selling money. If you read our post correctly you will understand how this whole thing works.
    2: Is this service available for my country?
    Yes, our services are available worldwide
    3: How do i get my card after payments?
    We ship via DHL, standard shipping usually takes 7 days. All we need is your full name and address
    Order now, contact us with: atm.h@hackermail.com or atmhacking01@gmail.com

    ReplyDelete
  3. Do you need hackers for hire? Do you need to keep an eye on your spouse by gaining access to their emails? As a parent do you want to know what your kids do on a daily basis on social networks ( This includes facebook, twitter , instagram, whatsapp, WeChat and others to make sure they're not getting into trouble? Whatever it is, Ranging from Bank Jobs, Flipping cash, Criminal records, DMV, Taxes, Name it,he will get the job done.He's a professional hacker with 20 Years+ experience. Contact him at dragonhhacker@gmail.com ... Send an email and Its done. Its that easy, Daura referred you

    ReplyDelete
  4. Do you need hackers for hire? Do you need to keep an eye on your spouse by gaining access to their emails? As a parent do you want to know what your kids do on a daily basis on social networks ( This includes facebook, twitter , instagram, whatsapp, WeChat and others to make sure they're not getting into trouble? Whatever it is, Ranging from Bank Jobs, Flipping cash, Criminal records, DMV, Taxes, Name it,he will get the job done.He's a professional hacker with 20 Years+ experience. Contact him at dragonhhacker@gmail.com ... Send an email and Its done. Its that easy, Daura referred you

    ReplyDelete