SparkFun Qwiic RFID-IDXXLA Hookup Guide

Pages
Contributors: Elias The Sparkiest
Favorited Favorite 1

Introduction

The Qwiic RFID ID-XXLA is an I2C solution that pairs with the ID-LA modules: ID-3LA, the ID-12LA, or the ID-20LA, and utilizes 125kHz RFID chips. Using the product's interrupt pin, we'll discuss how to get, store, and compare unique RFID IDs. Let's take a look at the hardware used for this RFID tutorial.

SparkFun RFID Qwiic Reader

SparkFun RFID Qwiic Reader

SEN-15191
$19.95
SparkFun RFID Qwiic Kit

SparkFun RFID Qwiic Kit

KIT-15209
$44.95

Required Materials

To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary.

RFID Reader ID-12LA (125 kHz)

RFID Reader ID-12LA (125 kHz)

SEN-11827
$29.95
9
SparkFun RedBoard Qwiic

SparkFun RedBoard Qwiic

DEV-15123
$19.95
1
USB micro-B Cable - 6 Foot

USB micro-B Cable - 6 Foot

CAB-10215
$4.95
12
Jumper Wires Premium 6" M/M Pack of 10

Jumper Wires Premium 6" M/M Pack of 10

PRT-08431
$3.95
2
Qwiic Cable - 50mm

Qwiic Cable - 50mm

PRT-14426
$0.95
RFID Tag (125kHz)

RFID Tag (125kHz)

COM-14325
$1.95

Tools

You will need a soldering iron, solder, and general soldering accessories.

Solder Lead Free - 15-gram Tube

Solder Lead Free - 15-gram Tube

TOL-09163
$3.50
2
Soldering Iron - 30W (US, 110V)

Soldering Iron - 30W (US, 110V)

TOL-09507
$9.95
6

Suggested Reading

If you aren't familiar with the Qwiic system, we recommend reading here for an overview.

Qwiic Connect System
Qwiic Connect System

We would also recommend taking a look at the following tutorials if you aren't familiar with them.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.

RFID Basics

An overview of Radio Frequency Identification (RFID) technology.

Hardware Overview

Qwiic Connectors

This is a Qwiic product but not a "pure" Qwiic product. You'll still need to solder or connect the interrupt pin if you decide to use that to indicate when an RFID card has been read (more on that later). Outside of that, Qwiic is an eco-system designed for I2C devices that allows you to prototype quickly without needing to solder anything. Just plug your Qwiic product into a Qwiic capable microcontroller and you're good to go! There are two on this product which means you can daisy chain the product with other I2C devices, like a Qwiic Keypad for example.

The two large connectors on the product are the Qwiic connectors and are highlighted in this picture.

Power

The SparkFun Qwiic RFID ID-xxLA is a 3.3V system. You can power the product with a Qwiic cable plugged into a capable microcontroller. You can also provide power through the 3V3 pin on the header.

LEDs and Buzzer

When you provide power to the board you will see the onboard red power LED light up. There's another LED opposite the power LED labeled READ. This blue stat LED and the onboard buzzer will light or beep respectively when an RFID tag is brought into range.

The image shows the ATtiny side of the product with the power and read LEDs above the connectors highlighted. The image shows the buzzer on the side of the RFID reader

RFID Modules

There are three ID-xxLA options in our catalog that are listed above in the Introduction: the ID-3LA, the ID-12LA, and ID-20LA. If you purchased the SparkFun RFID kit then it includes the ID-12LA and RFID cards that you need. Pictured below is the ID-12LA plugged into the Qwiic RFID.

Pictured is the product with the RFID module plugged into its headers.

Each option is similar but there is a small variance in power consumption which translates into different read range capabilities. The ID-3LA is designed to be used with an external antenna which will get you 30cm of range. The ID-12LA and ID-20LA have a range of 12cm and 18cm respectively.

When plugging in your module, just take care that the side with less pins goes into the header with less pins.

Pictured is the module with the two female headers highlighted.

Smaller header on the left, larger on the right.

Jumpers

There are four jumpers on the header side of the product. Facing the product with the buzzer at the top, you'll see a jumper on the left side labeled INT. The interrupt pin can be disconnected here by cutting the trace. Now moving to the bottom near the header is a jumper labeled I2C that connects the I2C pull-up resistors to the I2C data lines. On the right side is a jumper labeled Buzzer that disconnects the buzzer when cut. This will disable the beeping sound when a RFID card is in range. Finally, the ADDR jumper allows you to change the default I2C jumper from 0x7D to 0x7C.

There are four jumpers on the side of the header side of the product that are highlighted in this picture.

Hardware Assembly

Simply insert a Qwiic cable between the RedBoard Qwiic and the Qwiic RFID reader. You will also need to solder wire between the Qwiic RedBoard's pin 8 and the Qwiic RFID reader's INT pin. When you are ready, align the headers of the module with the Qwiic RFID reader.

Here is an image of the Qwiic RFID module connected to the Redboard Edge via a Qwiic cable with an additional wire connecting the product's interrupt with pin 8 on the Redboard.

Note: The Qwiic system has a logic level of 3.3V. I have attached the interrupt to pin 8 on the Redboard Qwiic even though the pin is at 5 volts. This will not harm the Qwiic RFID because we're doing a simple digitalRead() but also because the ATTiny84 is tolerant of voltages up to 5.5V.

Arduino Library

We've written a library to make it even easier to get started with the SparkFun Qwiic RFID ID-XXLA. The library will give you the full functionality of the Qwiic RFID ID-XXLA without the hub bub of the I²C data transactions. Also included are examples codes to demonstrate the full functionality of the library. You can click the link below to download the file directly and install it manually, or navigate through the Arduino Library Manager by searching SparkFun Qwiic RFID. You can also go the Github page and get download it from there.

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

Example Code

Let's take a look at the first two example sketches provided in the SparkFun Qwiic RFID Arduino Library.

Example 1 - Read Tag Basics

For this first example we'll be grabbing the scanned card and the time between when it was scanned and when we request the number, by typing the number 1 into the Arduino IDE's Serial Terminal. If you downloaded the SparkFun Qwiic RFID Arduino Library directly then open the example located in the in the examples folder: SparkFun_Qwiic_RFID_Arduino_Library > Examples >Example1_Read_Tag_Basics.ino . If you've downloaded the library through the Arduino Library Manager, then in the Arduino IDE you can navigate to File>Examples>SparkFun Qwiic RFID Arduino LIbrary>Example1_Read_Tag_Basics.

Let's walk through the setup at the very top of the code. Nothing too surprising here, we've #included-ed the Wire library as well as the SparkFun Qwiic RFID library. We then initialize the library with the Qwiif Rfid myRfid(RFID_ADDR) declaration. You may notice that it takes the Qwiic RFID Reader's address as one of it's arguments: RFID_ADDR. In the setup we begin the Wire, Serial, as well as the Qwiic RFID library. If there is a problem between your Redboard and the SparkFun Qwiic RFID board, then we'll print out an error message.

language:c
#include <Wire.h> 
#include "SparkFun_Qwiic_Rfid.h"

#define RFID_ADDR 0x7D // Default I2C address 

Qwiic_Rfid myRfid(RFID_ADDR);

String tag; 
float scanTime;
int serialInput; 

void setup()
{
  // Begin I-squared-C
    Wire.begin(); 
    Serial.begin(115200); 

  if(myRfid.begin())
    Serial.println("Ready to scan some tags!"); 
  else
    Serial.println("Could not communicate with Qwiic RFID!"); 

}

In the main loop, we're looking for the number 1 to be entered into the Serial terminal. When that's entered we're going to grab the RFID tag with the myRFId.getTag() function call and get its' "scan" time (in seconds) with the myRFID.getPrecReqTime() function call. Just a quick note on the "time". This is not the time of day the tag was scanned but rather the time between when it was scanned and when you requested it. This gives each RFID tag a unique property even when you scan the same card twice, because their scan times will be different.

lanuage:c
void loop()
{
  if (Serial.available() > 0){

    serialInput = Serial.read(); 
    if (serialInput == 49){   // "1" on your keyboard is 49 in ASCII

      tag = myRfid.getTag();
      Serial.print("Tag ID: ");
      Serial.print(tag);
      Serial.print(" : "); 
      scanTime = myRfid.getPrecReqTime(); 
      // If this time is too precise try: 
      // long time = myRfid.getReqTime(); 
      Serial.print(" Scan Time: ");
      Serial.print(scanTime);

    }

  }
}

