Apollo Magnetic Card Reader

Apollo Magnetic Card reader with an RS232 Serial Interface

Hello World

Import programSerial_Bridge

Make a serial bridge from a serial I/O device on mbed to the PC


Import programSerial_Bridge

Make a serial bridge from a serial I/O device on mbed to the PC


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.

Recently, Sparkfun introduced a new version of the magnetic card reader. It replaced the older one, which got its power from the RS232 handshake lines. It 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.


mbedPololu RS232 adapter

PS/2 Connector

mbedcard reader PS/2 cable


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.

Serial Bridge for Card Reader

#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()) {


You need to log in to post a discussion