Apollo Magnetic Card Reader

Apollo Magnetic Card reader with an RS232 Serial Interface

The low cost Apollo Magnetic Card reader will read up to three tracks of data from just about any magnetic card or credit card. It is available in the serial output option from Sparkfun It outputs the data at 9600 baud on an RS232 serial port. Swiping a card will send out the card's data on the serial output.

It draws its internal power off of the serial port's handshake lines (i.e., RTS(DB9 pin7) or DTR(DB9 pin4) ). So these lines need around 5V to power the reader. When it is powered up, the reader's LED is green. On a PC serial port, the handshake lines supply the power needed for the reader. On a microprocessor serial port that does not support handshaking, getting power to the device it the most difficult part of using it. The easiest way to hook it up to mbed is to use an RS232 breakout board that supports the handshake lines such as the one below from Pololu. It drives the handshake lines that power the reader.

The Pololu Serial Adapter Supports Handshake Lines

Recently, Sparkfun introduced a new version of the magnetic card reader that is shown below. It replaced the older one shown above. This one costs a bit more, but it now has a PS/2 connector that is used to provide power instead of taking it from the RS232 handshake lines. The PS/2 cable is only used for 5V power and gnd (do not connect other PS/2 pins), so a PS/2 breakout board will make it a bit easier to connect on a breadboard. If you order the breakout board, don't forget to get the PS/2 socket to solder on the breakout board.

New version of Sparkfun's magnetic card reader with PS/2 power cable.

A PS/2 Breakout board makes it easier to hookup the new version.


mbedPololu RS232 adapter

And to power the new PS/2 version only:

mbedcard reader PS/2 cable

You could also use a RS-232 adapter without handshaking support such as the module below from Sparkfun. If you need to add wires for the handshake connections needed to power the older magnetic card reader, soldering would likely be required since these connections do not come out on header pins on the Sparkfun module. An RS232 voltage conversion circuit could also be built on a breadboard (this circuit is already in the two RS232 adapter breakouts along with the DB9 connector).

The Sparkfun Serial Adapter has LEDs, but no handshake lines


mbedSparkfun RS232 SMD adapter

In addition, a null modem and a M/M gender changer adapter (or cables) are also needed. The mini DB9 null modem and gender changer adapters as seen below are a handy way to hook it up so that everything just plugs together. A single M/M DB9 null modem mini adapter could be used to minimize all of the connector clutter, if you can find one.

mini DB9 null modem adapter

Breadboard setup for magnetic card reader


To try it out, just run the standard serial bridge code on mbed, run a terminal application on the PC attached to mbed's virtual com port running at 9600 baud (just like for printf). You should see the card data stream out whenever a card is swiped in the reader. A red LED means a bad read. A green flash on the LED means it read the card and sent out the data.


#include "mbed.h"

Serial pc(USBTX, USBRX); // tx, rx
Serial device(p13, p14);  // tx, rx

int main() {
    while(1) {
        if(pc.readable()) {
        if(device.readable()) {


Swiping a magnetic card to display the data. The data shown here has fake numbers.

The output format for credit cards is % "ASCII string on track 1" ?; "ACSII string on track 2" ?; "ASCII string on track 3" ? . Some ID cards only have 1 or 2 tracks. Wikipedia has some basic information on card number formats under Bank Card Number

Sparkfun PC-based demo of magnetic card reader

Please log in to post comments.