RFID Interfacing with Arduino

RFID Interfacing with Arduino



RFID Interfacing with Arduino


OVERVIEW


In this tutorial we are going to design a system to read the ID of RFID cards. RFID stands for Radio Frequency Identification. Each card has a unique ID embedded in it. These systems have many applications, like in offices, shopping malls and in many other places where only the person with authorization card is allowed to enter in the room. RFID is used in shopping malls to stop a theft from happening, here the product will be tagged with RFID chip and when a person leaves a building with the RFID chip an alarm is raised automatically and so the theft is stopped. The RFID tag is designed as small as grain of sand. The RFID authentication systems are easy to design and are cheap in cost. Some schools and colleges nowadays use RFID as attendance register.

Components Required

  1. ARDUINO UNO
  2. Power supply (5v)
  3. 100uF capacitor
  4. Buttons (two pieces)
  5. 1KΩ resistor (two pieces)
  6. EM-18(RFID reader module)
  7. LED
  8. LCD 16x2 .   

 

Circuit Diagram and Explanation

In 16x2 LCD there are 16 pins over all if there is a back light, if there is no back light there will be 14 pins. One can power or leave the back light pins. Now in the 14 pins there are 8 data pins (7-14 or D0-D7), 2 power supply pins (1&2 or VSS&VDD or GND&+5v), 3rd pin for contrast control (VEE-controls how thick the characters should be shown) and 3 control pins (RS&RW&E).


The connections which are done for LCD are given below:

PIN1 or VSS to ground

PIN2 or VDD or VCC to +5v power

PIN3 or VEE to the output of potentiometer (this enables you to set the LCD contrast to a desired level

PIN4 or RS (Register Selection) to PIN8 of ARDUINO UNO

PIN5 or RW (Read/Write) to ground (puts LCD in read mode eases the communication for user)

PIN6 or E (Enable) to PIN9 of ARDUINO UNO

PIN11 or D4 to PIN10 of ARDUINO UNO

PIN12 or D5 to PIN11 of ARDUINO UNO

PIN13 or D6 to PIN12 of ARDUINO UNO

PIN14 or D7 to PIN13 of ARDUINO UNO

Circuit Diagram for Interfacing RFID with Arduino Uno

Before going to further we need to understand about the serial communication. The RFID module here sends data to the controller in serial. It has other mode of communication but for easy communication we are choosing RS232. The RS232 pin of module is connected to RXD pin of UNO.

The data sent by the RFID module goes as:

RFID RS232 Data Interface

Now for setting up a connection between RFID reader and Arduino Uno, we need to enable the serial communication in UNO. The serial communication enabling in UNO can be done by using a single command.

 Serial.begin(9600);
 int data = Serial.read()

As shown in figure above, the communication of RFID is done by a BAUD rate of 9600 bits per second. So for UNO to establish such baud rate and to start serial communication we use command "Serial.begin(9600);". Here 9600 is the baud rate and is changeable.

 

Now once data is received by the UNO, it will be available for taking. This data is picked up by command “data = Serial.read();”. By this command serial data is taken to ‘data’ named integer.

Once a card is brought near reader, the reader reads the serial data and sends it to UNO, the UNO will be programmed to show that value in LCD, so we will have ID of card on LCD.

Code: 
#include 
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);//RS,EN,D4,D5,D6,D7
int count = 0;          //integer for storing character of ID
char input[12];//memory for storing 12 characters of ID
void setup()
{
    // set up the LCD's number of columns and rows:
    lcd.begin(16, 2);
    Serial.begin(9600);//serial communication enabling by 9600 baud rate
    pinMode(0,INPUT);//receive pin set as input
    lcd.print("Interesthing");//showing name
    lcd.setCursor(0, 1);//move courser to second line
}
void loop()
{    
    while(Serial.available() && count < 12)          // Read 12 characters and store them in input array
    {
        input[count] = Serial.read();//storing 12 characters one by one
        count++;
        lcd.print(input[count]);//showing 12 characters on LCD one by one
        if (count==12)
        {
            lcd.print("             ");
            count = 0;// once 12 characters are read get to start and wait for second ID
            lcd.setCursor(0, 1);//move courser to start.
        }
    }
}

Comments

No Comment Posted

Post Your Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Enter Security Code: