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

26,210

79

20

Posted

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/

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Spotless Contest

      Spotless Contest
    • Science of Cooking

      Science of Cooking
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    20 Comments

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

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

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

    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.

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

    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.

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

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

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

    2011816141222948319.jpg

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