Step 1: Parts
Thin piece of ferrous metal (about 1" x 4")
Spool of enamel-covered solid-conductor copper wire (you can get this in a set at Radio Shack)
Step 2: Putting It Together
1. Get your metal shim and wrap about 2/3 of it in electrical tape. This prevents the sharp edges from cutting through the enamel on the wire you're going to wrap the shaft in.
2. Wrap the metal shim in wire. Just wrap and wrap. When I wrapped the wire I used an Ohm meter on the buzzing setting (not sure what the real name of it is, it's the setting where it buzzes when resistance is low between the leads). I connect one end to the metal shaft and the other end to one of the ends of the wire I'm winding. This way I make sure the metal shaft never cuts through the wire and connects to the metal shaft. If it does then I unwind the part I just wound and wind it differently.
3. Connect the ends of the wire to the Arduino
4. Push the sketch and your done.
Step 3: The Sketch
I've attached the code. Magstripes use Biphase Mark Code to encode the data. Here is more information on how this works http://en.wikipedia.org/wiki/Biphase_mark_code.
Step 4: Attribution
A couple of other similar projects:
this project helped inspire mine:
this is another similar project: