Search This Blog

Thursday, October 7, 2010

Arduino RFID tag reader prototype

 Put together the basic Arduino RFID reader in about an hour!  It was way easier than I expected and worked the first time!  

<Note: See the final version in this post>

Here is the prototype breadboard version I just whipped up:

The RFID module reads out serial ASCII data, and all you have to do is connect that output to a pin on the Arduino.  The serial library called in the code (the link is in the code) lets you put a serial input on any pin.
Thats all there is to it.  

You can read your tags, and put if statements in the loop to activate a pin on the arduino to make a lock, or whatever you want to happen when a card is read.   

  • Used the RFID Reader ID-20 from Sparkfun:
           The datasheet is here:
           The ID-12 is functionally identical, with a smaller range and uses less power.  Pick that one for a battery operated project.
  • This little breakout board for the RFID module is worth the $0.95 to make the pins plug into the breadboard.

  • I got a couple of these tags for $1.95 each.  RFID Tag - 125kHz.  Even if you have your own tags, i'd get one to be sure the reader is working when you build it.

It took some staring at the cryptic documentation and the web site below to figure out the circuit, so I drew it up since the drawings elsewhere were awful and had errors.

The sketch code follows the break...

//nice, flexible serial library
#include <NewSoftSerial.h>

//format (input, output)
//only the input is used in this example, output is unused
NewSoftSerial mySerial(8, 10);

int cardPresent = 9;
int led_pin = 13;

void setup()
  Serial.println("RFID Reader Active");
  pinMode(cardPresent, INPUT);
  pinMode(led_pin, OUTPUT);

  // set the data rate for the NewSoftSerial port

void loop()                     // run over and over again

  if (digitalRead(cardPresent)==HIGH) {
    digitalWrite(led_pin, HIGH);
  } else {
    digitalWrite(led_pin, LOW);
  if (mySerial.available()) {


  1. This comment has been removed by a blog administrator.

  2. When shopping for RFID tags for asset management, focus on the tracking system, not the tags. While tags are easy to acquire and program, the right inventory management system can make or break your operation.

  3. The place else may just I understand that sort of data written in such an impeccable strategy? I have a wander that I am basically now running on, and I've been at the look out for such data.