Arduino Projects

OTP Based Door Lock Using Arduino And SIM800L


The OTP-Based Door Lock System is designed to enhance the security of doors by implementing a one-time password authentication mechanism. This project utilizes an Arduino Uno microcontroller along with various components such as an I2C 16×2 LCD, relay module, 4×4 keypad, and GSM SIM800L module. The system requires users to enter a unique OTP generated by the Arduino using the keypad, and upon successful authentication, the relay module activates, unlocking the door. Additionally, the GSM module can be employed to send notifications to the authorized user regarding access attempts.

In this article, we will guide you through the process of creating an OTP (One-Time Password) based door lock system using Arduino and various components like I2C 16×2 LCD, relay, 4×4 keypad, and GSM SIM800L module. The system will enhance the security of your doors by requiring a unique password each time someone wants to gain access. Let’s get started!

Components Needed

  1. Arduino Uno
  2. I2C 16×2 LCD module
  3. Relay module
  4. 4×4 keypad
  5. GSM SIM800L module
  6. Jumper wires
  7. Zero PCB
  8. 9V power supply

Arduino Uno

Arduino Uno is a popular microcontroller board that is part of the Arduino family. It is widely used in various electronic projects and prototyping due to its simplicity and versatility. Here’s an explanation of the Arduino Uno

Arduino UNO
  • The Arduino Uno is built around the Atmega328P microcontroller. This microcontroller has 32KB of flash memory, 2KB of SRAM, and 1KB of EEPROM. It operates at a clock speed of 16 MHz, providing enough processing power for most projects.
  • The Arduino Uno features a total of 14 digital input/output pins, marked as D0 to D13. These pins can be configured as either inputs or outputs, allowing you to connect various sensors, actuators, and other digital devices. Additionally, 6 of these pins (D3, D5, D6, D9, D10, and D11) also support Pulse Width Modulation (PWM), enabling you to generate analog-like outputs.
  • The board also includes 6 analog input pins (A0 to A5), which can measure voltage levels ranging from 0 to 5 volts. These pins are useful for interfacing with analog sensors or reading variable inputs.

16×2 LCD Module With I2C

A 16×2 LCD display refers to a liquid crystal display with two rows and 16 characters per row. It is a commonly used alphanumeric display in many electronic projects and devices. The I2C (Inter-Integrated Circuit) interface is a communication protocol that allows for easy and efficient communication between microcontrollers and peripheral devices.


  • When an LCD display is connected using the I2C interface, it typically requires fewer pins compared to a direct parallel connection, making it more convenient for projects with limited available pins on the microcontroller.
  • I2C Interface: The I2C interface uses a master-slave communication protocol. The microcontroller acts as the master and the LCD display module as the slave. The I2C interface allows for multiple devices to be connected on the same bus, each with a unique address.
  • I2C Address: The LCD display module with an I2C interface has a specific address that is set by the manufacturer. This address can usually be found in the documentation or can be identified using an I2C scanner program.

Relay module

A relay module is an integrated circuit board that incorporates a relay and additional components for easy integration into electronic projects. It provides a convenient way to control higher voltage or current loads using a lower voltage signal, such as the output from a microcontroller or Arduino.

Smart Bike Helmet With Accident Alert System9

The relay itself is the primary component of the module. It consists of an electromagnet and a set of contacts. The contacts can be normally open (NO), normally closed (NC), or both, depending on the relay type. When the coil of the relay is energized, the contacts change their state.

4×4 keypad

A 4×4 keypad, also known as a matrix keypad, is a commonly used input device that provides a convenient interface for entering numerical or alphanumeric data. It consists of a grid of buttons arranged in a 4 by 4 configuration, where each button represents a specific input.


  • A 4×4 keypad consists of 16 buttons arranged in a grid of four rows and four columns. Each button is a separate switch that can be pressed or released to generate a specific input. The buttons are usually made of conductive material and have a spring mechanism for tactile feedback.
  • The buttons in a 4×4 keypad are connected in a matrix configuration. The rows of buttons (R1 to R4) and columns of buttons (C1 to C4) are connected to the input/output pins of a microcontroller or a keypad scanning circuit. The rows and columns are typically connected using a combination of pull-up or pull-down resistors and GPIO pins.
  • To detect which button is pressed, the microcontroller or scanning circuit uses a technique called matrix scanning. It scans the rows and columns of the keypad one by one and determines the active button based on the intersection of the pressed row and column. This allows multiple keys to be read using a limited number of input/output pins.

GSM SIM800L module

GSM SIM800L is a popular module that enables communication over GSM (Global System for Mobile Communications) networks. It provides functionalities for making calls, sending and receiving SMS messages, and connecting to the internet.

GSM Sim800l
  • The GSM SIM800L module is designed to work with GSM networks, allowing devices to establish communication through cellular networks. It operates on various frequencies and supports 2G,3G connectivity, making it compatible with most GSM networks worldwide.
  • The module requires a power supply of around 3.7 to 4.2 volts. It can be powered using an external power source, such as a battery or a regulated power supply. It is important to ensure a stable power supply to ensure reliable operation.
  • The module communicates with other devices, such as microcontrollers or computers, using serial communication. It typically utilizes UART (Universal Asynchronous Receiver-Transmitter) protocol, enabling devices to send and receive commands and data through serial communication.

Circuit Diagram

  • Connect the I2C 16×2 LCD module to the Arduino using the SDA(A4) and SCL(A5) pins.
  • Connect the relay module to the Arduino’s digital pin 4, which will control the door lock mechanism.
  • Connect the 4×4 keypad to the Arduino using digital pins (13,12,11,10,9,8,7,6) for both row and column connections.
  • Connect the GSM SIM800L module to the Arduino’s serial pins (3 and 2) and power it using a separate power supply.
  • Connect the IR Sensor module to the Arduino’s Analog pins A0.

circuit diagram 8




Arduino Based Projects


By following this guide, you have successfully built an OTP-based door lock system using Arduino, an I2C 16×2 LCD, a relay module, a 4×4 keypad, and a GSM SIM800L module. This system provides an additional layer of security to your doors, ensuring that only authorized individuals with the correct OTP can gain access. Feel free to customize and expand upon this project to suit your specific requirements.


Hi, Prateek Here I’m interested in Electronics That's why I Make Soo Many Projects, I’m currently Pursuing M Tech.. if you Relay Like To My Blog Plz Comment Below...Thanks To All Electronics Lover...❤️

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button