|
Project Information
Members
Featured
Downloads
|
What is it?Mag Stripe is an Arduino library to interface with TTL (raw) magnetic card readers. It supports reading any of the cards' possible three tracks, but not simultaneously. Most cards only contain data on tracks 1 and 2 though.
Card ReadersThere are many brands of TTL magnetic card readers on the market, some with a fixed reading head and others with screws allowing the head to be manually positioned to choose one of the tracks. The connector comes with varying colors for each wire, but usually there are five wires with the following order and function:
For more information, you can check the KDE KDR-1000 datasheet (pictured above), which can read all three tracks by repositioning the head, or the Panasonic ZU-M1121 datasheet for an example of another reader which can only read track 2 and has a different pin arrangement. InstallationUncompress the ".zip" file into your "<arduino sketch folder>/libraries" folder (you may need to create it first). After restarting the Arduino IDE, it should appear in the libraries and examples menus. How it WorksConnect your card reader to the following digital pins of the arduino:
If your reader can read multiple tracks at a time, and thus has extra sets of data and clock wires, check its datasheet and use the ones appropriate for the track you want to read. The library has a thin interface and is very straightforward to use, just check if there is a card present before trying to read. The included MagStripeReader.ino example shows how to do it. The read() method does the necessary validation checks and only returns data if it has been read correctly from the card. The data returned is a string with the (ASCII) full contents of the track, including the control characters. To know about the format of data returned for each track, check the magnetic card standards reference. Downloads
|