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!

Step 1: 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 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.
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! <br>Build_it_Bob
Thanks for the kind words! I'm glad you were able to learn something from it and I appreciate your comments!<br>Cheers!<br>-gian
<p>So how does the AVR terminal work? You said &quot;The display goes to a terminal program I wrote specifically for connecting to an AVR via RS232 or USB.&quot; Can you elaborate on that please?</p>
Hi EricP58,<br><br>The AVR terminal acts simply as a dumb terminal, with some added control codes for for transparently manipulating the AVR from the PC. It also has no special telnet control sequences that would interfere with a serial port connection and has ANSI support. It easily allowed converting values between hex, binary, and decimal, as well.<br><br>The hardware part is either through a MAX232 to a DB9 serial port using RS232 signaling protocol or through USB via an FTDI USB-to-RS232 IC. There are several new dumb serial terminals available now, so any of those would also be a good choice.<br>
<p>Hi,</p><p>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?</p><p>Thank you in advance.</p>
<p>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.</p><p>I am newbie in hardware hacking. kindly guide me</p>
<p>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?</p>
<p>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?</p>
Hi,<br><br>Where is the link to the code? I do not see it anywhere ...<br>
how could i go about finding what type of format a student id at a college will fall under.
Awesome! I'd love to have one of these <a href="http://www.nationaltransaction.com/Machines_Virtual_Merchant.php" rel="nofollow">credit card readers for laptop</a>. Can't wait to work on it!
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. <br> <br>The data should essentially identify the unique ATM card/debit card holder on swapping. <br> <br>Any tips on what i should focus on to get it up and running? <br> <br>I tried replying but there seems to be a problem with where the captcha is
heya. I would focus on reading card format B on a single track. You could use an option like<a href="http://www.ebay.com/itm/Mini-USB-Triple-Track-POS-Magnetic-Stripe-Swiper-Credit-Card-Reader-/261141628407?pt=LH_DefaultDomain_0&hash=item3ccd4105f7" rel="nofollow"> this one at ebay</a> but you'd need an AVR that understood USB (ATmega32U4, AT90USB*, etc). There's <a href="http://www.ebay.com/itm/POSH-SCMR33-RS-OP-SMART-CARD-MAGNETIC-READER-/330842426857?pt=LH_DefaultDomain_0&hash=item4d07becde9" rel="nofollow">another one at ebay</a> ($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.<br> <br> 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.<br> <br> Good luck!<br> <br>
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?
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.<br><br>Good luck!
GJ W00T You certainly dont &quot;fake the funk &quot; brother
Would faking the funk be committing a funkadelic felony? <br> <br>Hope you enjoyed this or my other instructables! Thanks! Always glad to get your comments. <br> <br>Cheers! <br>Gian
Where the heck did you get $5.00 as the price? It's more like $5(0).00!
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. <br> <br>Try your luck on ebay looking for a mag card reader in a price range that's workable for you. It could be there. <br> <br>Good luck!
Your link to Mouser for $4.30 is for a chip only, you'll need an assembled board. That same link on Mouser has the Arduino Uno for $25, or you can get it on Amazon for $16.99: <a href="http://amzn.to/ItkkQT" rel="nofollow">http://amzn.to/ItkkQT</a>
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?
I connected the arduino through wires connecting the serial interface of the magnetic card.
Hello! Thanks fo your post!<br><br>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.<br><br>Thank you!<br><br>Another question did you use a Magtek MiniWedge Stripe with RS232 or usb or keyboard?
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.<br><br>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.<br><br>Good luck!
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
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
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?
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
You'll find RFID writers on ebay again, and at futurlec.com, i believe.&nbsp; But why buy one when you can build one with the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc4684.pdf">Atmel U2270B</a> RFID basestation in a chip for a coupla bucks.&nbsp; Yum yum.<br> <br> <br>
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 ;)
awesome! Good going, let me know how it turns out!<br>
awesome to hack my dad his new credit card!
Anyone know what that red thing is called, a header? the thing in the second picture above. thanks
It's a right-angle 7-pin male header, to be precise. :)<br>Cheers!<br>-gian
Is there a link as to where a $5.00 card reader can be purchased?
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:<br><br>http://jbsaundersco.com/<br><br>Good luck!
Sweet, being looking for project like this...
<div class="media_embed"> <div class="media_embed"> <img alt="Flash Animation" src="../../static/js/ckeditor/images/spacer.gif?t=A39E" style="width: 640.0px;height: 385.0px;"></div> </div>
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<br>telling another, to some dufus writing it down and misplacing it and it falls into the wrong hands.
Pretty sweet !<br/>It would be cool to make a door lock for a house with this =)<br/>
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
@TheSodaJerk:<br><br>the maglocks are they are called in the locksmith/access control business<br>come in a number of holding force pound ratings. 300, 600, 1200, 1500 &amp; 3000<br># 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.
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.
You can get after market replacement motors/mechanisms for car door locks for about $5.00. They were selling them here at a local auto shop. All the mechanical stuff was there for a car door, but the devices are very small. The nice thing about them is they only consume power when activated. They either push or pull the mechanism and then stop. Only a second is needed for the mechanism to move an inch or so, so battery operation would last a long time.
I got an auto car lock solenoid arm for about that much from ebay. The range of motion is small (ie it twists) but can be converted via an arm or other such thing, which the ebay package comes with, as well. I agree with and like your suggestion; the car door lock x 2 is exactly what I had planned for a door lock.<br><br>thanks!

About This Instructable


354 favorites


Bio: Gian is a computational biologist and is the Managing Director at Open Design Strategies, LLC. He holds a BA in Molecular/Cellular Biology and an ... More »
More by nevdull: Create A Custom Medieval-/Fantasy-Style Calligraphy Quill Practical DACs Using Enumerated Types as Bitflags
Add instructable to: