RFID stands for Radio Frequency Identification and is now used almost everywhere where there is a need of security access. It has wide application in Gate passes, Metro tickets, Toll gates, Attendance system, personnel tracking and many others. It is a non-contact technology that uses electromagnetic fields to transfer data over short distances. It consists of basically two components, one is a transponder or a tag which is placed on the object that to be identified, and other is a transceiver or a RFID reader.In this tutorial we are making RFID Door Locking System using Arduino Uno and RFID module.
The RFID reader consists of a small RF module, a control unit and an antenna coil which generates high frequency electromagnetic field. On the other hand, the RFID tags are usually a passive component, which consist of just an antenna and an electronic microchip, so when it gets near the electromagnetic field of the transceiver, due to induction, a voltage is generated in its antenna coil and this voltage serves as power for the microchip. These microchips can be loaded with information related to a person or the access credential.
Arduino/Raspberry PI compatible RFID Modules are based on MIFARE protocol. Here, in this project we are using MFRC522 RFID reader, which is very cost effective and comes with two tags. Note that you can use the RFID reader with almost every other Tags too.
Here are some of the specifications of MFRC522 RFID Module:
- Operating Frequency: 1.3 MHz
- Operating Distance: 0-10 cm
- Memory of Tags: 1 Kb
- Uses SPI Protocol to communicate with Arduino/Raspberry PI
- Operation Voltage is 3.3V but it is tolerable to 5V also.
Adding RFID Library :
Before, proceeding further we need to add the MFRC522 library from GitHub to Arduino IDE.
For that download the zip file and extract it and paste the folder to the location C:\Program Files (x86)\Arduino\libraries
Once the above step is complete, now we are ready for reading the RAW data from the tag. Here, we are only interested in knowing the UID (Unique Identification Detail) of the tags so that we can identify them in case of authorization of Tags by RFID reader.
Make the connection as shown for Arduino Uno but if you are using other Arduino board then connect the SDA and SCL pins as per a the board accordingly.
Reading the UID of Tags:
Step 1: Open Arduino IDE and Navigate to the example codes of MFRC522 library and select the Dump example from the list. And upload it to Arduino for the above connection.
Step 2: After the code is uploaded successfully. Open the serial monitor and bring the tag that you want to be decoded near the RFID Reader and hold it in position for 1-5 sec and the details of the RFID tag appears with UID as shown below. Note down the UID similarly for other tags too.
RFID Controller Door System:
Once, we are done with reading the UID of RFID Tags.We are ready to use them as the secret key in our Arduino’s code to actuate things. Since, we are making a RFID Controlled Door System so for demonstration we are going to move the shaft of the Servo attached to the door as a lock for the correct Tags and trigger a Buzzer for wrong Tags and display some relevant messages accordingly on 16X2 LCD Screen.
- Arduino Uno
- RFID Module
- Servo Motor
- 16X2 LCD Display
- Jumper Wires
Here, change the UID no. to the one you have decoded for your RFID Tags.