Turn your Arduino into a Magnetic Card Reader!

 by nevdull
Featured
magcard-reader1.jpg
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

magcard-parts.jpg
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 77Next »
Build_it_Bob says: Nov 14, 2010. 7:05 AM
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) in reply to Build_it_BobNov 14, 2010. 2:45 PM
Thanks for the kind words! I'm glad you were able to learn something from it and I appreciate your comments!
Cheers!
-gian
mic_mic_mic says: Dec 14, 2012. 12:01 PM
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) in reply to mic_mic_micDec 14, 2012. 2:47 PM
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_mic says: Dec 14, 2012. 9:50 AM
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) in reply to mic_mic_micDec 14, 2012. 10:32 AM
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!
wherewillwhy says: Sep 18, 2012. 12:08 PM
GJ W00T You certainly dont "fake the funk " brother
nevdull (author) in reply to wherewillwhySep 28, 2012. 7:28 AM
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
Krayzi99 says: Jun 10, 2012. 11:58 AM
Where the heck did you get $5.00 as the price? It's more like $5(0).00!
nevdull (author) in reply to Krayzi99Jun 10, 2012. 11:43 PM
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!
SpiralEdge says: Oct 3, 2010. 4:34 PM
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) in reply to SpiralEdgeOct 4, 2010. 10:28 PM
I connected the arduino through wires connecting the serial interface of the magnetic card.
pdrocb in reply to nevdullFeb 14, 2012. 4:07 PM
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) in reply to pdrocbFeb 15, 2012. 2:15 PM
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!
CoolKoon says: Oct 1, 2010. 2:22 AM
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
Spaceman Spiff in reply to CoolKoonOct 2, 2010. 2:03 PM
Identity Theft anyone? Just kidding, ha ha ha.
CoolKoon in reply to Spaceman SpiffOct 2, 2010. 2:56 PM
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) in reply to CoolKoonOct 4, 2010. 10:32 PM
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 in reply to nevdullApr 10, 2011. 6:52 PM
I like iButtons for that.
CoolKoon in reply to nevdullOct 5, 2010. 4:41 AM
Yeah, but I'd need a writer for that as well. I suppose yours can't do that, can it?
nevdull (author) in reply to CoolKoonOct 5, 2010. 5:29 AM
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.
CoolKoon in reply to nevdullOct 5, 2010. 6:08 AM
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) in reply to CoolKoonOct 5, 2010. 6:40 AM
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.


CoolKoon in reply to nevdullOct 9, 2010. 9:22 AM
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) in reply to CoolKoonOct 11, 2010. 7:50 PM
awesome! Good going, let me know how it turns out!
ducktape3618 says: Feb 26, 2011. 3:58 AM
awesome to hack my dad his new credit card!
jcouch1227 says: Jan 12, 2011. 12:02 PM
Anyone know what that red thing is called, a header? the thing in the second picture above. thanks
nevdull (author) in reply to jcouch1227Jan 13, 2011. 10:53 PM
It's a right-angle 7-pin male header, to be precise. :)
Cheers!
-gian
akrolik says: Dec 5, 2010. 5:38 PM
Is there a link as to where a $5.00 card reader can be purchased?
nevdull (author) in reply to akrolikDec 6, 2010. 9:31 PM
I got mine from a local electronic shop here for $5 each. I don't know if they have an online store, but their website is:

http://jbsaundersco.com/

Good luck!
bonez13 says: Oct 24, 2010. 3:05 PM
Sweet, being looking for project like this...
nevdull (author) says: Sep 23, 2010. 6:52 AM
Flash Animation
limerick says: Sep 23, 2010. 1:25 AM
must say though that in general, rfid is more secure in a sense, than keypad codes as with a card, you have to have a physical credential versus a keypad code which an be obtained in several ways from 'shoulder surfing' to someone
telling another, to some dufus writing it down and misplacing it and it falls into the wrong hands.
needtobuild says: Aug 19, 2009. 3:17 PM
Pretty sweet !
It would be cool to make a door lock for a house with this =)
nevdull (author) in reply to needtobuildAug 19, 2009. 7:30 PM
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. :)
TheSodaJerk in reply to nevdullAug 20, 2009. 11:43 AM
You could build a pretty solid electromagnetic door lock pretty easily, and those things hold like beasts
limerick in reply to TheSodaJerkSep 23, 2010. 1:10 AM
@TheSodaJerk:

the maglocks are they are called in the locksmith/access control business
come in a number of holding force pound ratings. 300, 600, 1200, 1500 & 3000
# ratings. And they are NOT positive latching, meaning that they have to have CONSTANT power to hold. If power fails, you need sufficient battery backup amp hour capacity. hope that info helps.
nevdull (author) in reply to TheSodaJerkAug 20, 2009. 6:12 PM
That would be awesome. What sort of power requirements would you need for that? I remember looking at electromagnetic locks a looong time ago and they had two versions: one for indoor doors and one for outdoor doors, and I thought I remembered the outdoor ones had a special power requirement to hold that many footpounds (if that was the measurement, it should be newtons) of force.
DELETED_dannydutton in reply to TheSodaJerkAug 20, 2009. 11:58 AM
(removed by author or community request)
limerick in reply to DELETED_dannyduttonSep 23, 2010. 1:13 AM
@dannydutton - yes, it could be done. truly in a hacker spirit. you'd need to fabricate a contraption to rotate on a limited basis - a flat tailpiece to drive the bolt, and use the solenoid to drive said contraption. then of course there is your
control system. certainly doable! :)
1-40 of 77Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!