RFID Reader! MK: II, Card identifiers
Hey guys I'm back with a second version of the code for an RFID scanner! This scanner is a great way to use your cards by holding values, balances, securities and many different things for RFID cards!

Entry Robot Challenge age group 13-17

Step 1: Supplies

RFID Reader! MK: II, Card identifiers
one RFID made circuit (version one) or you could follow the circuit diagram here. Read the big box which is a note, it is important.

Step 2: The code!!!!!!!

RFID Reader! MK: II, Card identifiers
This is a very simple code for comparision, it is actually a bit confusing of how to get your card number to be compared.



#include
#include

int val = 0;
char code[10];
int bytesread = 0;

#define rxPin 8
#define txPin 9
// RFID reader SOUT pin connected to Serial RX pin at 2400bps to pin8

void setup()
{
Serial.begin(9600); // Hardware serial for Monitor 9600bps

pinMode(2,OUTPUT); // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
digitalWrite(2, LOW); // Activate the RFID reader
}


void loop()
{
SoftwareSerial RFID = SoftwareSerial(rxPin,txPin);
RFID.begin(2400);

if((val = RFID.read()) == 10)
{ // check for header
bytesread = 0;
while(bytesread { // read 10 digit code
val = RFID.read();
if((val == 10)||(val == 13))
{ // if header or stop bytes before the 10 digit reading
break; // stop reading
}
code[bytesread] = val; // add the digit
bytesread++; // ready to read next digit
}

if(bytesread == 10)
{ // if 10 digit read is complete
Serial.println("TAG code is: "); // possibly a good TAG
Serial.print(code); // print the TAG code
validateRFID(code);
}
bytesread = 0;
delay(500); // wait for a second
}
}


void validateRFID(char* i) {
if( strncmp(i,"12000C9DBF", 10) == 0) {
// if 10 digit code equals "12000C9DBF"
digitalWrite(13, HIGH);
Serial.println(" Correct Tag");
delay(1000);
digitalWrite(13, LOW);
} else {
digitalWrite(13, LOW);
}
}

Step 3: Enjoy.

Thanks for the comments and PMs, they helped me decide what to include in version 2. Thanks so much, feel free to post comments, have questions, or share your experience. Thanks, Simon
 
 

Tag cloud

make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel