Arduino Magstripe Emulator




This is a simple magnetic stripe emulator.  Basically you can stick this into a magnetic card reader and emulate any stripe data you'd like.

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)

Electrical Tape


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

Step 4: Attribution

A couple of other similar projects:

this project helped inspire mine:

this is another similar project:



    • Fandom Contest

      Fandom Contest
    • IoT Challenge

      IoT Challenge
    • Party Challenge

      Party Challenge

    15 Discussions


    5 years ago on Introduction

    question. Were do I put the the car ID code into. There are no comments telling you were to put the card data???


    8 years ago on Step 3

    Your code download link is messed up, it downloads as "FGD08X4GCJ0ZRF1.tmp", which I can rename to spoofMagstripe.pde but it was a bit confusing at first.


    8 years ago on Introduction

    Works perfectly!!
    Anybody knows how to emulate the card's first track.
    I read theory about and I don't know what seems to be the problem.
    The second track works just fine, but first one is not.

    I change start sentinel, I encode symbols in 7-bit instead of 5-bit for 2nd track, I add LRC byte at the end. I even tried to play much with the delay time between bytes - nothing works.

    Any ideas? Anybody did it?
    Any help wanted..
    Best wishes!


    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.


    Reply 8 years ago on Introduction

    If it was indeed "part of the inspiration for this one", please cite the original post in your writeup. Failure to do so violates the attribution clause in the NCSA license on the original material.


    Reply 8 years ago on Introduction

    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.

    Thanks for the tip, will this still work if you're switching polarity on the electromagnet? That's why I was thinking an H-bridge might be the way to go.


    Reply 8 years ago on Introduction

    Thanks, I knew it was testing for continuity, should have made the leap to continuity tester ;-)


    8 years ago on Introduction

    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.

    1 reply

    Reply 8 years ago on Introduction

    Good to know, I'll look at modifying the setup (maybe by building an h-bridge). I've actually been running like this for 3 or 4 months and haven't had a problem so far though.