ID12 RFID Reader

An RFID reader module that reads tags and sends the ID as a 9600-8N1 serial stream

Hello World

Import programID12RFID_HelloWorld

Hello World for the ID12 RFID reader library

Library

Import libraryID12RFID

ID12 RFID library for reading 125KHz RFID tags

Pinout

Datasheet

http://www.sparkfun.com/datasheets/Sensors/ID-12-Datasheet.pdf

Notes

The example code does not take into consideration HEX values, in the result, with this snippit, it is delt with

int ID12RFID::readable() {
}

int ID12RFID::read() {
    while (_rfid.getc() != 2);

    int v = 0;
    _rfid.getc(); // drop 1st 2 bytes - we actually only read the lower 32-bits of the code
    _rfid.getc();

    for (int i=7; i>=0; i--) {
        char c = _rfid.getc(); // a ascii hex char
        int part = c - '0';

    // test if 'Alpha'

    if (part > 9) part -= 7;     // was 6
        v |= part << (i * 4);
    }
    
    for (int i=0; i<5; i++) {
        _rfid.getc();
    }
    
    return v;
}

Breadboard Circuit

ID12 RFID Hello World breadboard

Library

The mbed library for the ID12 RFID reader, returning the 32-bits of the ID as an int

Import library

Public Member Functions

ID12RFID (PinName rx)
Create an ID12 RFID interface, connected to the specified Serial rx port.
int readable ()
Non blocking function to determine if an ID has been received.
int read ()
A blocking function that will return a tag ID when available.

You need to log in to post a discussion