Introduction:

In this project, we’ll explore how to build a secure door lock system using an Arduino, an RFID module, a servo motor, and an ultrasonic sensor. The system is designed to lock and unlock a door based on RFID card authentication while also detecting the presence of someone at the door using an ultrasonic sensor.

Hardware Components:

  1. Arduino Board
  2. Servo Motor
  3. MFRC522 RFID Module
  4. Ultrasonic Sensor (HC-SR04)
  5. LiquidCrystal I2C Display
  6. Jump wires
  7. Breadboard

SCHEMATICS:

Code Overview:

The Arduino code for this project integrates the functionality of RFID card authentication, servo motor control, and ultrasonic sensor distance measurement. Let’s break down the key components of the code:

RFID Card Authentication:

The system reads RFID card information using the MFRC522 library. When a card is presented, its unique identifier (UID) is compared to a predefined UID stored in the code. If the card matches and the door is currently locked, the servo motor unlocks the door, and vice versa.

Servo Motor Control:

A servo motor is used to physically lock and unlock the door. The servo angle is set to 70 degrees when the door is locked and 160 degrees when the door is unlocked. The servo motor is controlled using the Servo library.

Ultrasonic Sensor for Door Presence Detection:

An HC-SR04 ultrasonic sensor is employed to detect if someone is near the door. The sensor measures the distance, and if it’s less than 10 cm and the door has been closed for a specified duration (doorOpenDelay), the system displays a message on the LCD indicating that someone is at the door.

LCD Display:

A 16×2 I2C LCD is used to provide visual feedback to the user. It displays messages such as “Welcome!”, “Put your card”, “Door is locked”, “Door is open”, and “Someone at the door!”

CODE:

ADDITIONAL NOTE:

Libraries installed (Servo, Wire, SPI, MFRC522, LiquidCrystal_I2C, etc.).

VIDEO:

https://youtu.be/p-XgK6vMrNc?feature=shared

Conclusion:

This Arduino RFID door lock project combines RFID card authentication, servo motor control, and ultrasonic sensing to create a secure and interactive door lock system. The integration of these components provides both access control and the ability to detect potential visitors at the door. You can customize the project by adding more features, such as logging access attempts or integrating it with a home automation system.