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>
http://siliconfishtech.blogspot.com/2010/10/arduino-rfid-tag-reader-cleaned-up.html


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:
            http://www.sparkfun.com/commerce/product_info.php?products_id=8628
           The datasheet is here:
           http://www.sparkfun.com/datasheets/Sensors/ID-12-Datasheet.pdf
           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.
           http://www.sparkfun.com/commerce/product_info.php?products_id=8423

  • 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.

          http://www.sparkfun.com/commerce/product_info.php?products_id=8310
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
//http://arduiniana.org/libraries/newsoftserial/
#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.begin(57600);
  Serial.println("RFID Reader Active");
  pinMode(cardPresent, INPUT);
  pinMode(led_pin, OUTPUT);

  // set the data rate for the NewSoftSerial port
  mySerial.begin(2400);
}

void loop()                     // run over and over again
{

  if (digitalRead(cardPresent)==HIGH) {
    digitalWrite(led_pin, HIGH);
  } else {
    digitalWrite(led_pin, LOW);
  }
  if (mySerial.available()) {
      Serial.print((char)mySerial.read(),HEX);
  }
}

2 comments:

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

    ReplyDelete
  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. top1rfid.com

    ReplyDelete