Tuesday, March 19, 2024

RFID Contactless Lock

Ashwini Kumar Sinha

ashwiniWhen it comes to security, RFID card-based digital locks are more reliable than key-based mechanical locks since they cannot be easily broken also they are Contactless Lock. Therefore, some hotels across the world have adopted this technology. However, there is a danger of passwords getting leaked, allowing anyone to infringe on a person’s privacy. 

So in today’s project, we will make an RFID contactless lock for hotel rooms that has an additional feature of temporarily storing a person’s hotel check-in and check-out details. This means that the card will only work for that particular person up to the designated hotel stay schedule.

Bill Of Materials  

DIY Contactless Lock Parts

Coding 

First, we need to install libraries to Arduino IDE. To install the required library, go to Arduino IDE and open the library manager. Type MFRC522 in the search bar and select install. Now you can begin coding. 

- Advertisement -

Besides MFRC522, also include the library Servo in the code. While MFRC522.h enables the RFID reader module to read the RFID card, Servo.h equips the lock with a servo motor mechanism.

Next in the setup function, first, initialize the serial port for debugging to obtain the RFID number. Then initialize the SPI communication with the RFID module and set the servo pin number to drive the servo motor.

After this, create a loop function to read the RFID UUID number. Then convert the RFID UUID number to a string and check whether it matches with the correct UUID number. If yes, then the servo motor automatically gets activated for unlocking the door. 

- Advertisement -
RFID Contactless Lock Code
RFID Contactless Lock Code

Code for RFID Contactless Lock

RFID Contactless Lock Circuit Diagram

Connect the RFID with Arduino and servo/signal wire (yellow) to pin 9 (see pic).

Arduino Connected with RFID
Arduino Connected with RFID
Servo Motor interfacing circuit
Fig 4. Connection with servo

Testing 

DIY RFID Contactless Lock
RFID Contactless Lock

Power the Arduino and servo motor. Now try putting a random RFID card or tag into the lock. When nothing happens, then try with another. If that enables the servo motor to unlock the door, then it means you have entered the correct RFID tag.  

Congrats!! Your RFID smart lock is ready. 

Download Code

2 COMMENTS

SHARE YOUR THOUGHTS & COMMENTS

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators