This is a project that developed more out of curiosity and a bit of mischief, but developed into a useful device. Let’s start with what a magnetic swipe card is used for. In the united states we use magstripe cards for student IDs, credit cards, drivers’ licences, pretty much anything that requires us to quickly and easily authenticate ourselves. I understand that the rest of the world has moved on to RFID, QR codes on phone screens, NFC, and all other sorts of authentication methods, but this is the united states, and we’re big. I don’t get how that means we’re perpetually behind the technology curve, but ok. I have heard arguments that “of course our internet is crappy and expensive compared to the netherlands and south korea, we had it first, it takes a lot of money to upgrade these systems”. Shouldn’t profit scale linearly with population? actually if you count start up cost, a larger population should amortize the start up cost to be lower per capita so the ISPs and banks in this country make even more per person than in smaller countries. I guess having one or two major companies doesn’t really breed steep competition (hi google, keep it up!). This card standard has been around a while, it uses three distinct stripes that can hold data in well defined ways as seen in the ISO standards mentioned here.
These cards communicate by having opposingly magnetized areas in the stripe that induce a current in an electromagnet when they change polarity. One way to simulate one of these cards is to simply create a chunk of magnetized card that has the same transitions, but the easier and more software definable way is to use an electromagnet to simulate these transitions. Now, having 3 distinct electromagnets makes it hard to simulate a multi track card as you have to feed different magnetic fields to each electromagnet. This would make simulating a drivers’ licence difficult because they use multiple tracks to store data. Now, if you only need to simulate one track then you can do what I did, which is to create a big honking electromagnet and spam all electromagnets simultaneously. This method is only useful for the least secure and cheapest of all magstripe cards. Guess which ones My school uses?
The seed idea for this came from people recording and playing back these signals from an ipod. This method looked cool, but I really wanted to be able to define the card ID on the fly. This brought me to the arduino card emulator, but that code was a bit off from what I needed it to do. After a friend re-worked the code we have this. The place with all the zeroes is where you put the card number as read by your friendly track 2 ps/2 keyboard pass through card reader. Oh,you don’t have one? check out this sourceforge project. This emulator only uses an h-bridge, an arduino, a coil of wire (I unwound a transformer for some), and a sheet of metal. The metal I chose is a small pile of sheets from the transformer glued/taped together. I used that metal because I knew it wouldn’t hold a magnetic field and would transmit the field change fairly well.
I suppose this is a fairly short post, mainly because it’s a fairly straightforward project. The arduino pro mini used in this version has a power LED, it dims as the h-bridge draws current from the batteries and browns them out. This unintended feature is nice to see it actually “swiping” the card.
The non-malicious use of this device involved the fact that my school gives us ID cards that deteriorate at a surprising rate and charges ~$10-$30 for a replacement, since they only use track 2, I use this.
UPDATE: I have been asked for specifics, I used a 5V arduino pro mini and fed the ~6v directly into the VCC pin of the pro mini. Taking a look at the schematic on sparkfun you can see that the RAW pin is the input for raw voltage to be regulated down to you VCC voltage, I’m running a bit higher than the arduino is spec’d for, but with some old alkaline batteries you usually don’t get over 5.5v (which is the top end of the spec for the 328). I assume you can use the 3.3v one, although I haven’t tested the code to make sure the timings still work right. If you are in doubt you should check the integrity of your emulated card by making sure it shows up properly in the same ps/2 pass through reader you used to get the number in the first place. I? have no specifics on the coil size, but I think I used about a meter or two of wire (I could be wrong). If you really want to be specific you can measure the resistance of the coil and the supply voltage and use V=IR to check your current draw and decide whether or not it’s too much for your batteries.
BOM (bill of materials):
arduino pro min (5v 16mhz knockoff from ebay)
L293D (or SN754410)
magnet wire (salvaged from a transformer)
sheet(s) of metal (salvaged from a transformer)
I would refer you to the datasheet of the H-bridge for further information, but if you still don’t understand after reading that I can probably help.