Interfacing Arduino with RFID Module
Interfacing Arduino with RFID Module In this article interfacing of RFID module with Arduino is explained, RFID means RADIO FREQUENCY IDENTIFICATION which is invented to track and find the tagged or tag containing objects. RFID works on the principle of ELECTROMAGNETIC INDUCTION. An RFID system consists of two main components which are 1. TRANSCEIVER OR READER 2. TRANSPONDER OR TAG The reader consists of a radio frequency module and antenna which generates high-frequency electromagnetic radiation or field Whereas tag is a passive device which means it does not have any battery in it. The tag receives the high-frequency electromagnetic field and some of this radiation is entering into rectifier circuit stores in capacitors as energy. This energy is used as a power supply to the RFID tag. And the remaining radiation is transmitted by the transmitter which is present in TRANSPONDER OR RFID TAG. Specifications of RFID Module: The operating frequency range of the RFID module is up to 13.56MHz The operating supply voltage of the RFID module is 2.5V to 3.3V The maximum operating current that can be drawn from the reader is 13-26mA There are 8 pins in the RFID reader and the pins are VCC: This pin is the power supply pin. The power that can be given to this pin is 2.5V to 3.3V. You can connect it to 3.3V output from your Arduino. Remember connecting it to a 5V pin will likely destroy your module. RST: It is reset pin and set data from the beginning. GND: GND is the ground pin and is connected to the GND of Arduino. IRQ: It is an interrupt pin that can alert the microcontroller when the RFID tag comes into its vicinity. MISO/SCL/Tx: pin acts as Master-In-Slave-Out when the SPI interface is enabled, acts as a serial clock when the I2C interface is enabled and acts as serial data output when UART interface is enabled. MOSI: It is SPI (SERIAL PERIPHERAL INTERFACE) input to the RC522 Module. SCK (Serial Clock): It accepts clock pulses provided by the SPI bus Master i.e. Arduino. SS/SDA/Rx: this pin acts as Signal input when the SPI interface is enabled, acts as serial data when the I2C interface is enabled and acts as serial data input when the UART interface is enabled. This pin is usually marked by encasing the pin in a square so it can be used as a reference for identifying the other pins. CONNECTING THE RFID MODULE WITH ARDUINO The RFID module connection to the ARDUINO is discussed in the following steps: There will be 8 pins in the RFID module as we discussed earlier. Initially, the VCC pin of the RFID module is connected with the VCC (3.3V) pin of the ARDUINO by using the male to female jumper wire. Then the ground (GND) pin of the RFID module is connected with the GND pin of the ARDUINO by using the male to female jumper wire. And then RST pin is connected to the digital pin of the ARDUINO and that is pin#5 IRQ Pin is left unconnected because the library which is used in ARDUINO IDE is unsupported. And remaining pins like MOSI connected with pin#11, MISO connected with pin#12, SCK connected with pin#13, SS connected with pin#10. Now the power supply is given to the ARDUINO for the functioning of ARDUINO development and an RFID module. The complete set up of the interfacing of ARDUINO with the RFID module is done perfectly. WORKING : A Reader consists of a Radio Frequency module and an antenna which generates a high-frequency electromagnetic field. The tag is usually a passive device, it means it doesn’t contain a battery. But it contains a microchip that stores and processes information, and an antenna to receive and transmit a signal. The information that is stored on a tag, it is placed close to the Reader (does not need to be within direct line-of-sight of the reader). A Reader generates an electromagnetic field which causes electrons to move through the tag’s antenna and subsequently power the chip. The powered chip inside the tag then responds by sending its stored information back to the reader in the form of another radio signal. This is called backscatter. The backscatter or change in the electromagnetic/RF wave is detected and interpreted by the reader which then sends the data out to a computer or microcontroller. ARDUINO PROGRAM : #include #include #define SS_PIN 10 #define RST_PIN 9 MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. void setup() { Serial.begin(9600); // Initiate a serial communication SPI.begin(); // Initiate SPI bus mfrc522.PCD_Init(); // Initiate MFRC522 Serial.println(“Approximate your card to the reader…”); Serial.println(); } void loop() { // Look for new cards if ( ! mfrc522.PICC_IsNewCardPresent()) { return; } // Select one of the cards if ( ! mfrc522.PICC_ReadCardSerial()) { return; } //Show UID on serial monitor Serial.print(“UID tag :”); String content= “”; byte letter; for (byte i = 0; i < mfrc522.uid.size; i++) { Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? ” 0″ : ” “); Serial.print(mfrc522.uid.uidByte[i], HEX); content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? ” 0″ : ” “)); content.concat(String(mfrc522.uid.uidByte[i], HEX)); } Serial.println(); Serial.print(“Message : “); content.toUpperCase(); if (content.substring(1) == “BD 31 15 2B”) //change here the UID of the card/cards that you want to give access { Serial.println(“Authorized access”); Serial.println(); delay(3000); } else { Serial.println(” Access denied”); delay(3000); } } CONCLUSION: Finally, the interfacing of ARDUINO with the RFID module is done successfully. In this way, the RFID module is connected with ARDUINO and these projects have a vast number of applications in our daily life.