HandySwipe portable magnetic card reader

type 2 reader

The HandySwipe provides a portable magnetic card reader interface and display. It collects card data from a “Type 2″ card reader (shown here), and displays the data on a small character LCD screen. Type 2 stripes are by far the most common in use, such as on credit cards and drivers’ licenses. The device can store up to 50 cards, runs on four AA’s, and has a serial connection to download its memory to your computer in CSV format. It can also download data in a raw bistream format compatable with StripeSnoop, so you can take advantage of StripeSnoop’s powerful parsing and analysis features (LRC error checking, backwards swipes, card type/contents/issuers/etc.)

Update (6/6/06): Note, I put this page together to share my beginner electronics experience with the public. I DON’T and am NOT going to sell this as a product. Sorry. If you want to buy a portable reader, check out Mag-Stripe.com. – n.

Update (12/09): The C code (for CSS compiler) is here. – n.


compl
I had two real goals in making this project:
  • Play with the MagTek reader
  • Try out an efficient LCD interface for use with a PIC microprocessor
  • I got my reader for less than five bucks from All Electronics. All the parts combined are under $20.

    Here’s a shot of the completed project:

    Software

    mcpusb programmer For programming, I use the MCP-USB from Olimex. I got it from SparkFun, and I highly recommend their getting started document. It’s fully compatible with MPLAB, and I’ve never had problems with it. I cut a hole so I could just leave my programmer right in the its original box. Here it is with the 16F688 chip I used for this project.I’m using a MagTek brand TTL card reader, which has a pretty generic serial interface. The actual bits are sent using a typical data/clock pair, and there’s a “card present” line to let you know when to start paying attention.
    This diagram from the data sheet shows all three interface lines in action: card reader datashet
    One things to be aware of are that signals are all inverted (ie: card present goes LOW when you stick in a card… same for data and clock). Another trick is that all the data characters are made up of five (5) bits (as opposed to the 8 we’re used to). Use the data sheet to decode the 5-bit bytes to meaningful numbers.I use a LogicPort Logic Analyzer in most of my projects and I just love it. It gives you wonderful insight into how digital circuits behave and is worth every penny! Click for a picture of how the board looks connected to the LogicPort.
    Here’s part of what the LogicPort saw when I ran a card through the MagTek reader. The top line represents the probe connected to the Card Present pin, the middle is the Strobe (or clock) from the reader, and the bottom line is from the reader’s data pin. Sorry I didn’t get these in the same order as in the data sheet above:logicport
    I used a shift register to reduce the number of pins that were required to run the LCD display. Typically, a minimum of six pins are required. By shifting data into the shift register, you’re able to get away with only using three pins. The LCD doesn’t draw out characters quite as fast, but I’m not trying to play video games on it. If you want to know more about this, read Myke Predko’s excellent page which has great diagrams and info. He even has a plan for interfacing using only two pins. In practice, it’s probably more efficient (and definitely less soldering, software, and components!) to just buy a microprocessor with enough IO to drive the LCD directly. Still, it was an interesting exercise.
    Here’s what the menus look like as you scroll through them. You “click” the single pushbutton to go to the next menu item… you hold the pushbutton for 2 seconds to select a menu item.
    menu shots

    I use the CCS C compiler, so I can write all my code in C. I’m going to clean up the code before I post it, but if anyone’s anxious to see it please let me know. Since I didn’t draw a circuit diagram for this project I don’t think the compiled HEX file would be very useful.

    Hardware

    Short of a circuit diagram, here’s photos of the front and back of the board:

    board front
    board back
    On the back, most of the red wires are power-related, most of the blue ones are signals to/from the PIC, and the white wires are signals from the shift register to the LCD.
    Here’s a picture that labels each of the components on the front:
    labeled components
    pinout
    Here’s the pinout of the Type 2 card reader. This was taken from the MagTek data sheet.

    Results

    HS in hand Here is the “finished product” in use:

    26 thoughts on “HandySwipe portable magnetic card reader

    1. I am very interested in the card reader. I have studied this in the passing at college, and though I got the hardware interface set up, i cannot seem to get the C code to work. I am very interested in seeing your C code if you do not mind. But I have exams in a week or so and so would like to be able to finish this before.

      thanx,
      James

    2. This project looks very interesting, i would like to have more information about it.
      I am thinking to design a project like this for a library.
      Could be possible to get more detais,i use low level programming with mplab.
      many thanks

    3. Hello, it is a very interesting project and I would like to try it .
      where is possible to download the files for to realize this project ?

    4. hello,this project looks very interesting, i would like to have more information about it.
      is it possible to have further details for the building?

    5. it is a very ingenios project , and you are able to see all the data on the card ? even the pin code? can i buy one for me and my family ? i hope you will answer me , thanks you very much.

    6. I’ve found these cheap card readers really hard to come by. All Electronics doesnt seem to stock them anymore.

      Good job though, quite like to have a go at making one, time to relight my interest in electronics.

    7. Very nice! I was just thinking about this, my friend I have some ideas to improve your project, but this is close to what I was thinking. I would be very interested in talking to you and exchanging ideas, maybe even taking a peek at your code if you would allow it. Drop me an email, you can add me to your messenger if you got it.

    8. This projects seems to be really nice, where can i get the magazine to start to work on it.
      I would like to have a look at the program…would be possible??

    9. This device is not for stealing PIN numbers and credit card numbers. It’s for reading the data on any kind of swipable. For example, I’d really like to know what data is kept on my driver’s license, or my student ID. It’s a damned hobby, not a way for you to steal other people’s money (ADRIAN, this means you).

      Ned, good job. Looks cool. Makes me wish I knew electronics that good.

    10. I love how everyone words it like “I would love to have one of these so I can use it lawfully and not do anything bad…my family yes…family”

      Whereas I: “If I had one I would steal so much money.”
      But I dont’ care enough.. oh well.

    11. Hello Ned.
      Tell me why do you never ask
      to any of the asking that appears here.
      I ask you some time ago abouth the plans or the C software of this project but
      you never ask me.Why?
      You just posted this for demonstrate that you are good?

    12. Can you publish your components/schematics, etc.?

      I sure you have an interested audience.

    Comments are closed.