Introduction: RFID Reader! Identify Anything With RFID From Credit Cards to License Plates

Hey guys today I just got an RFID Reader module from Parallax! I tried it out and made this program which identifies cards and other RFID products! All you need is a computer, an Arduino, a breadboard, and the Parallax RFID Reader Module! Please share your experiences, I am in wonder of what may have happened to you while building it or something like that! Thanks.

Step 1: The Circuit!

This is a very simple circuit which only needs four wires! (besides the usb) Down below is a diagram!

Step 2: The Code and Have Fun Scanning Cards and Getting Their IDs

//RFID Reader Module Read and indentify by simonfrfr
#define RFID_ENABLE 2 //to RFID ENABLE (connect pin 2 to the /Enable)
#define CODE_LEN 10 //Max length of RFID tag
#define VALIDATE_TAG 1 //should we validate tag?
#define VALIDATE_LENGTH 200 //maximum reads b/w tag read and validate
#define ITERATION_LENGTH 2000 //time, in ms, given to the user to move hand away
#define START_BYTE 0x0A
#define STOP_BYTE 0x0D

char tag[CODE_LEN];

void setup() {
Serial.begin(2400); //fequency needed becuase the used frequency on the RFID Reader Module
pinMode(RFID_ENABLE,OUTPUT);
}

void loop() {
enableRFID();
getRFIDTag();
if(isCodeValid()) {
disableRFID();
sendCode();
delay(ITERATION_LENGTH);
} else {
disableRFID();
Serial.println("Error: Unable to complete process!");
}
Serial.flush();
clearCode();
}

/*
Clears out the memory space for the tag to 0s.
*/
void clearCode() {
for(int i=0; i<CODE_LEN; i++) {
tag[i] = 0;
}
}

/*
Sends the tag to the computer.
*/
void sendCode() {
Serial.print("TAG:");
for(int i=0; i<CODE_LEN; i++) {
Serial.print(tag[i]);
}
}

/*

RFID Functions
*/

void enableRFID() {
digitalWrite(RFID_ENABLE, LOW);
}

void disableRFID() {
digitalWrite(RFID_ENABLE, HIGH);
}

/*
Blocking function, waits for and gets the RFID tag.
*/
void getRFIDTag() {
byte next_byte;
while(Serial.available() <= 0) {}
if((next_byte = Serial.read()) == START_BYTE) {
byte bytesread = 0;
while(bytesread < CODE_LEN) {
if(Serial.available() > 0) { //wait for the next byte
if((next_byte = Serial.read()) == STOP_BYTE) break;
tag[bytesread++] = next_byte;
}
}
}
}

/*
Waits for the next incoming tag to see if it matches
the current tag.
*/
boolean isCodeValid() {
byte next_byte;
int count = 0;
while (Serial.available() < 2) { //there is already a STOP_BYTE in buffer
delay(1); //probably not a very pure millisecond
if(count++ > VALIDATE_LENGTH) return false;
}
Serial.read(); //throw away extra STOP_BYTE
if ((next_byte = Serial.read()) == START_BYTE) {
byte bytes_read = 0;
while (bytes_read < CODE_LEN) {
if (Serial.available() > 0) { //wait for the next byte
if ((next_byte = Serial.read()) == STOP_BYTE) break;
if (tag[bytes_read++] != next_byte) return false;
}
}
}
return true;




Have fun scanning all of your objects! I had fun too! It is a very cool module! When the reader is waiting for a RFID Tag then the LED is RED. Look at some of my other projects at https://www.instructables.com/id/Candy-Drop-dispenser/
https://www.instructables.com/id/Password-protected-Secret-Telling-Arduino/
https://www.instructables.com/id/Arduinik-The-HumanoidBiped-Robot/

Comments

author
rogeliotorlao made it!(author)2015-02-12

would this dump every credit card info? 3:) im thinking about something bad jk

author
simonfrfr made it!(author)2015-02-15

