
- Project Description: OTP-Based Door Lock System Using Raspberry Pi
- This project implements a secure door lock system using a Raspberry Pi 3 and various peripheral components, including an IR sensor, GSM 900A module, servo motor, 4×4 keypad, and I2C LCD. The system is designed to enhance security and convenience by using a One-Time Password (OTP) mechanism.
- System Workflow:
- IR Sensor Detection:
The system starts when the IR sensor detects the presence of a user standing in front of the door. - OTP Generation and Transmission:
Upon detection, the Raspberry Pi generates a unique 6-digit OTP and sends it to the user’s registered mobile number via the GSM 900A module. - User Input via Keypad:
The user is given 10 seconds to enter the received OTP using the 4×4 keypad. If the user fails to enter the OTP within this timeframe, a new OTP is generated and sent to the user’s mobile. - Validation:
- If the entered OTP matches the generated OTP, the system confirms successful authentication.
- The servo motor is activated to unlock the door.
- Simultaneously, the I2C LCD displays a success message, such as “Access Granted.”
- The door remains unlocked for a predefined time before the servo motor resets to lock the door again.
- Invalid OTP Handling:
- If the entered OTP is incorrect, the LCD displays a message like “Invalid OTP. Try Again.”
- The system remains locked and waits for another valid attempt.
- LCD Message Display:
The I2C LCD provides real-time updates to the user, such as:- “Welcome! Generating OTP…”
- “OTP Sent to Mobile.”
- “Enter OTP within 10 sec.”
- “Access Granted.”
- “Invalid OTP. Try Again.”
- Key Components:
- Raspberry Pi 3: Acts as the central controller, managing all components and handling logic.
- IR Sensor: Detects user presence to trigger the system.
- GSM 900A Module: Sends OTP to the user’s mobile phone via SMS.
- 4×4 Keypad: Allows the user to input the OTP for verification.
- Servo Motor: Controls the door’s lock mechanism.
- I2C LCD: Displays system messages and provides feedback to the user.
- Features:
- Time-Sensitive Security: The system ensures that OTPs expire after 10 seconds, adding an extra layer of security.
- Convenience: Real-time messages on the LCD guide the user through the process.
- Scalability: The system can be adapted for multiple users or integrated with additional sensors and modules for enhanced functionality.
- This project offers a robust solution for secure and automated door locking, making it ideal for home or office security applications.
Project Code:
- Download project code from below button.
- If you want to understand code explanations then please watch YouTube video.
Click here to download code
YouTube Video:
- If you want to understand how to connect hardware with Raspberry Pi,
- And Program explanation for this project,
- And how to do this project by yourself then please watch our YouTube video.
Purchase Readymade Project:
- If you want to purchase a readymade project from Mytrained.com then contact us on whatsapp.
- We do not encourage any student to purchase a readymade project from us. Our mission is to give complete knowledge free of cost.
- So from our end we already provide code and detailed steps to create this project by yourself in our YouTube video.
- So if you want to save your money then watch our video and follow the steps that are mentioned in the video.
- Once you purchase a project then it will take at least 1 month to design your project.
- You have to pay the complete project cost while placing the purchase order.
- no refund no exchange policy

Leave a Reply