BLE Shield Project: RFID Tag Reader

After creating the BLE Shield for Arduino it is time to create some projects with it to show you what can be done using the shield. Maybe you remember that I created an RFID Tag Reader for the iPhone acting as Bluetooth keyboard in order to send the UID of an RFID Tag to the iPhone: http://www.mkroll.mobi/?page_id=202.

Now it is time to create a simple RFID Tag Reader using the BLE Shield. In order to stack such a device together, I grabbed the following out of my “Arduino Box”:

  • 1 x Arduino Pro Mini 3.3V
  • 1 x Adafruit PN532 NFC/RFID Controller Shield for Arduino
  • 1 x Seeddstudio Solar Charger Shield v0.9b
  • 1 x BLE Shield 0.9.2
BLERFID1
and stacked together this fancy device:
BLERFID2

In this setup I ‘m using hardware serial to send data to the BLE Shield, so the switch needs to be set to the Tx0/Rx1 position. I programmed the Arduino Pro mini with the following sketch, where the 16 byte buffer is filled with padding zeros and then with the UID of the tag.

#include
#include 

#define IRQ   (2)
#define RESET (3)  // Not connected by default on the NFC Shield

Adafruit_NFCShield_I2C nfc(IRQ, RESET);

void setup(void) {
  Serial.begin(19200);

  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (!versiondata) {
    while (1); // halt
  }

  // configure board to read RFID tags
  nfc.SAMConfig();
}

void loop(void) {
  boolean success;
  // Buffer to store the returned UID
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
  // Buffer for writing the padding
  uint8_t pad[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
  uint8_t uidLength;
  uint8_t bleBufferLength = 16;
  uint8_t paddingSize = 0;

  // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);

  if (success) {
    paddingSize = bleBufferLength - uidLength * 2;
    // add padding depending of the size of the TAG UID
    for (uint8_t i=0; i < paddingSize; i++)  {
      Serial.print(pad[i], HEX);
    }

    // write the UID of the tag.
    for (uint8_t i=0; i < uidLength; i++)  {
      Serial.print(uid[i], HEX);
    }

    // Wait 1 second before continuing
    delay(1000);
  }
}

You can use BLExplr to test the reader. Just connect to the BLE Shield, enable notify on the RX characteristic and place an RFID Tagreader near the antenna.

BLERFID3 BLERFID4

The following video shows this connection and tagging procedure:

BLE Shield RFID Tag Reader from Michael Kroll on Vimeo.

11 Responses to BLE Shield Project: RFID Tag Reader

  1. Bart McIntyre July 11, 2012 at 04:54 #

    Beautiful! I love your work. I will be one of the first to purchase your BLE Shield when it is available. I am currently testing various devices and I am in need of a BT4.0 solution for the iPhone 4S and the new iPad. This will make my task a bit more enjoyable. Please let me know if I may purchase one sooner. I will gladly make a donation via PayPal, and I will purchase your BLExplr app.

  2. KITTA Yoshimune July 12, 2012 at 18:29 #

    Nice work!
    I want use BT4.0 on Arduino.
    It’s great solution!

  3. jacob July 16, 2012 at 20:57 #

    Dear,
    can i order/buy the BLE shield for shipment to Belgium?
    Thanks,
    Jacob

    • Michael Kroll July 17, 2012 at 16:00 #

      Hi Jakob,
      not yet. The beta is processing. After a few weeks and hopefully only positive feedback I’ll start a first v1.0 production run.

      Cheers,
      Michael.

  4. wintifrosch July 23, 2012 at 15:51 #

    Great. Any ambitions to RaspberryPi? We’d like to sponser a port to RasPi.

    • Michael Kroll July 24, 2012 at 09:44 #

      Hi,
      I don’t have time to port it to Raspberry PI, but if there is a 3.3V TTL level Serial Port it can be durectly attached. I don’t have a Raspberry for testing. There could be another Board Design for the Raspberry.

      Cheers,
      Michael.

  5. Michele September 30, 2012 at 12:45 #

    Hi Michael,

    I would like to order…

    Thank you!

  6. dominik October 6, 2012 at 07:05 #

    Hey michael,
    i would like to purchase 3 of the modules. Is that possible? i would need them from the 22.10.2012 on for a beta test of an exhibition.

    Merci,
    dOmNik

    • Michael Kroll October 6, 2012 at 09:23 #

      Hi Dominik,
      sorry but the RFID Reader is currently not for sale. I’ll work on a BLE version sometime, but I don’t have a roadmap for that yet.

      Cheers,
      Michael.

  7. Tony Wang November 1, 2012 at 04:10 #

    Hi Michael,

    This is a really nice project. BTW, are you going to share the BLE shield PCB design files?

    Thanks,
    Tony

Leave a Reply


*