Step 1: Parts

Spool of enamel-covered solid-conductor copper wire (you can get this in a set at Radio Shack)

Electrical Tape

Arduino

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.

Yeah, that was part of the inspiration for this one. I wasn't able to get mine to work exactly the way he has it. If I understand right from the schematic he's got one lead from the electromagnet connected directly to ground and is powering the other one. I tried that and my reader never picked it up. I modified it so each lead of the electromagnet is connected to a different digital pin on the Arduino so I could change the polarity on the electromagnet and it worked for me.

purduecer, that's an interesting project as well, and one that apparently inspired the one that was linked to above (from hackaday). I haven't really looked at the MP3 player spoofer, looks interesting though. I don't have a problem citing that project, even though, again I haven't really looked at it much since I was specifically looking at using an Arduino.

You want to be REALLY careful driving an electromagnet directly from data pins. They aren't designed to handle the current, or the collapsing current kick back after the magnet shuts off. You can quickly be out a few pins with a setup like this.