Categories
TUTORIALS

Use RFID Sensor to Detect RFID Tags Categorized into Unique Responses

INTRODUCTION

This tutorial will allow you to define unique responses to the detection of an RFID tag by an RFID sensor. To demonstrate this, RFID tags will be identified into two categories, and each category will have a different response. A tag that does not fit into either category will also have a response.

Group 1 = Red LED will light up

Group 2 = Yellow LED will light up

No Group = Both LEDs will flash

For our prototype project, this will simulate vulnerable pedestrians nearing an intersection, and the intersection responding with one of two actions. In the real scenario, these actions might be a warning light or a speaker announcement that indicates to the pedestrian when it is safe to cross.

 

PARTS LIST

For this tutorial, you will need:

  • Arduino Uno
  • PN532 RFID/NFC Shield
  • Two MIFARE Classic (ISO-14443A) 1K cards
  • Solderless Breadboard
  • Two LEDs
  • Two 330Ω Resistors
  • Wires (as needed)

 

CIRCUIT DIAGRAM

The wiring for this setup is fairly simple. The PN532 RFID/NFC Shield will stack directly on top of the Arduino Uno, but to show the critical connections to the board, the wiring diagram below shows them next to each other.

 

PARTS SETUP

The picture below shows what the parts look like when they are assembled.

 

UNDERSTANDING THE RFID TAG MEMORY ORGANIZATION

RFID tags have the ability to store data on them and this data is stored in a hexadecimal system to help maintain the integrity of the data during the exchange between devices. The cards in this tutorial can hold up to 1Kb of data, which is 1025 bytes of data. These bytes are organized into 16 sectors, which are divided into 8 blocks, and each block holds 8 bytes of data.

8 bytes x 8 blocks x 16 sectors = 1024 bytes.

This is important for this tutorial because the unique ID number for each tag is stored in the first 4 bytes of the 0 block in the 0 sector.

 

CODE

Below is the code that does the following steps:

  1. Download the Adafruit_PN532 library
  2. Define pin connections for an I2C connection (I2C protocol allows for multiple “slave” devices to connect to one “master” device)
  3. Define two response groups by unique tag ID
  4. Configure board to read RFID tags
  5. Search for ISO14443A card
  6. If a card is found, the card is authenticated
  7. Using the unique ID of the card, determines the response group
  8. LED response or output to try another card

VIDEO

The following video will show the RFID sensor in action!

Leave a Reply

Your email address will not be published. Required fields are marked *