After scanning a card and waiting a number of seconds, then entering 1 into the Serial Terminal, my output looks like this.

This picture shows the Serial Terminal of the Arduino IDE which diplays the RFID tag and it's scan time.

If you need a similar example, but one that reads all 20 tags that can be stored on the SparkFun Qwiic RFID ID-XXLA Reader, then check out Example5_Get_All_Available_Tags

Example 2 - Read Tag Interrupt

For this next example we'll be using an additional pin as an interrupt that will indicate that a card has been scanned, which makes this not a pure Qwiic example. We'll use that interrupt to initiate a request to read the tag that the SparkFun Qwiic RFID Reader is holding onto. If you the downloaded the SparkFun Qwiic RFID Arduino Library directly then open the example located in the in the examples folder: SparkFun_Qwiic_RFID_Arduino_Library > Examples >Example2_Read_Tag_Interrupt.ino . If you've downloaded the library through the Arduino Library Manager, then in the Arduino IDE you can navigate to File>Examples>SparkFun Qwiic RFID Arduino LIbrary>Example2_Read_Tag_Interrupt.

At the top we #include the new library and use the default address for our Qwiic Rfid myRfid(RFID_ADDR) declaration. In the setup we communicate with the SparkFun Qwiic RFID Reader with the myRfid.begin statement. If there is any issue communicating with the Qwiic RFID we'll know about them here. Last but not least we pull the interrupt pin on pin 3 up high with pinMode(intPin, INPUT_PULLUP) to put it into a known HIGH state. When a tag is read this line will go LOW.

language:c
#include <Wire.h> 
#include "SparkFun_Qwiic_Rfid.h"

#define RFID_ADDR 0x7D // Default I2C address 

const int intPin = 3; 
String tag; 

Qwiic_Rfid myRfid(RFID_ADDR);

void setup()
{
  // Begin I-squared-C
    Wire.begin(); 
    Serial.begin(115200); 

  if(myRfid.begin())
    Serial.println("Ready to scan some tags!"); 
  else
    Serial.println("Could not communicate with the Qwiic RFID Reader!!!"); 

  // Put the interrupt pin in a known HIGH state. 
  pinMode(intPin, INPUT_PULLUP); 
}

In the loop, we're just monitoring the Qwiic RFID's interrupt pin that will indicate that a tag has just been read. This will initiate a call to myRfid.getTag() that will pull in the scanned card's RFID tag ID.

language:c
void loop()
{

  // If the pin goes low, then a card has been scanned. 
  if(digitalRead(intPin) == LOW){
    tag = myRfid.getTag();
    Serial.println(tag);
  }

  delay(500); // Geeze, woah! Slow it down mate.

}

And that's it!

If you have not already, select the board and COM port of your Arduino and upload the Example1_ReadTag.ino code. Then open your Serial Monitor at 9600 and scan a tag,

There is a gif here showing a person placing their RFID tag in range of the RFID module.

You should see the following:

Pictured is an image of Arduino's Serial Monitor with an RFID tag's number printed.

Resources and Going Further

Now that you've successfully got your Qwiic RFID Reader up and running, it's time to incorporate it into your own project!

For more information, check out the resources below:

We carry other RFID options. Do you want a high powered RFID reader that can simultaneously pick up multiple RFID cards at a time? Perhaps you'd rather a RFID card reader that transmits over serial, check out the options below.

SparkFun Simultaneous RFID Reader - M6E Nano

SparkFun Simultaneous RFID Reader - M6E Nano

SEN-14066
$224.95
17

SparkFun RFID Starter Kit

KIT-13198
15

Need some inspiration for your next project? Check out some of these related tutorials tagged with RFID:

SparkFun RFID Starter Kit Hookup Guide

Learn the basics of how to get started with the SparkFun RFID Starter Kit.

Simultaneous RFID Tag Reader Hookup Guide

A basic guide to getting started with the RFID Tag Reader breakout and how to read and write multiple RFID tags over multiple feet!

RFID Basics

An overview of Radio Frequency Identification (RFID) technology.

Build a Qwiic Jukebox that is Toddler Approved!

Follow this tutorial to build your own custom jukebox. Note, this is designed simple and tough for use primarily with toddlers. It's also a great introduction to SparkFun's Qwiic products!

Or check out this blog post for ideas: