Instructables

Turn your Arduino into a Magnetic Card Reader!

Featured
Picture of Turn your Arduino into a Magnetic Card Reader!
magcard-2.jpg
magcard-reader-top.jpg
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
magcard-ra-header.jpg
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 Mouser.com
  • solderless breadboard
  • some wire
  • maybe a header if you like that sorta thing.
  • something to read your serial port. I use AVR Terminal from BattleDroids.net

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 80Next »
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!
Build_it_Bob
nevdull (author)  Build_it_Bob3 years ago
Thanks for the kind words! I'm glad you were able to learn something from it and I appreciate your comments!
Cheers!
-gian
KellyCx16 months 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?

eduke6 months ago
Hi,

Where is the link to the code? I do not see it anywhere ...
gep309 months ago
how could i go about finding what type of format a student id at a college will fall under.
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_mic1 year 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!

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_mic1 year 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)  wherewillwhy1 year 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.

Cheers!
Gian
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!
SpiralEdge3 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)  SpiralEdge3 years ago
I connected the arduino through wires connecting the serial interface of the magnetic card.
pdrocb nevdull2 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)  pdrocb2 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!
CoolKoon3 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)  CoolKoon3 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)  CoolKoon3 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)  CoolKoon3 years ago
You'll find RFID writers on ebay again, and at futurlec.com, 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)  CoolKoon3 years ago
awesome! Good going, let me know how it turns out!
awesome to hack my dad his new credit card!
jcouch12273 years ago
Anyone know what that red thing is called, a header? the thing in the second picture above. thanks
nevdull (author)  jcouch12273 years ago
It's a right-angle 7-pin male header, to be precise. :)
Cheers!
-gian
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 electromagnets.no bolting), and what you're talking about (a moving deadbolt-type-of-thing that is moved electronically). Either one would be pretty spiffy.
nevdull (author)  WillTheRescue5 years ago
Haha nintendo! That's pretty cool :)
Electromagnets and magnetic cards are not an overall good paring.
So, there you are, all set to go inside your house, and your card is demagnetized. Or the power is out. (With a magnetic lock, your house could be unsecured.) Electro mechanical is the way to go, but it is still useless. All that security is for nothing if I can get in your window, go through your garage, pop the face off the lock plate and bypass your circuit, or in the case of a electromagnetic lock over power the magnet with another magnet. Mechanical locks are cheaper, last longer, and do not demagnetize. Further they do not tell thieves you have anything worth protecting.
1-40 of 80Next »