Interfacing RFID with Arduino – How to Read RFID Cards using Arduino

In this tutorial, we are dealing with yet another interfacing technique. This time we are interfacing an RFID Reader which can read RFID Tags to Arduino. RFID is Radio Frequency Identification. An RFID reader is used to read RFID tags (which contain certain unique data stored in a chip). An RFID reader and an RFID tag, both have a coil surrounding them.

 

Interfacing_RFID_to_Arduino

When an RFID tag is shown near an RFID Reader, it collects the unique tag data (a combination of digits and characters) from the RFID tag. You will be wondering how the chip inside RFID tag gets power ? This is made possible via Electromagnetic Induction. I told you, both RFID reader and RFID tag comes with a coil in them. We power the RFID reader from power supply for reading purpose. Now when an RFID tag is shown near the reader, electromagnetic induction will take place between the coils and this powers the chip inside tag. This chip will send data electromagnetically to the reader. The reader will receive this electromagnetically transferred data and outputs it serially. Every RFID reader comes with Serial output pins. We can collect the read data through these serial pins using arduino or any other micro controller. So here begins our classic tutorial on Interfacing RFID with Arduino.

How to Interface RFID Reader to Arduino

Lets first wire the whole thing up. You may observe the circuit diagram given below. Take note of the following stuffs.

Note 1:- Power supply requirement of RFID Readers vary from product to product. The RFID reader I used in this tutorial is a 12 Volts one. There are 5 Volts and 9 Volts versions available in the market.

Note 2:- You may ensure the RFID Reader and RFID Tags are frequency compatible. Generally they are supposed to be 125Khz. You may ensure this before purchasing them.

Note 3:- There are two possible outputs from an RFID Reader. One is RS232 compatible output and other one is TTL compatible output. A TTL compatible output pin can be connected directly to Arduino. Whereas an RS232 compatible output must be converted to TTL using an RS232 to TTL converter (You can design this yourself using MAX232 IC)

Make connections as shown. Make sure you connect Ground Pin of RFID reader to Ground Pin of Arduino. I am using the SoftwareSerial Library of Arduino which enables digital pins to be used in serial communication. I have used pin 9 as the Rx of Arduino. (You can also use the hardware Rx pin of Arduino uno – that’s pin 0). If you are new to SoftwareSerial Library, you may read my previous tutorial on interfacing GSM module to Arduino (this article clearly explains how to use Software Serial Library).

Lets get to the programming side!

 #include <SoftwareSerial.h>

SoftwareSerial mySerial(9, 10);
void setup()
{
  mySerial.begin(9600); // Setting the baud rate of Software Serial Library  
  Serial.begin(9600);  //Setting the baud rate of Serial Monitor 
 }void loop()
{
    
 if(mySerial.available()>0)
  {
  Serial.write(mySerial.read());
  }
}

mySerial.available() – checks for any data coming from RFID reader module through the SoftwareSerial pin 9. Returns the number of bytes available to read from software serial port. Returns a -1 if no data is available to read.

 

Read More: Interfacing RFID with Arduino – How to Read RFID Cards using Arduino


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top