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
<Note: See the final version in this post>
http://siliconfishtech.blogspot.com/2010/10/arduino-rfid-tag-reader-cleaned-up.html
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:
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.
- 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- Of course you need an Arduino Duemilanove from http://www.sparkfun.com/commerce/product_info.php?products_id=666 for $25,
- A solderless breadboard and some wire and you are good to go!
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);
}
}


No comments:
Post a Comment