Turn your Arduino into a Magnetic Card Reader!

Picture of Turn your Arduino into a Magnetic Card Reader!
Everyone has used a magnetic card reader, I believe. I mean, who carries cash these days? They're not difficult to get your hands on, either, and during a trip to my favorite local electronics shop, I found a bin full of these guys. So....of course, I picked one up and brought it home to see what sort of stuff I could do with it and an AVR.

This instructable will show you how to connect a Magtek magnetic card reader to an AVR or Arduino/clone and read data from the first track of card. Buckle your seats; magnetic card readers have a high bit rate!
Remove these adsRemove these ads by Signing Up

Step 1: The Equipment List

Picture of The Equipment List
Here are a few things you'll need to get started.
  • Magnetic card reader (Mine is a Magetk 90mm dual-head reader. $5.00)
  • AVR, Arduino, or clone (ATmega328p ~ $4.30 from
  • solderless breadboard
  • some wire
  • maybe a header if you like that sorta thing.
  • something to read your serial port. I use AVR Terminal from

That's all you should need to get started. Depending on the magcard reader you end up getting, you may have to modify these instructions, and most assuredly the code, to work with your specific reader. However, the code I've written should get you pretty far, I hope.
1-40 of 83Next »
Awesome work on this. You explained all the steps in a way that takes something that is compli cated and kept it interresting all the way through. I didn't know much about what was on a stripe and now I have at least a basic idea . Thanks for the education!
nevdull (author)  Build_it_Bob4 years ago
Thanks for the kind words! I'm glad you were able to learn something from it and I appreciate your comments!


What is the format of the data you get off the card reader? I mean, do you the information about the former cardholder (name for example) or you get in another format?

Thank you in advance.

I am doing penetrating for ATM machines. I wonder if any one of you have experience creating smart card reader to encryption , or data between EPP readers and ATM PCs, smart card readers to read tr1, tr2 and tr3 data.

I am newbie in hardware hacking. kindly guide me

carlosd36 months ago

I'm building a vending machine using all the electronics arduino, the machine has a bill acceptor and coin acceptor my interest is to add a device to receive pto also with credit / debit card. I just do not know where to start can help me?

KellyCx11 year ago

Since the Arduino pictured above has a USB port, could I be able to use a USB card reader as opposed to a serial one?

eduke1 year ago

Where is the link to the code? I do not see it anywhere ...
gep301 year ago
how could i go about finding what type of format a student id at a college will fall under.
mic_mic_mic2 years ago
thanks for the prompt response. I hoping to get my head into a queuing system project and part of it involves simulating a bank ATM card reader to get user data and relay it to a server. I'm still looking around for the perfect magnetic reader. Price is a major factor due to budget constraints on school projects.

The data should essentially identify the unique ATM card/debit card holder on swapping.

Any tips on what i should focus on to get it up and running?

I tried replying but there seems to be a problem with where the captcha is
nevdull (author)  mic_mic_mic2 years ago
heya. I would focus on reading card format B on a single track. You could use an option like this one at ebay but you'd need an AVR that understood USB (ATmega32U4, AT90USB*, etc). There's another one at ebay ($9) using RS232 so you could interface it with the arduino's USART either through a DB9 or stripping the serial cable from the reader and running the pins directly into the arduino's headers.

Also, I re-edited page 3 and 4 (4 is still a little FUBAR with formatting) as I just found out that MAJOR important mag card format information wasn't being formatted and displayed. That should be fixed now and you should have more card format information and how to read it.

Good luck!

mic_mic_mic2 years ago
Very helpful. One question, are you sure it was 5$? I've scoured the net and cant seem to find it for that price. he cheapest i've seen is around 50$. Could you post a link where you got it for the friendly price?
nevdull (author)  mic_mic_mic2 years ago
Well I wish I could share the price with you out on the intertubes but I picked up a handful of these gems at my local electronic hobby shop. And sure enough, they were $5. However, I was back there just last weekend and noticed they still had a small box full of them but they were now priced at $10. But you're right, these devices do tend to be a little pricey. The USB type more so than the straight serial versions.

Good luck!
GJ W00T You certainly dont "fake the funk " brother
nevdull (author)  wherewillwhy2 years ago
Would faking the funk be committing a funkadelic felony?

Hope you enjoyed this or my other instructables! Thanks! Always glad to get your comments.

Krayzi992 years ago
Where the heck did you get $5.00 as the price? It's more like $5(0).00!
nevdull (author)  Krayzi992 years ago
I got my magnetic card reader from a local electronics shop where they were all in a bin for $5/ea. Where you find yours will obviously dictate the ultimate price of your project, but I have seen them on ebay from a few dollars and up (though you may pay more in shipping unless its free). I would try ebay first. You might get lucky with a good deal here and there on these items. Of course, if you're buying everything from scratch, including the arduino, it'll cost more, but this 'ible was targeted more toward current arduino/avr owners who just wanted to play around with a free/cheap mag card reader they could get their hands on.

Try your luck on ebay looking for a mag card reader in a price range that's workable for you. It could be there.

Good luck!
SpiralEdge4 years ago
I'm new to electronics and got lost at the part where the coding begins. How did you connect the card reader to the computer in order to read data from it?
nevdull (author)  SpiralEdge4 years ago
I connected the arduino through wires connecting the serial interface of the magnetic card.
pdrocb nevdull3 years ago
Hello! Thanks fo your post!

I have an Arduino... but normally you have a .pde extension in the .zip i dont see any. Can you please help me, how can I use your code into Arduino.

Thank you!

Another question did you use a Magtek MiniWedge Stripe with RS232 or usb or keyboard?
nevdull (author)  pdrocb3 years ago
This code isn't from the Arduino IDE nor does it compile into an arduino PDE file. This is normal code written in C that can run on a wide range of ATmega devices, including the Arduino. However, my guess is, you will require a programmer to download it into flash just like with the other atmegas. Sorry for any confusion there.

Re: your other question. My magcard uses a serial protocol that I describe in this instructable. It's pretty standard but doesn't use USB. I had the Arduiono redirect output to a windows terminal via RS232.

Good luck!
CoolKoon4 years ago
Could you by any chance get one with a similar price that could write these cards as well? :P I could really make use of one :P
Identity Theft anyone? Just kidding, ha ha ha.
Nah, I hate magnetic cards and would love to develop a way to introduce some false information on them (in a BOFH way) :D
nevdull (author)  CoolKoon4 years ago
Well I agree, in that it would be kinda geeky fun to have mag cards that were written with the info you wanted (and or encrypted) for testing on home egress, maybe a small sub-zoned area inside your house protected by mag card
hintss nevdull3 years ago
I like iButtons for that.
Yeah, but I'd need a writer for that as well. I suppose yours can't do that, can it?
nevdull (author)  CoolKoon4 years ago
No, my mag card device is a reader-only. Check ebay for some reader/writer combos, although for raw bang-for-your-buck, 125khz RFID reader/writers are only dollars (for the chip, you'd have to build the circuit). Tough decision to make if you're really settled on magnetic cards.
I'm not really settled on mag cards, but haven't seen RFID writers either. I could make use of one too :P
nevdull (author)  CoolKoon4 years ago
You'll find RFID writers on ebay again, and at, i believe.  But why buy one when you can build one with the Atmel U2270B RFID basestation in a chip for a coupla bucks.  Yum yum.

Thanks for the idea! I even managed to find such chip at a local supplier. I'll see whether I can make it into something useful ;)
nevdull (author)  CoolKoon4 years ago
awesome! Good going, let me know how it turns out!
awesome to hack my dad his new credit card!
jcouch12274 years ago
Anyone know what that red thing is called, a header? the thing in the second picture above. thanks
nevdull (author)  jcouch12274 years ago
It's a right-angle 7-pin male header, to be precise. :)
needtobuild5 years ago
Pretty sweet !
It would be cool to make a door lock for a house with this =)
nevdull (author)  needtobuild5 years ago
Haha yeah. I've had my mind on a magnetic card reader or an RFID reader for some ingress/egress control for a little while now. There are electronic mechanical door locks at Home Depot for ~ $120.00. Couldn't find them much cheaper online, either. But it'd be a great investment. :)
You could build a pretty solid electromagnetic door lock pretty easily, and those things hold like beasts
(removed by author or community request)
nevdull (author)  DELETED_dannydutton5 years ago
I have in my head a difference between electromagnetic door lock and an electronic mechanical door lock. I think (and tell me if I'm off base here), that TheSodaJerk is talking about an electromagnetic door lock (the locking mechanism is provided by bolting), and what you're talking about (a moving deadbolt-type-of-thing that is moved electronically). Either one would be pretty spiffy.
1-40 of 83Next »