RFID Reader! MK: II, Card Identifiers

About: 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 make or build, or really anything electronically related, and I'll get back t...

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

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

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 <SoftwareSerial.h>
#include <avr/interrupt.h>

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);

  if((val = RFID.read()) == 10)
  {   // check for header
    bytesread = 0;
    {  // 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
    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");
    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



    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • PCB Contest

      PCB Contest
    • Toys Contest

      Toys Contest

    7 Discussions


    3 years ago

    hey .i'm working with arduino mega 2560 I need to know how to work with RC522 and RCI with my arduino .
    so please help me.tq :)

    1 reply

    4 years ago on Introduction

    hello.. i need ur help.. iam a newbie in arduino world. and i have to do project for rfid register attendance using arduino. may i know this code are suitable for my project ? i will use existing card exmple student card..i need ur response as soon as possible..tq :)

    1 reply

    Reply 4 years ago on Introduction

    Yes this is suitable for your project. What kind of arduino do you own? If you own an Ethernet you can send Card data to a server, and grab time from that server too, to check if the student was tardy, absent, or early.But if you only need one card to work with, then you can use this just to check if the student "scanned" his card. Good luck, if you need any more help feel free to email me @ newtonlabs@bellsouth.net


    6 years ago on Introduction

    Could you tell me what arduino do you have to use and does the computer have to be connected at the time of the reading

    2 replies

    Reply 6 years ago on Introduction

    Well, I was using the Arduino Uno, The Arduino reads the RFID READER and you do not really need to have the computer connected for this to work.