RFID stands for Radio Frequency IDentification and it’s a non-contact technology that’s broadly used in many industries for tasks such as personnel tracking, access control, supply chain management, books tracking in libraries, tollgate systems and so on.[/column]

The RFID reader consist of a radio frequency module, a control unit and an antenna coil which generates high frequency electromagnetic field. On the other hand, the tag is 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.

Now as the tag is powered it can extract the transmitted message from the reader, and for sending message back to the reader, it uses a technique called load manipulation. Switching on and off a load at the antenna of the tag will affect the power consumption of the reader’s antenna which can be measured as voltage drop. This changes in the voltage will be captured as ones and zeros and that’s the way the data is transferred from the tag to the reader.

There’s also another way of data transfer between the reader and the tag, called backscattered coupling. In this case, the tag uses part of the received power for generating another electromagnetic field which will be picked up by the reader’s antenna.

When power ON this door lock, the servo motor activates and pushes the door lock forward. Also displayed as “Welcome, put your card” on the LCD. Then when the RFID tag is moved closer to the RFID reader, it is scanned. In that case, it is displayed as “scanning” on the LCD. Then, if the RFID tag is correct, the servo motor is activated and the door lock is pulled back. The LCD shows “Door is Open”. When the RFID tag is moved closer to the RFID reader again, if it gets the correct tag, the servo motor will push the lock forward. Displays “Door is locked” on LCD. If a wrong RFID tag is used according to the program, it will be displayed as “Wrong card” on the LCD.

The fingerprint access control systems are preferred only for high security or personal security solutions, are highly personalized, and are costly. The PIN and RFID are cost-effective solutions applicable to public access systems like hotel rooms, classrooms, and offices. Of these two, RFID access control systems come with higher security and offer wider applications. For example, RFID solutions can be used simultaneously for access control as well as attendance in school/college classrooms.

In this project, we are designing an RFID door lock system and will explore how the locking mechanism can be built in different ways.

The read bytes of NUID are stored in a character array. This character array is compared to a predefined NUID using user-defined compareNUID() function. The function returns a boolean value used to determine access control. If the scanned NUID is matched with the programmed ID, a message granting access is displayed on the OLED screen. If the scanned NUID does not match the programmed ID, a message denying access is displayed on the OLED screen.

When power ON this door lock, the servo motor activates and pushes the door lock forward. Also displayed as “Welcome, put your card” on the LCD. Then when the RFID tag is moved closer to the RFID reader, it is scanned. In that case, it is displayed as “scanning” on the LCD. Then, if the RFID tag is correct, the servo motor is activated and the door lock is pulled back. The LCD shows “Door is Open”. When the RFID tag is moved closer to the RFID reader again, if it gets the correct tag, the servo motor will push the lock forward. Displays “Door is locked” on LCD. If a wrong RFID tag is used according to the program, it will be displayed as “Wrong card” on the LCD.

The fingerprint access control systems are preferred only for high security or personal security solutions, are highly personalized, and are costly. The PIN and RFID are cost-effective solutions applicable to public access systems like hotel rooms, classrooms, and offices. Of these two, RFID access control systems come with higher security and offer wider applications. For example, RFID solutions can be used simultaneously for access control as well as attendance in school/college classrooms.

In this project, we are designing an RFID door lock system and will explore how the locking mechanism can be built in different ways.

The read bytes of NUID are stored in a character array. This character array is compared to a predefined NUID using user-defined compareNUID() function. The function returns a boolean value used to determine access control. If the scanned NUID is matched with the programmed ID, a message granting access is displayed on the OLED screen. If the scanned NUID does not match the programmed ID, a message denying access is displayed on the OLED screen.

The door lock system consists of two critical circuits – the access control system and a locking mechanism. For the access control system here, an RFID is used. This door lock uses an RC522 RFID reader to read MIFAR

E and NTAG compatible RFID cards. Each lock passes access to only one RFID card, so all other cards are denied access. The system can also be programmed to provide additional access to a master card, which may be used instead of a lost card. The user interface is designed using an SSD1306 OLED display. Therefore, the complete access control system is designed by interfacing the RC522 RFID reader and SSD1306 OLED display with Arduino UNO.

Next, constants are defined for circuit connections with the OLED display, and an object of the Adafruit_SSD1306 class is instantiated. The constants for circuit connections with RC522 are defined, and an object of the MFRC522 class is instantiated. A variable to store the MIFARE key is defined. A byte array ‘ nuidPICC[]’ is defined to store 4 bytes of RFID NUID. Variables are declared to store string representations of the NUID in decimal and hexadecimal formats. Similarly, a variable to store a string representation of the MIFARE key is defined. A bitmap is stored in PROGMEM for site loge, and an array is defined for the same.

In the setup() function, the baud rate for serial communication is set to 9600 bps. The OLED display is initialized by calling display.begin(SSD1306_SWITCHCAPVCC) method and display is flashed by calling display.display() method. The SPI protocol is initialized by calling SPI.begin() method. The RFID module initializes the PCD_Init() method on the RFID object. The MIFARE key bytes are set to FF and stored in an upper-case string representation. The MIFARE key is published on the Serial Monitor. The OLED display is cleared, and the site logo is flashed.

In the loop() function, some initial messages are first flashed on the screen. RFID card/key/tag is detected by calling PICC_IsNewCardPresent() method on the RFID object. Next, the card NUID/UID is read by calling the PICC_ReadCardSerial() method on the RFID object. The MIFARE card type is detected using the PICC_GetType(rfid.uid.sak) method and displayed on the Serial Monitor. Next, the individual bytes of the NUID are accessed using the rfid.uid.uidByte[] property. First, the bytes are serialized in decimal format and converted to a string object. The string containing a decimal representation of NUID is published on the Serial Monitor. Next, the bytes are serialized in hexadecimal format and converted to a string object. The string containing a hexadecimal representation of NUID is published on the serial monitor.

The RC522 RFID reader is interfaced with Arduino using SPI protocol. The following circuit connections are made for interfacing the RFID reader with Arduino UNO. To learn more about reading RFID cards using RC522,