Not this specific sensor, but a sensor with a different frequency can pick up the Credit Card information. (dependant on which technology)

author
simonfrfr made it!(author)2012-04-19

Hey guys I made a second version feel free to check it out :D and thanks for your comments :D

author
lookwhatjoeysmaking made it!(author)2012-04-09

hi i got the rfid going on my arduino uno. but i cant figure out how to make a led on pin 13 turn on when a specific card is read.also how wold i Chang the name of the card so when it reads a2r128 a1r120 a0r-1 a0r-1 a0r-1 a0r-1 a0r-1 a0r-1 a0r-1 a1r248 a4r128 a6r128 a10r120 a13r0 a17r120 a19r128 a18r0 a17r128 a16r128 a15r0 a14r120 a13r120 a12r120 a11r248 a10r128 a11r120 a16r128 a19r248 a23r0 a26r120 TAG: and change that to: joe hudy. and with that name "joe hudy" i cold put it on my lcd.

author
simonfrfr made it!(author)2012-04-15

I'm publishing a newer version of this instructable soon, it is going to incorporate the card code comparing.

author
simonfrfr made it!(author)2012-04-10

You cannot change the name of the card because this is only a reader, but you can assign a name and value for the card. For Example lets say you want to have a vending Machine account, you can enable a card on the system when you buy it. You could set the name and when you scan it it goes into the system. Under the Name there could be a value which could be changed like subtracted when you spend money or added when you put money in the account.

author
zer0nerz made it!(author)2012-01-06

i was wondering how can you add a display to this code? maybe one of the touch screen LCD's? i have one of those i wanted to view on that. and my
C++ is at a beginners hello world basically...

author
simonfrfr made it!(author)2012-02-27

Well can you please specify which LCD you are talking about?

author
zer0nerz made it!(author)2012-02-28

it says HY-tft320_262k under, it has a SD card slot also.

2011816141222948319.jpg
author
simonfrfr made it!(author)2012-03-03

can you give me the product page, then I should be able to help you, Thanks Simon

author
zer0nerz made it!(author)2012-03-03

http://www.ebay.com/itm/Arduino-Compatible-3-2-TFT-LCD-module-SD-card-/280724961864?pt=LH_DefaultDomain_0&hash=item415c82fa48

author
simonfrfr made it!(author)2012-03-04

DB0-DB16 to pin D0-D13, pin A0-A1 of Arduino
RESET to A2
CS to A3
WR to A4
RS to A
this should take up most of the pins on the Arduino UNO, so you would need an Arduino Mega for this to function.

author
zer0nerz made it!(author)2012-03-04

i have uno and mega

author
simonfrfr made it!(author)2012-03-06

Ok then, you will need to edit the code then. You will need to use multi-serial on the mega and change the Enable port to 50. Or something like it.
Then programming the LCD is necessary. I will try to make a sample code for you of the RFID and everything when I get a chance. That should be soon

author
zer0nerz made it!(author)2012-03-06

thank you so much =)

author
simonfrfr made it!(author)2012-03-08

did you already buy this? I have something similar but I like it better.

author
zer0nerz made it!(author)2012-03-09

what did you have by the way?

author
simonfrfr made it!(author)2012-03-13

well I bought a few products for 4D systems and they work well with Arduino. I love their products. I am trying during my free time from school to work on your problem.

author
zer0nerz made it!(author)2012-03-08

I yes i have it in possession now. Was so curious what i can do with this thing.

author
simonfrfr made it!(author)2012-03-07

np

About This Instructable

25,270views

79favorites

License:

Bio: Hey YOU! Yeah, I'm talking to you who is reading this. Send me ideas for instructables, like things that you are wondering how to ... More »
More by simonfrfr:DIY Spectrometer) Explore the Unknown ->Zombie Attack! Easy to build!Newton Labs Projects Arduino Guide (2012)
Add instructable to: