Magstripe Reader #1

This year, we wanted to do it much faster, so that people didn't have to stand around for 3 minutes. So I got a magstripe reader! The model I tried first was the MAGTEK Centurion Keyboard Encoder (PN-21073062).

The nice thing about this reader is that it's small, lightweight, very reliable, reads all three tracks, and basically acts like a standard USB keyboard. Other readers can have HID or other drivers that are less trivial to use. With this reader, simply plug it in, start up a text editor and swipe:

The output is the error-corrected data right off the card, all three tracks, with the assumption that it's a proper credit card in the standard layout.

The data output is as follows, split up by track.

  1. %^^?
  2. ;=?
  3. nothing
  4. Track one is almost exclusively used for credit card data. Track 2 is used for pretty much anything including older ATM cards, other IDs, laundry, etc. Track 3 data tends to be used by driver licenses. Since I don't have such a license I can't demonstrate track 3.

    Anyways, this is all very good and interesting, and I can get all the data I want this way. But what we really wanted was something to actually parse out the name, expiration and PAN (card number) from the data. There didn't seem to be any products that did this for us, so I built one instead!

    Raw magstripe reader #2

    What I wanted was to get that raw data before it got spit out the USB port. I opened up the Magtek and found that the whole thing is not easily hackable.

So instead I purchased a raw magstripe head from Mouser, remember that the data I want is on track 1 so I got the only head they had with track 1 reading, the Omron V3A-6 (Datasheet here). It can also read track 2.

It's a lot more hackable, with just the magnetic flux decoders (the chips) and all the data pins brought out and documented in the datasheet.
Pins 1 and 2 are obvious: power suppy. Pin 3 I didn't actually understand but perhaps it's a sleep mode. Pin 4 is a digital output that goes LOW when a card is being swiped (CARD PRESENT). Then the data is clocked in via pins 5 (STROBE) and 6 (DATA):

All this great timing data is from a handy app note by magtek (which I strongly recommend to any magstripe enthusiasts!). The data is sampled on the falling edge and is in LSB order - somewhat opposite most SPI implementations.

The data isn't in any 'standard' ASCII representation, it's actually 6 bits per byte with a parity bit to make it 7 bits long. Each byte should be checked for parity and then can be convereted to ASCII by adding 0x20 hex. There is some fun detail in said app note about how to calculate parity bits or you can just read the code. Again, this is only for track 1, track 2 is slightly different.

This guide was first published on Apr 21, 2013. It was last updated on Apr 21, 2013.

This page (Parts) was last updated on Apr 15, 2013.

Text editor powered by tinymce.