Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
48 views93 pages

Major Project Report Format

The document presents a project report on a digital door locking system using Arduino Uno, submitted for a Bachelor of Technology degree in Electronics and Communication Engineering. It details the system's components, including a keypad for password entry, an LCD for status display, and a servo motor for locking and unlocking the door. The project aims to enhance security by providing a password-based access control mechanism, replacing traditional locks with a more secure electronic solution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views93 pages

Major Project Report Format

The document presents a project report on a digital door locking system using Arduino Uno, submitted for a Bachelor of Technology degree in Electronics and Communication Engineering. It details the system's components, including a keypad for password entry, an LCD for status display, and a servo motor for locking and unlocking the door. The project aims to enhance security by providing a password-based access control mechanism, replacing traditional locks with a more secure electronic solution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 93

Digital Door Locking Using Arduino Uno

MAJOR PROJECT – II
Report
Submitted in partial fulfillment of the requirement for the award of

Degree of

BACHELOR OF TECHNOLOGY
In
ELECTRONICS AND COMMUNICATION ENGINEERING
JAN-JUNE 2025
Submitted to

Rajiv Gandhi Proudyogiki Vishwavidhyalaya, Bhopal

Guided By: - Submitted By:-


Mr. Deepak sharma Omprakash Mishra(0829EC211018)
(Assi. Prof. ECE Dept.) Vikas Jha (0829EC211030)
Mohd Ezaz (0829EC211017)
Sachin Rathore(0829EC211023)

Department of Electronics and Communication Engineering


Sushila Devi Bansal College of Technology, Indore (M.P.)
Sushila Devi Bansal College of Technology Indore

Session:Jan-June-2025

Recommendation

The Project report entitled “Digital lock using Arduino Uno” submitted by ‘Omprakash Mishra
(0829EC211018), Mohd Ezaz (0829EC211017), Vikas Jha (0829EC201030) and Sachin Rathore
(0829EC211023), towards the partial fulfilment of degree of Bachelor of Engineering in Electronics
and Communication Engineering of Rajiv Gandhi Proudyogiki Vishwavidyalaya, Bhopal is
satisfactory account of the progress made by them in project work.

Guided By Head of Department

Mr.Deepak sharma Dr.Neelam Sharma


(Assi. Prof. ECE Dept.)

I
Sushila Devi Bansal College of Technology, Indore

Certificate
This is to certify that Major Project-II entitled “Digital lock using Arduino Uno” is submitted to
Rajiv Gandhi Proudyogiki Vishwavidhyalaya, Bhopal (M.P.), to the faculty of Engineering by
Omprakash Mishra (0829EC211018), Mohd Ezaz (0829EC211017), Vikas Jha (0829EC201030)
and Sachin Rathore (0829EC211023) Session: Jan-June-2025 in the partial fulfillment of the
requirement of the award of the Degree of Bachelor of Technology in Electronics and
Communication Engineering. The matter embodied is the actual work by Omprakash Mishra,
Mohd Ezaz, Vikas Jha and Sachin Rahore.

Internal Examiner External Examiner


Date - Date

II
Declaration

We Omprakash Mishra (0829EC201118), Mohd Ezaz (0829EC211017), Vikas Jha


(0829EC211030), and Sachin Rathore (0829EC211023) the student of Bachelor of Technology
in Electronics and Communication Engineering, Session: 2024-25, Sushila Devi Bansal College
of Technology, Indore(M.P.), hereby declare that the work presented in this project entitled
“Digital Lock Using Arduino Uno”is the outcome of our own work, is bonafide and correct to the
best of our knowledge and this workhas been carried out taking care of Engineering Ethics.

Omprakash Mishra (0829EC211018)

Vikasg Jha (0829EC211030)

Mohd Ezaz (0829EC211017)

Sachin Rathore (0829EC211023)

III
Acknowledgement

First of all, we are thankful to almighty God who has given me the strength and courage to work on
my project. Our special thanks to Dr. P.S. Chauhan, Director, Sushila Devi Bansal College of
Technology, Indore (M.P.) for his Support and guidance. We would like thank to Dr. Neelam
Sharma, Head of Department for support in the development of the project. It has been a pleasure to
work with them. We would like to thank our supervisor Deepak Sharma for their continuos
technical support. We would like to thank Mr. Yogesh Gupta for their guidance. Presence of all of
them has provided an invaluable influence on our career and outlook for the future.

Omprakash Mishra (0829EC211018)

Vikas Jha (0829EC211030)

Mohd Ezaz (0829EC211017)

Sachin Rathore (0829EC211023)

IV
Table of contents

S. No. Content Page no.

1 Recommendation I

2 Certificate II

3 Declaration III

4 Acknowledgement IV

5 Table of contents V-VI

6 Abstract VII

7 List of figures VIII

8 List of tables IX

9 Chapter 1. Introduction 11
1.1 11
1.2 12
1.3 13
10 Chapter 2. System Model 15
2.1 Block diagram 16
2.2 Circuit diagram 17
2.2.1 17
2.2.2 18
2.3 PCB Layout 20
2.3.1 20
2.3.2 21
2.3.3 21

11 Chapter 3. Description and Working of Circuit 23


3.1 23
3.2 23
3.2.1 25
3.2.1.1 26
V
12 Chapter 4. Hardware Description 27
4.1 27
4.2 42
4.2.1 44
4.2.2 46
13 Chapter 5. Software description 48
5.1 48
5.2 52
5.2.1 54
5.2.2 56
14 Chapter 6. Applications 75
6.1 75
6.2 77
6.3 79
15 Chapter 7. Conclusion & Future Scope 81
7.1 Conclusion 81
7.2 Future Scope 83
16 Reference 86

17 DATA Sheets 89

VI
Abstract

Every individual needs to feel secure in their daily lives. In our security pattern,
access control for doors plays an essential role. Password-based door lock systems
allow authorized persons to access restricted areas. Conventional locks are not as
secure as they once were; anyone can break in if they break these locks. We need
a framework that provides 24/7 benefit. It is controlled by an Arduino. The
password is entered using a keypad. The entered password is compared with the
known password when setting a combination password and by using 1-6 digits. A
correct password opens the door and displays the status on the LCD. If the
password is wrong, the door remains closed and states "WRONG PASSWORD"
on LCD. The buzzer will also activate when password is entered incorrectly an
indefinite number of times. By replacing mechanical door locks with electronic
door locks, the security door locking system promises to make a bold step for the
future. Security is a major concern in both residential and commercial spaces.
Traditional key-based locks are susceptible to theft, duplication, and loss. To
enhance security, this project presents a door locking system using a keypad and
Arduino Uno, which allows access through a password-based authentication
mechanism. The system primarily consists of an Arduino Uno microcontroller, a
4x4 matrix keypad, a servo motor, and an LCD display. When a user enters a
predefined password on the keypad, the Arduino verifies it. If the input matches
the stored password, the system activates the servo motor, which unlocks the
door. If the wrong password is entered multiple times, the system can trigger an
alert, such as an LED indicator or a buzzer, to notify unauthorized access
attempts. The Arduino Uno acts as the central processing unit, handling input
from the keypad and controlling the locking mechanism. The 4x4 matrix keypad
allows users to input the password, while the LCD display provides real-time
feedback, such as "Enter Password," "Access Granted," or "Access Denied."
The servo motor is used as an electromechanical lock that rotates to open or lock
the door. This system offers several advantages over traditional locks, including
enhanced security, ease of use, and the ability to change passwords without the
need for physical key replacement. The implementation is cost-effective and can
be integrated with other security features, such as RFID or biometric scanners,
for additional protection. Potential applications include homes, offices, and
restricted areas where controlled access is required. Additionally, the system can
be extended by adding IoT functionality for remote access and monitoring. In
conclusion, this Arduino-based keypad door locking system provides a reliable
and user-friendly solution to security challenges. It eliminates the risks associated
with physical keys and offers a simple yet effective way to control access to secure
areas.

VII
List of figures

Fig. No. Name of figure Page no.

Fig. 1.1 Basic Prototype of Digital Lock using Arduino 11


Uno
Fig. 1.2 Basic of Digital Lock using Arduino Uno 12

Fig. 1.3 Preference of Digital Lock using Arduino Uno 14

Fig. 2.1 Block Digram of System Model 16

Fig. 2.2 Circuit Digram of System Model 17

Fig. 2.3 PCB Layout 20

Fig. 4.1(1) Arduino Uno Board 29

Fig. 4.1(1) Servo Motor 33

Fig. 4.1(3) Key Pad 4X4 35

Fig. 4.1(4) I2C Module 37

Fig. 4.1(5) 16 x 2 LCD Display 39

Fig. 4.1(6) Jumper Wire 40

Fig. 4.1(7) Piezo Buzzer 42

Fig. 4.2 Circuit Digrame 43

Fig. 4.2.1 Flowchart 45

Fig. 5.1(1) Arduino IDE Software 49

Fig. 5.1(2) Ki Cad Software 52

VIII
List of tables

Table. No. Name of Table Page no.


Table. 4.1 Pins and Function of Arduino Uno 30
Table. 4.1 Specification of Arduino Uno 31
Chapter 1
Introduction

1.1 Introduction

Security is a means of defending against threats and assuring one's safety. Security has always been
a big concern in areas like homes, businesses, institutions, laboratories, and so on, to keep our
resources secure and prevent illegal access to them. In the past, there were fewer security
procedures in place to prevent unwanted access. For such sites and apps, a variety of security
methods have been implemented in recent years. Password-protected systems, RFID card
technologies, biometric-protected systems, OTP-based, cryptography-based, and other security
solutions are currently available. Each system has its own set of applications. As the number of
thieves rises every day, security becomes a risk. As a result, a digital code lock can easily safeguard
your home or locker. It will only unlock your door if you input the correct password. The ARDUINO
UNO is used to create a password-based door lock system, in which the door is unlocked, and the
concerned individual is granted entry to the secured area after the correct code or password is
entered. The Password Based Door Lock System with Arduino UNO is a simple project that uses a
secure password to unlock the door. The door is unlocked, and the concerned individual is permitted
entrance to the secured area once the correct code or password is entered using an Arduino UNO. It
will prompt you to input the password again if another person arrives.

Figure: 1.1. Basic prototype of Digital Lock using Arduino Uno

11
If the password is incorrect, the door will remain locked, preventing the individual from entering.
The main concept behind this project is to open a door using a keypad and a password. When the
passcode is entered incorrectly multiple times, the Buzzer will get trigger. Using a keypad, the user
can customize this password at any moment. The Arduino UNO is the main component in the circuit,
and it is utilized to send a text message to the home's owner informing them of the security breach.
Passwords are inputted by using a 4*4 keypad. The entered password is compared to the password
that has already been input. If the password is right, the system uses a servo motor to open the door
and displays the door's status on the LCD. If the password is incorrect, the door will remain shut, and
the LCD will read "Incorrect Password" and “Door is close” Security is a means of defending against
threats and assuring one's safety. Security has always been a big concern in areas like homes,
businesses, institutions, laboratories, and so on, to keep our resources secure and prevent illegal
access to them. In the past, there were fewer security procedures in place to prevent unwanted access.
For such sites and apps, a variety of security methods have been implemented in recent years.
Password-protected systems, RFID card technologies, biometric-protected systems, OTP-based,
cryptography-based, and other security solutions are currently available. Each system has its own set
of applications. As the number of thieves rises every day, security becomes a risk. As a result, a
digital code lock can easily safeguard your home or locker. It will only unlock your door if you input
the correct password.

Figure: 1.2. Basic of Digital Lock using Arduino Uno

12
The ARDUINO UNO is used to create a password-based door lock system, in which the door is
unlocked, and the concerned individual is granted entry to the secured area after the correct code or
password is entered. The Password Based Door Lock System with Arduino UNO is a simple project
that uses a secure password to unlock the door. The door is unlocked, and the concerned individual is
permitted entrance to the secured area once the correct code or password is entered using an Arduino
UNO. It will prompt you to input the password again if another person arrives. If the password is
incorrect, the door will remain locked, preventing the individual from entering. The main concept
behind this project is to The Arduino UNO is the main component in the circuit, and it is utilized to
send a text message to the home's owner informing them of the security breach. Passwords are
inputted by using a 4*4 keypad. The entered password is compared to the password that has already
been input. If the password is right, the system uses a servo motor to open the door and displays the
door's status on the LCD. If the password is incorrect, the door will remain shut, and the LCD will
read "Incorrect Password" and “Door is close”.

The aim of this project is to provide the security. Now a days security system is must for every
organization. Access control system is one system that is used for security purpose in many
organizations. The main aim of this project is to provide access only if the password of particular
user is matched. So, that access is denied to unauthorized persons.These kinds of doors with secret
code locking systems are quite useful for the security purposes. Many departments like Defense,
military areas, Research centers, bank security and security for important documents Industries, go-
downs, etc, can adopt this type where high level security is essential. The same system can be used
even at domestic side also; the main advantage of this system is that only authorized persons can
operate this door. This system has intelligence of allowing only valid password.

1.3 Preference of Digital Lock Using Arduino Uno

A digital lock using an Arduino Uno, especially with a keypad or fingerprint sensor, offers a
secure and convenient alternative to traditional keys, allowing for password or biometric
authentication for door access.
Here's a breakdown of the benefits and considerations:

Key Features and Benefits:

Security:
Password-based: Keypad-based locks allow users to enter a PIN code for access, offering a
level of security against lost or stolen keys.
Biometric (Fingerprint): Fingerprint sensors provide a more unique and secure method of
authentication, making it harder for unauthorized individuals to gain access.
Convenience:
No Keys Required: Eliminates the need for carrying and potentially losing keys.
Customizable Access: Allows for multiple users with different access permissions, or
temporary access codes.

13
Figure: 1.3. Preference of Digital Lock using Arduino Uno

Versatility:

Expandability: The Arduino platform allows for easy integration of other sensors and modules
for added features, such as remote control, alerts, or integration with other smart home systems.
Cost-Effective: Arduino Uno and related components are relatively affordable, making this a
budget-friendly option for building a digital lock system.

Implementation Considerations:

Components:
Arduino Uno: The microcontroller that controls the entire system.
Keypad: For password entry.
Fingerprint Sensor: For biometric authentication.
Servo Motor or Solenoid: To physically lock and unlock the door.
Power Supply: To power the Arduino and other components.
Buzzer or LED: For feedback to the user (e.g., successful or unsuccessful authentication).

Software:

Arduino IDE: Used to write the code that controls the lock's functionality.
Password Storage: Passwords can be stored in the Arduino's EEPROM or a more secure
method, depending on the desired security level.

14
Chapter 2
System Model

A system model of a digital lock using an Arduino Uno typically includes the following
components:

1. System Components
Microcontroller: Arduino Uno
Input Devices: Keypad (4x4 or 4x3), RFID module, or biometric sensor
Processing Unit: Arduino Uno processes the input and verifies the password
Output Devices: LCD display (16x2) for user feedback, LEDs, or buzzer
Lock Mechanism: Servo motor, solenoid lock, or relay module to control the door lock
Power Supply: USB or external power adapter

2. Functional Model
Step 1: Input Stage
The user enters a passcode via the keypad or scans an RFID tag.
The input is read by Arduino and stored in a variable.

Step 2: Processing Stage


The Arduino checks the input against a predefined password or stored RFID data.
If the input matches, access is granted; otherwise, access is denied.

Step 3: Output Stage


If the input is correct, the Arduino:
Activates the servo motor to unlock the door.
Displays a success message on the LCD.
Turns on a green LED or plays a success sound on the buzzer.
If the input is incorrect:
A red LED lights up.
The buzzer sounds an alarm.
The LCD displays an "Access Denied" message.

15
2.1 Block diagram

Figure: 2.1. Block Digram System Model

Key Components & Their Functions

1. Keypad (4x3 or 4x4) → User enters password.

2. Arduino Uno → Processes input and verifies password.

3. LCD Display (16x2) → Displays status messages like "Enter Password" or "Access Denied".

4. Decision Logic:

If the password is correct → Unlocks the door.

If incorrect → Triggers a buzzer alarm and LED warning.

5. Servo Motor or Solenoid Lock → Controls door locking/unlocking.

6. Buzzer → Alerts when incorrect password is entered.

7. Power Supply (5V) → Powers all components.

16
2.2 Circuit Digram

Figure: 2.2 Circuit Digram of System Model

2.2.1 Components Required:

Here’s a circuit diagram for a door lock system using a keypad and Arduino Uno:

Components Required:

1. Arduino Uno – Main microcontroller

2. 4x4 Keypad – For password input

17
3. 16x2 LCD Display (optional) – For displaying messages

4. Servo Motor – To control the door lock

5. Buzzer – To indicate incorrect password entry

6. LEDs (Red & Green) – Status indicators

7. Resistors (220Ω for LEDs)

8. Power Supply (5V from Arduino)

9. Wires & Breadboard – For connections

2.2.2 Circuit Connections:


1. Keypad Connection: Connect the keypad to the Arduino board. The keypad has 4 rows and 3 or 4

columns, connect them to digital pins 1-7 of the Arduino board ¹.

2. LCD Connection: Connect the 16x2 LCD display to the Arduino board. Connect the LCD pins to

analog pins A0-A5 of the Arduino board ¹.

3. Servo Motor Connection: Connect the servo motor to digital pin 9 of the Arduino board. Also,

connect the servo motor to a 5V power supply ¹.

4. Buzzer Connection: Connect the buzzer to digital pin 20 of the Arduino board ².

5. LED Connection: Connect the red and green LEDs to digital pins 9 and 8 of the Arduino board

respectively [2).

18
Circuit Diagram:

Here's a brief description of the circuit diagram:

- The Arduino board is the brain of the system.


- The keypad is connected to the Arduino board to input the password.
- The LCD display shows the status of the door lock system.
- The servo motor controls the door lock mechanism.
- The buzzer and LEDs provide feedback to the user.

19
2.3 PCB Layout

Figure: 3.1 PCB Layout of System Model

2.3.1 PCB Layout

Designing a PCB layout for a digital lock keypad using an Arduino Uno involves integrating
components like a 4x4 matrix keypad, an Arduino Uno, and a relay or solenoid lock. Below is a
general approach:

Components Required:

1. Arduino Uno

2. 4x4 Keypad (or 3x4 Keypad)

3. Relay Module (5V)

20
4. Solenoid Lock

5. Buzzer (optional)

6. LEDs (optional)

7. Resistors (e.g., 1kΩ for LEDs)

8. Power Supply (9V–12V DC for solenoid, or USB for Arduino)

9. PCB Board and Copper Traces

2.3.2 PCB Layout Consideration:


1.PCB Layout Considerations:

Keypad Connection: The 4x4 keypad has 8 pins (4 for rows, 4 for columns). These connect to digital
input pins on the Arduino.

Relay Module: The relay controls the solenoid lock. The control pin connects to an Arduino digital
output.

Power Traces: Ensure sufficient copper thickness for power lines, especially for the solenoid.

Ground Planes: Use a solid ground plane to reduce noise and improve stability.

Component Placement: Keep Arduino and relay module close to minimize signal interference.

2. PCB Design Considerations


a) Board Size and Shape

If using an Arduino Uno directly, you can create a shield-style PCB that stacks on top of the Uno.

If embedding the ATmega328P (Arduino’s microcontroller), you can make a compact, standalone
PCB.

21
b) Layer Selection

A single-layer PCB is sufficient for a simple circuit.

A double-layer PCB is better for a more compact layout with better power distribution.

c) Trace Width & Clearance

Power traces (for solenoid and relay): 1.5mm – 2mm width.

Signal traces (keypad and control signals): 0.3mm – 0.5mm width.

d) Ground & Power Planes

Use a solid ground plane to reduce interference and improve circuit stability.

22
Chapter 3
Description and working of Circuit

3.1 Description and working of Circuit

A lock door keypad using an Arduino Uno is an electronic security system that enables access
control through a numeric keypad. The user must enter a predefined password, and if the entry is
correct, the system unlocks the door via a relay-controlled solenoid lock.

---

3.1 Description of Lock Door Keypad System

1. Overview

The system consists of an Arduino Uno, a 4x4 or 3x4 keypad, a relay module, and a solenoid lock.

The user inputs a passcode via the keypad.

If the password is correct, the relay activates the lock, allowing access.

If the password is incorrect, the system denies access and may trigger a buzzer.

The system automatically relocks after a set time.

2. Key Components

3.2 Circuit Diagram and Connections

1. Keypad to Arduino

Connect keypad row pins to D2–D5 on the Arduino.

Connect keypad column pins to D6–D9 on the Arduino.

23
2. Relay Module to Arduino

Relay IN → D10 (Arduino Digital Output)

Relay VCC → 5V (Arduino)

Relay GND → GND (Arduino)

3. Solenoid Lock to Relay

Lock Positive → Relay NO (Normally Open) Terminal

Lock Negative → Power Supply GND

Relay COM (Common) → Power Supply Positive (12V)

4. Optional Components

Buzzer → D11 (for incorrect password alert)

Green LED (Access Granted) → D12

Red LED (Access Denied) → D13

24
3.2.1 Working Principle

Step 1: System Initialization

When powered on, the Arduino initializes the keypad, relay, and optional buzzer/LEDs.

An LCD (if used) displays "Enter Password".

Step 2: User Enters Password

The user presses keys on the keypad.

Arduino reads the keypresses and stores them in memory.

Step 3: Password Verification

Arduino compares the entered code with the predefined password.

If the password is correct:

Arduino sends a HIGH signal to the relay, activating the lock.

Green LED turns on (optional).

The door unlocks for 5 seconds.

If the password is incorrect:

The buzzer beeps and the red LED turns on.

The system resets for another attempt.

Optional: After 3 incorrect attempts, the system locks for 30 seconds.

25
Step 4: Auto-Locking

After 5 seconds, Arduino turns off the relay, locking the door again.

The system resets, waiting for a new input.

3.2.1.1 Features and Applications

1. Features

✔ Secure Access – Only authorized users can unlock the door.


✔ Auto-Locking – Ensures security after entry.
✔ Multiple Attempt Handling – Prevents brute force attacks.
✔ Buzzer & LED Alerts – Feedback for success or failure.
✔ Expandable – Can integrate RFID, Bluetooth, or Wi-Fi for added security.

2. Applications

Home & Office Smart Locks

Locker & Cabinet Security

ATM & Safe Vaults

Secure Rooms & Lab Access

26
Chapter 4
Hardware Description

4.1 Components Required:

1. Arduino uno board

2. Servo Motor

3. 4x4 Keypad

4. I2C Module

5. 16x2 LCD Display

6. Jumper Wires

7. Piezo Buzzer

1. Arduino uno board:

Arduino Uno is a microcontroller board based on the ATmega328P microcontroller. It is a


popular and widely used board in the Arduino family, known for its ease of use, flexibility,
and versatility.

# Key Features:
1. Microcontroller: ATmega328P, 8-bit, 16 MHz.
2. Memory: 32 KB Flash, 2 KB SRAM, 1 KB EEPROM.
3. Digital I/O Pins: 14 (6 PWM outputs).
4. Analog Input Pins: 6.
5. Communication: USB, Serial, SPI, I2C.
6. Power: 5V, 3.3V, and 9V input options.

27
# Characteristics:
1. Open-Source: Arduino Uno is an open-source hardware and software platform.
2. Easy to Use: Designed for beginners and experts alike, with a simple and intuitive interface.
3. Versatile: Can be used for a wide range of applications, from simple projects to complex
robotics and automation.
4. Community Support: Large and active community, with many resources and libraries
available.

# Applications:
1. Robotics: Arduino Uno is widely used in robotics, from simple line followers to complex
autonomous robots.
2. Automation: Used in automation projects, such as home automation, industrial automation,
and more.
3. IoT: Used in Internet of Things (IoT) projects, such as sensor networks and smart devices.
4. Education: Popular teaching platform for programming and electronics.
5. Prototyping: Used for rapid prototyping and proof-of-concept development.

# Advantages:
1. Low Cost: Arduino Uno is an affordable board, making it accessible to hobbyists and students.
2. Easy to Learn: Simple and intuitive interface makes it easy to learn and use.
3. Large Community: Active community provides many resources, libraries, and support.

# Disadvantages:
1. Limited Processing Power: ATmega328P microcontroller has limited processing power
compared to more modern microcontrollers.
2. Limited Memory: 32 KB Flash and 2 KB SRAM may be limiting for complex projects.
3. No Built-in Wi-Fi or Bluetooth: Requires additional modules for wireless connectivity.

28
Figure: 4.1(1) Arduino Uno Board

29
Pins and Function of Ardino Uno:-

Figure: 4.1(1) Pins and Function of Ardino Uno

30
Specification of Arduino uno

Figure: 4.1(1) Specification of Ardino Uno

2. Servo Motor:
A servo motor is a type of motor that uses a control circuit to precisely control its rotation
or position. Servo motors are widely used in robotics, automation, and other
applications where precise control is required.

# Key Characteristics:

1. Precise Control: Servo motors can be controlled to rotate to a specific position or speed.
2. Feedback Mechanism: Servo motors use a feedback mechanism, such as an encoder or
potentiometer, to monitor their position and adjust their rotation accordingly.
3. High Torque: Servo motors can produce high torque, making them suitable for applications
that require precise control and high power.

31
# Types of Servo Motors:

1. DC Servo Motors: Use a DC power source and are commonly used in robotics and automation.
2. AC Servo Motors: Use an AC power source and are commonly used in industrial applications.
3. Stepper Servo Motors: Use a stepper motor and are commonly used in applications that require
precise positioning.

# Applications:

1. Robotics: Servo motors are widely used in robotics to control the movement of robots.
2. Automation: Servo motors are used in automation to control the movement of machines and
equipment.
3. CNC Machines: Servo motors are used in CNC machines to control the movement of cutting
tools.
4. Camera Systems: Servo motors are used in camera systems to control the movement of
cameras.

# Advantages:

1. High Precision: Servo motors offer high precision and accuracy.


2. High Torque: Servo motors can produce high torque, making them suitable for applications
that require high power.
3. Flexibility: Servo motors can be used in a wide range of applications.

# Disadvantages:

1. Complexity: Servo motors can be complex and require sophisticated control systems.

2. Cost: Servo motors can be more expensive than other types of motors.

3. Maintenance: Servo motors require regular maintenance to ensure optimal performance.

32
Figure: 4.1(2) Servo Motor

3. 4x4 Keypad

keypad door lock system using Arduino Uno, 3.1, 3.2, or 3.3 versions involves a microcontroller
(Arduino), a keypad for password input, a servo motor or solenoid to control the lock, and
optionally an LCD display for feedback.

Here's a breakdown of the hardware components:


1. Arduino Uno (Version 3.1, 3.2, or 3.3):
Function: The central processing unit (CPU) that controls the entire system.
Key Features:
Microcontroller based on the ATmega328P
14 digital input/output pins (6 can be PWM outputs)
6 analog inputs
USB connection for programming and power
Power jack for external power supply
Reset button
Purpose: Reads keypad input, compares it with the stored password, and controls the
servo/solenoid to lock/unlock the door.

33
2. Keypad:

Type: Typically a 4x4 or 3x4 matrix keypad.

Function: Allows users to enter a password or code to unlock the door.

Purpose: Provides a user interface for password input.

3. Servo Motor or Solenoid:

Function: Physically locks and unlocks the door mechanism.

Servo Motor:

Provides precise control over the locking mechanism.

Can be used to push or pull a latch.

Solenoid:

A simpler locking mechanism using an electromagnet.

Requires a relay or transistor to control the current flow.

Purpose: Executes the locking/unlocking action based on the Arduino's instructions.

4. LCD Display (Optional):

Type: 16x2 or similar LCD display.

Function: Provides visual feedback to the user, such as "Access Granted" or "Access Denied".

Purpose: Enhances user experience and provides status information.

5. Other Components:

Breadboard and Jumper Wires: For prototyping and connecting components.

Power Supply: Typically 5V DC for the Arduino Uno and servo motor.

Push Button (Optional): For opening the lock from inside.

Debounce Resistor (Optional): To prevent erratic button readings.


Relay or MOSFET (If using a solenoid): To switch the higher voltage required for the solenoid.

34
Figure: 4.1(3) Keypad 4x4

4. I2C Module

I2C (Inter-Integrated Circuit) is a communication protocol used to connect multiple devices


together using a single, shared bus. An I2C module is a hardware or software component that
implements the I2C protocol, allowing devices to communicate with each other.

# Key Features:
1. Master-Slave Architecture: I2C uses a master-slave architecture, where one device (the master)
controls the bus and other devices (slaves) respond to the master's commands.

2. Shared Bus: I2C uses a shared bus, which allows multiple devices to be connected to the same
bus.

3. Addressing: Each device on the bus has a unique address, which is used to identify the device
and send data to it.

4. Data Transfer: I2C uses a serial data transfer protocol, where data is transferred one bit at a
time.

35
# Applications:
1. Microcontrollers: I2C is commonly used in microcontrollers to connect peripherals, such as
sensors, actuators, and memory devices.

2. Sensors: I2C is used in sensors, such as temperature, humidity, and pressure sensors, to
communicate with microcontrollers.

3. Actuators: I2C is used in actuators, such as motors and LEDs, to control their operation.

4. Memory Devices: I2C is used in memory devices, such as EEPROMs and FRAMs, to store
and retrieve data.

# Advantages:
1. Low Power Consumption: I2C is a low-power protocol, making it suitable for battery-powered
devices.

2. Simple Implementation: I2C is a relatively simple protocol to implement, making it easy to use
in a wide range of applications.

3. Flexible: I2C is a flexible protocol, allowing devices to be connected and disconnected from
the bus as needed.

# Disadvantages:
1. Limited Speed: I2C is a relatively slow protocol, with a maximum speed of 400 kHz.

2. Limited Distance: I2C is limited to short distances, typically up to 10 meters.

3. Noise Susceptibility: I2C is susceptible to noise, which can cause errors and data corruption.

# Common I2C Modules:


1. I2C EEPROM: A type of non-volatile memory that uses the I2C protocol to store and retrieve
data.

2. I2C Temperature Sensor: A type of temperature sensor that uses the I2C protocol to
communicate with microcontrollers.

3. I2C LCD Display: A type of LCD display that uses the I2C protocol to communicate with
microcontrollers.

4. I2C Motor Driver: A type of motor driver that uses the I2C protocol to control motors.

36
36

Figure: 4.1(4) I2C Module

5. 16x2 LCD Display

Arduino Uno is a microcontroller board based on the ATmega328P microcontroller. It is a


popular and widely used board in the Arduino family, known for its ease of use, flexibility,
and versatility.

# Key Features:
1. Microcontroller: ATmega328P, 8-bit, 16 MHz.

2. Memory: 32 KB Flash, 2 KB SRAM, 1 KB EEPROM.

3. Digital I/O Pins: 14 (6 PWM outputs).

4. Analog Input Pins: 6.

5. Communication: USB, Serial, SPI, I2C.

6. Power: 5V, 3.3V, and 9V input options.

# Characteristics:
1. Open-Source: Arduino Uno is an open-source hardware and software platform.

2. Easy to Use: Designed for beginners and experts alike, with a simple and intuitive interface.

3. Versatile: Can be used for a wide range of applications, from simple projects to complex
robotics and automation.

4. Community Support: Large and active community, with many resources and libraries
available.
37
# Applications:
1. Robotics: Arduino Uno is widely used in robotics, from simple line followers to complex
autonomous robots.

2. Automation: Used in automation projects, such as home automation, industrial automation,


and more.

3. IoT: Used in Internet of Things (IoT) projects, such as sensor networks and smart devices.

4. Education: Popular teaching platform for programming and electronics.

5. Prototyping: Used for rapid prototyping and proof-of-concept development.

# Advantages:
1. Low Cost: Arduino Uno is an affordable board, making it accessible to hobbyists and students.

2. Easy to Learn: Simple and intuitive interface makes it easy to learn and use.

3. Large Community: Active community provides many resources, libraries, and support.

# Disadvantages:
1. Limited Processing Power: ATmega328P microcontroller has limited processing power
compared to more modern microcontrollers.

2. Limited Memory: 32 KB Flash and 2 KB SRAM may be limiting for complex projects.

3. No Built-in Wi-Fi or Bluetooth: Requires additional modules for wireless connectivity

38
Figure: 4.1(5) LCD Display 16X2

6. Jumper Wires

A jumper wire is a type of electrical wire used to connect two or more points on a circuit board,
breadboard, or other electronic device. Jumper wires are typically used to:

# Types of Jumper Wires:

1. Male-to-Male (M-M): Connects two male headers or pins.


2. Male-to-Female (M-F): Connects a male header or pin to a female header or socket.
3. Female-to-Female (F-F): Connects two female headers or sockets.

# Characteristics:

1. Insulated: Jumper wires are typically insulated with a plastic or rubber coating to prevent electrical
shock or short circuits.
2. Flexible: Jumper wires are often flexible, making them easy to bend and route around other
components.
3. Color-Coded: Jumper wires may be color-coded to indicate their purpose or function.

# Uses:

1. Prototyping: Jumper wires are often used in prototyping to quickly connect and disconnect
39
components.
2. Debugging: Jumper wires can be used to debug circuits by temporarily connecting or
disconnecting components.
3. Repair: Jumper wires can be used to repair damaged or broken circuits.
4. Education: Jumper wires are often used in educational settings to teach electronics and circuit
design.

# Advantages:

1. Convenient: Jumper wires provide a convenient way to connect and disconnect components.
2. Flexible: Jumper wires can be easily bent and routed around other components.
3. Cost-Effective: Jumper wires are often less expensive than other types of connectors or cables.

# Disadvantages:

1. Limited Current Capacity: Jumper wires may have limited current capacity, making them
unsuitable for high-power applications.
2. Noise Susceptibility: Jumper wires can be susceptible to electrical noise, which can cause errors or
malfunctions.
3. Security: Jumper wires can be easily disconnected or tampered with, which can compromise the
security of a circuit or system.

Figure: 4.1(6) Jumper wire


40
7. Piezo Buzzer

A piezo buzzer is a type of electronic device that produces sound waves using a piezoelectric
material. It is commonly used in various applications, including:

# How it Works:
1. Piezoelectric Material: The piezo buzzer contains a piezoelectric material, such as ceramic
or crystal, that generates an electric charge when subjected to mechanical stress.
2. Voltage Application: When a voltage is applied to the piezoelectric material, it vibrates,
producing sound waves.
3. Sound Production: The vibrating piezoelectric material produces sound waves, which are
amplified by a resonator or horn.

# Characteristics:
1. Low Power Consumption: Piezo buzzers consume low power, making them suitable for
battery-powered devices.
2. High Sound Pressure: Piezo buzzers can produce high sound pressure levels, making them
suitable for applications where loud sounds are required.
3. Compact Size: Piezo buzzers are often compact and lightweight, making them suitable for
use in small devices.

# Applications:
1. Alarm Systems: Piezo buzzers are used in alarm systems to produce loud sounds.
2. Timers and Clocks: Piezo buzzers are used in timers and clocks to produce audible signals.
3. Toys and Games: Piezo buzzers are used in toys and games to produce sound effects.
4. Medical Devices: Piezo buzzers are used in medical devices, such as blood pressure
monitors and insulin pumps.
5. Industrial Applications: Piezo buzzers are used in industrial applications, such as
machinery and equipment.

# Advantages:
1. Low Cost: Piezo buzzers are relatively inexpensive compared to other types of sound-
producing devices.
2. High Reliability: Piezo buzzers are highly reliable and have a long lifespan.
3. Easy to Use: Piezo buzzers are easy to use and require minimal circuitry.

# Disadvantages:
1. Limited Frequency Range: Piezo buzzers have a limited frequency range, which can limit
their use in certain applications.

41
2. Sensitivity to Temperature: Piezo buzzers can be sensitive to temperature changes, which
can affect their performance.
3. Limited Sound Quality: Piezo buzzers can produce a limited sound quality, which can be a
disadvantage in certain applications.

Figure: 4.1(7) Piezo Electric Buzzer

4.2 Circuit Digram

Connect the first 6 pins of the keypad to the six analog pins of Arduino Uno. Connect the last two
pins to digital pins 2 and 3 on the Arduino board.
Connect pin 1 (VSS) on the LCD, to GND on the Arduino.
Connect pin 2 (VDD), to the 5V pin on the Arduino.
Connect pin 3 (V0), to the middle of the 10k potentiometer and connect the other two pins on the
potentiometer to 5V and GND on the Arduino.
Connect pin 4 (RS), to pin 7 on the Arduino.
Connect pin 5 (R/W), to the GND pin on the Arduino.
Connect pin 6 (ENABLE), to pin 6 on the Arduino.
Connect pins 11, 12, 13, and 14 (data pins) to pins 5, 4, 3, and 2 on the Arduino.
Connect pin 15, which is the LCD’s backlight pin, to 5V on the Arduino through the 220-ohm
resistor.
Connect pin 16 on the Arduino, which is the negative pin of the backlight, to GND on the Arduino.

42
Now we will connect the DC lock directly to the Arduino. But the lock requires more than 5 volts so
we will need to connect a relay in between the lock and the Arduino.

Connect the signal pin of the relay to Arduino pin 10. connect the VCC and GND to 5V and GND to
Arduino.
Connect the positive terminal of the battery to the positive terminal of the door lock and the negative
terminal.

Figure: 4.2 Circuit Digram

43
4.2.1 Flow Chart

Flowchart Steps:

1. Start

2. Initialize Arduino, Keypad, and Lock Pin

3. Wait for User Input from Keypad

4. Store Each Key Pressed

5. If ‘#’ is Pressed, Check the Entered Code

If Code is Correct:

Unlock the Door (activate relay/lock)

Display “Access Granted”

Wait for a few seconds

Lock Again

If Code is Incorrect:

Display “Access Denied”

Clear Input

44
Figure: 4.2.1 Flowchart

45
4.2.2 Pin Connection

Here's an explanation of the pin connections for a digital lock door using Arduino
Uno:

Arduino Uno Pins:

- Digital Pins: 0-13


- Analog Pins: A0-A5
- Power Pins: 5V, 3.3V, GND

Digital Lock Door Connections:

- Keypad:

- Row 1: Digital Pin 2


- Row 2: Digital Pin 3
- Row 3: Digital Pin 4
- Row 4: Digital Pin 5
- Column 1: Digital Pin 6
- Column 2: Digital Pin 7
- Column 3: Digital Pin 8
- Column 4: Digital Pin 9

- LCD Display:

- RS: Digital Pin 10


- E: Digital Pin 11
- D4: Digital Pin 12
- D5: Digital Pin 13
- D6: Analog Pin A0
- D7: Analog Pin A1
- VCC: 5V
- GND: GND

- Servo Motor:

- VCC: 5V
- GND: GND
- Signal: Digital Pin A5

- Buzzer:

- VCC: 5V
46
- GND: GND
- Signal: Digital Pin A4

- LEDs:

- Red LED: Digital Pin A3


- Green LED: Digital Pin A2

Notes:

- Make sure to connect the keypad, LCD display, servo motor, buzzer, and
- LEDs to the correct digital and analog pins on the Arduino Uno.
- Use a breadboard to connect the components and make it

47
Chapter 5
Software Description

5.1 Software Overview

The digital keypad lock software with audio functionality is designed to provide an additional layer
of security and convenience. The software utilizes the Arduino platform IDE, Making the circuit
digram on kikad software and integrates audio features using a speaker or buzzer.

1. Arduino IDE Software:


IDE stands for Integrated Development Environment. The Arduino IDE is the official software
you use to write, compile, and upload code (called "sketches") to an Arduino board.

Main Features:

1. Code Editor:

Where you write your Arduino code in C/C++.

2. Verify/Compile Button:

Checks your code for errors.

3. Upload Button:

Sends your code to the connected Arduino board.

4. Serial Monitor:

Lets you see data coming from the Arduino (useful for debugging or reading sensor data).

5. Board & Port Selection:

Allows you to select the type of Arduino board and the correct USB port for communication.

How it Works:

48
1. You connect your Arduino to your computer via USB.

2. Write or open a sketch (code).

3. Click Verify to check for errors.

4. Click Upload to send it to your board.

5. The board runs your code immediately.

Figure: 5.1(1) Arduino IDE Software

49
2. Ki-Cad Software:

What is KiCad?

KiCad is a free, open-source software used for electronic design automation (EDA). It helps
you design schematics and Printed Circuit Boards (PCBs).

Main Functions of KiCad:

1. Schematic Editor:

Create circuit diagrams by connecting components like resistors, microcontrollers, sensors,


etc.

2. Symbol and Footprint Libraries:

Access thousands of electronic components with accurate symbols and physical footprints.

3. PCB Layout Editor:

Convert your schematic into a real PCB layout, placing and routing components on a
board.

4. 3D Viewer:

See a 3D model of your PCB before manufacturing it.

5. Gerber File Export:

Export files used by PCB manufacturers to produce your physical board.

KiCad Workflow (Basic Steps):

50
1. Create a new project.

2. Design the schematic (draw your circuit).

3. Assign footprints to the components.

4. Generate a netlist (connectivity info).


5. Design the PCB layout using the netlist.

6. Route the traces (wires on the PCB).

7. Check for errors (DRC - Design Rule Check).

8. Export Gerber files for manufacturing.

Why Use KiCad?

Free and open-source.

No limitations on board size or layer count.

Suitable for hobbyists, students, and professional

51
Figure: 5.1(2) Ki Cad Software

5.2 Software Components:

1. Arduino IDE

Development environment where you write and upload code to the Arduino Uno.

2. Libraries

These are used to simplify interaction with components:

Keypad Library: Helps manage keypad inputs.

#include <Keypad.h>

LiquidCrystal Library (optional, if using LCD for feedback):

#include <LiquidCrystal.h>

EEPROM Library (optional, for storing passcode permanently):

52
#include <EEPROM.h>

3. Code Modules / Functions

These are logical parts of the code handling various tasks:

a. Keypad Input Handling

Detects which key is pressed on the keypad.

Debounces keypresses.

b. Password Verification

Stores a predefined password (in code or EEPROM).

Compares entered keys to stored password.

c. Lock Control

Controls a relay or servo to lock/unlock.

E.g., digitalWrite(LOCK_PIN, HIGH); to unlock.

d. Feedback Display

LCD or Serial Monitor output to guide the user.

E.g., "Enter Passcode", "Access Granted", "Wrong Code".

e. Error Handling / Security

Limits number of wrong attempts.

Adds delay or alert on multiple failed attempts.

f. EEPROM Storage (optional)


53
Reads/saves passcodes in EEPROM to retain after power loss.

4. Sample Software Architecture

#include <Keypad.h>
#include <LiquidCrystal.h>
#include <EEPROM.h>
// Setup keypad
// Setup LCD
// Define password and input buffer
// Setup lock output pin
void setup() {
// Initialize LCD, keypad, and lock
}
void loop() {
// Read keypad input
// Update input buffer
// Compare to password
// Provide feedback and control lock

5.2.1 Software Flow chart

1. Start

The program begins executing when the Arduino is powered on or reset.

2. Initialize System

In the setup() function:

Initialize the keypad library to detect key presses.

Initialize the LCD (or serial monitor) to display messages.

Set the lock control pin (connected to a servo or relay) as output.

Optionally load a stored password from EEPROM.


54
3. Display "Enter Passcode"

Show a message prompting the user to enter the passcode.

This gives feedback that the system is ready for input.

4. Wait for Keypad Input

The program constantly checks for key presses using keypad.getKey().

It ignores invalid or unpressed keys.

5. Store Input Digit

Each valid keypress is saved in a buffer (array or string).

This buffer holds the digits typed by the user.

6. Is Input Length Equal to Password Length?

Once the number of entered digits matches the length of the stored password:

The system moves on to password verification.

If not:

The system keeps waiting for more key presses.

7. Compare Entered Code with Stored Password

The input buffer is compared to the correct password (stored in the code or EEPROM).

This determines if access should be granted or denied.

8. Is Password Correct?

If YES:

Display "Access Granted".

55
Activate the lock mechanism (e.g., open the door using a servo or turn off the relay).

Wait for a few seconds (e.g., 5 seconds).

Then lock again (close the door).

Return to the start to allow the next attempt.

If NO:

Display "Access Denied".

Optionally:

Increase the count of failed attempts.

Trigger a delay or lockout if max attempts are exceeded.


Go back to Step 3 to allow another attempt.

9. Loop Back

The program runs in an infinite loop (loop() function in Arduino).

It continuously returns to the passcode entry step, waiting for the next user input.

5.2.2 Project Code

#include <Servo.h>

#include <LiquidCrystal_I2C.h>

#include <Keypad.h>

#ifndef PASSWORD_H

#define PASSWORD_H

56
#define MAX_PASSWORD_LENGTH (20)

#define STRING_TERMINATOR '\0'

class Password {

public:

/**

* @brief Construct object in memory, set all variables

* @param pass

*/

Password(char* pass);

/**

* @brief Set the password

57
* @param pass

*/

void set(char* pass);

/**

* @brief Evaluate a string, is it equal to the password?

* @param pass

* @return true

* @return false

*/

bool is(char* pass);

/**

* @brief Append a char to the guessed password

* @param character

* @return true

* @return false

*/

58
bool append(char character);

/**

* @brief Reset the guessed password, one can guess again

*/

void reset();

/**

* @brief Is the current guessed password equal to the target


password?

* @return true

* @return false

*/

bool evaluate();

//char* getPassword();

//char* getGuess();

//operators
59
/**

* @brief password using operator =

*/

Password &operator=(char* pass);

/**

* @brief Test password using ==

*/

bool operator==(char* pass);

/**

* @brief Test password using !=

*/

bool operator!=(char* pass);

/**

* @brief Append to currently guessed password using operator <<

*/

Password &operator<<(char character);

private:
60
char* target;

char guess[ MAX_PASSWORD_LENGTH ];

byte currentIndex;

};

#endif

Password::Password(char* pass) {

set(pass);

reset();

void Password::set(char* pass) { target = pass; }

bool Password::is(char* pass) {

byte i = 0;

while (*pass && i < MAX_PASSWORD_LENGTH) {


61
guess[i] = pass[i];

i++;

return evaluate();

bool Password::append(char character) {

if (currentIndex + 1 == MAX_PASSWORD_LENGTH) {

return false;

} else {

guess[currentIndex++] = character;

guess[currentIndex] = STRING_TERMINATOR; // ensure a valid c


string

return true;

void Password::reset() {

62
currentIndex = 0;

guess[currentIndex] = STRING_TERMINATOR;

bool Password::evaluate() {

char pass = target[0];

char guessed = guess[0];

for (byte i = 1; i < MAX_PASSWORD_LENGTH; ++i) {

// check if guessed char is equal to the password char

if ((STRING_TERMINATOR == pass) &&


(STRING_TERMINATOR == guessed)) {

return true; // both strings ended and all previous characters are
equal

} else if ((pass != guessed) || (STRING_TERMINATOR == pass) ||

(STRING_TERMINATOR == guessed)) {

return false; // difference OR end of string has been reached

// read next char

63
pass = target[i];

guessed = guess[i];

return false; // a 'true' condition has not been met

Password& Password::operator=(char* pass) {

set(pass);

return *this;

bool Password::operator==(char* pass) { return is(pass); }

bool Password::operator!=(char* pass) { return !is(pass); }

Password& Password::operator<<(char character) {

append(character);

return *this;

64
}

#define buzzer 11

Servo servo;

LiquidCrystal_I2C lcd(0x27,16, 2);

String newPasswordString; //hold the new password

char newPassword[6]; //charater string of newPasswordString

byte a = 5;

bool value = true;

Password password = Password("0123"); //Enter your password

byte maxPasswordLength = 6;

65
byte currentPasswordLength = 0;

const byte ROWS = 4; // Four rows

const byte COLS = 4; // Four columns

char keys[ROWS][COLS] = {

{'D', 'C', 'B', 'A'},

{'#', '9', '6', '3'},

{'0', '8', '5', '2'},

{'*', '7', '4', '1'},

};

byte rowPins[ROWS] = {2, 3, 4, 5};

byte colPins[COLS] = {6, 7, 8, 9};

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins,


ROWS, COLS );

66
void setup() {

Serial.begin(9600);

pinMode(buzzer, OUTPUT);

servo.attach(10);

servo.write(40);

lcd.init();

lcd.backlight();

lcd.setCursor(3, 0);

lcd.print("WELCOME TO");

lcd.setCursor(0, 1);

lcd.print("DOOR LOCK SYSTEM");

delay(3000);

lcd.clear();

void loop() {
67
lcd.setCursor(1, 0);

lcd.print("ENTER PASSWORD");

char key = keypad.getKey();

if (key != NO_KEY) {

delay(60);

if (key == 'C') {

resetPassword();

} else if (key == 'D') {

if (value == true) {

doorlocked();

value = false;

} else if (value == false) {

dooropen();

value = true;

} else {

processNumberKey(key);
68
}

void processNumberKey(char key) {

lcd.setCursor(a, 1);

lcd.print("*");

a++;

if (a == 11) {

a = 5;

currentPasswordLength++;

password.append(key);

if (currentPasswordLength == maxPasswordLength) {

doorlocked();

dooropen();

69
}

void dooropen() {

if (password.evaluate()) {

digitalWrite(buzzer, HIGH);

delay(300);

digitalWrite(buzzer, LOW);

servo.write(40);

delay(100);

lcd.setCursor(0, 0);

lcd.print("CORRECT PASSWORD");

lcd.setCursor(0, 1);

lcd.print("DOOR OPENED");

delay(2000);

lcd.clear();

a = 5;

} else {
70
digitalWrite(buzzer, HIGH);

delay(200);

digitalWrite(buzzer, LOW);

delay(200);

digitalWrite(buzzer, HIGH);

delay(200);

digitalWrite(buzzer, LOW);

delay(200);

digitalWrite(buzzer, HIGH);

delay(200);

digitalWrite(buzzer, LOW);

delay(200);

lcd.setCursor(0, 0);

lcd.print("WRONG PASSWORD!");

lcd.setCursor(0, 1);

lcd.print("PLEASE TRY AGAIN");

delay(2000);

lcd.clear();
71
a = 5;
resetPassword();

void resetPassword() {

password.reset();

currentPasswordLength = 0;

lcd.clear();

a = 5;

void doorlocked() {

if (password.evaluate()) {

digitalWrite(buzzer, HIGH);

delay(300);

digitalWrite(buzzer, LOW);

72
servo.write(170);

delay(100);

lcd.setCursor(0, 0);

lcd.print("CORRECT PASSWORD");

lcd.setCursor(2, 1);

lcd.print("DOOR LOCKED");

delay(2000);

lcd.clear();

a = 5;
}

else {

digitalWrite(buzzer, HIGH);

delay(200);

digitalWrite(buzzer, LOW);

delay(200);

digitalWrite(buzzer, HIGH);

delay(200);

digitalWrite(buzzer, LOW);

delay(200);
73
digitalWrite(buzzer, HIGH);

delay(200);

digitalWrite(buzzer, LOW);

delay(200);

digitalWrite(buzzer, HIGH);

delay(200);

digitalWrite(buzzer, LOW);

delay(200);

lcd.setCursor(0,0);

lcd.print("WRONG PASSWORD!");

lcd.setCursor(0, 1);

lcd.print("PLEASE TRY AGAIN");

delay(2000);

lcd.clear();

a = 5;

}
resetPassword();

}
74
75
Chapter 6
Applications

6.1 Home Security System:

Overview

A digital keypad lock replaces traditional keys with a secure passcode system, managed by an
Arduino Uno. It enhances home safety by allowing only authorized access.

Main Components

1. Arduino Uno – The brain of the system.

2. 4x4 Keypad – Used to enter a secret code.

3. Servo Motor or Relay – Controls the physical locking/unlocking mechanism.

4. LCD Display (optional) – Shows messages like “Enter Code” or “Access Denied”.

5. Buzzer (optional) – Alerts for wrong attempts.

6. EEPROM – Stores the passcode permanently.

How It Works:-

1. Initialization:

The system starts and displays “Enter Passcode”.

2. User Input:

The user types a 4-digit (or more) passcode using the keypad.

3. Password Verification:

The Arduino compares the entered code with the stored one.

76
4. Access Control:

If correct:

The servo motor rotates to unlock the door.

Message displayed: “Access Granted”.

After a delay, it locks again.

If incorrect:

Buzzer sounds or “Access Denied” is shown.

After 3 wrong attempts, the system may lock out for a few seconds.

5. Security Features (Optional):

Changeable passcode via admin mode.

Alarm if wrong code entered too many times.

Motion detection or door sensors for added safety.

Remote monitoring using Wi-Fi (NodeMCU + Arduino).

Advantages

No Physical Keys: No risk of losing or copying keys.

Customizable: You can easily change the code.

Low Cost: Built using inexpensive components.

Expandable: Can be connected with IoT modules for remote control or notifications.

77
6.2 Office or Lab Access Control:

A digital lock keypad system using Arduino Uno can be implemented to control access to offices,
laboratories, or restricted areas. This system ensures that only authorized personnel can enter by
entering a valid passcode on a keypad.

1. System Components

Hardware:

1. Arduino Uno – Controls the system logic.

2. 4x4 Keypad – Allows users to enter their access code.

3. Servo Motor or Relay Module – Controls door locking mechanism.

4. LCD Display (16x2) (Optional) – Displays instructions and messages like “Enter Code” or
“Access Granted.”

5. Buzzer (Optional) – Alerts if an incorrect passcode is entered multiple times.

6. EEPROM (Optional) – Stores the passcodes permanently, even after power loss.

3. How It Works

Step 1: System Initialization

The system starts with a message: "Enter Passcode" on the LCD.

The keypad is ready to receive input.

Step 2: User Authentication

An employee or authorized person enters a predefined passcode using the keypad.

The system compares the entered code with the stored passcodes.

Step 3: Access Decision

✅ If the passcode is correct:

The door unlocks (servo motor rotates or relay activates the electric lock).

78
The LCD displays "Access Granted".

After a few seconds, the system automatically locks the door again.

❌ If the passcode is incorrect:

The LCD displays "Access Denied".

The buzzer sounds as a warning.

If multiple incorrect attempts are made, the system locks out temporarily to prevent unauthorized
access.

Step 4: Security Features (Optional)

Multiple User Support: Each employee or lab personnel can have a unique passcode stored in
EEPROM.

Logging and Monitoring: The system can be connected to an IoT module (ESP8266/NodeMCU) to
track access logs remotely.

Biometric Integration: A fingerprint scanner can be added for two-factor authentication.

RFID Compatibility: RFID cards can be used along with keypads for enhanced security.

3. Real-Life Applications

Company Offices: Ensures only employees can enter specific rooms.

School/University Labs: Prevents unauthorized students from accessing science or computer labs.

Server Rooms: Protects sensitive data centers from unauthorized entry.

Hospital Equipment Rooms: Limits access to authorized medical staff only.

4. Advantages

✔ Enhanced Security – Prevents unauthorized access.


✔ Keyless Entry – No need for physical keys, reducing the risk of loss or duplication.
✔ Multiple Access Control – Can store multiple passcodes for different users.
✔ Scalability – Can be upgraded with IoT, biometric, or RFID systems

79
6.3 Personal Safe:

A personal safe using a digital lock keypad and Arduino Uno provides a secure way to store valuable
items. The system ensures that only individuals with the correct passcode can unlock the safe,
replacing traditional keys with a digital solution.

1. System Components

Hardware Components:

1. Arduino Uno – The brain of the safe, processing input and controlling the lock.

2. 4x4 Keypad – Used to enter the passcode.

3. Servo Motor or Solenoid Lock – Acts as the locking mechanism.

4. LCD Display (Optional) – Shows messages like "Enter Code" or "Access Granted."

5. Buzzer (Optional) – Alerts when incorrect passcodes are entered multiple times.

6. EEPROM (Optional) – Stores the passcode even after power loss.

7. Power Supply (Battery or Adapter) – Provides power to the system.

2. How It Works

Step 1: System Initialization

The Arduino powers up, and the LCD (if used) displays: "Enter Passcode."

The keypad is activated and waits for input.

Step 2: User Input and Verification


The user enters a preset passcode using the keypad.

The system compares the entered code with the stored passcode.

Step 3: Access Control

✅ If the passcode is correct:

The LCD displays "Access Granted."

The servo motor rotates to unlock the safe OR the solenoid lock releases.

80
The safe remains open for a few seconds before automatically locking again.

❌ If the passcode is incorrect:

The LCD (or serial monitor) displays "Access Denied."

A buzzer may sound as a warning.

If multiple incorrect attempts are made, the system may enter a lockout mode (temporary disabling
for a few minutes).

3. Security Features (Optional)


Multiple Passcodes: Allows different users to have separate codes.

Admin Mode: Allows the owner to change the passcode.

Alarm System: If too many incorrect attempts occur, a buzzer sounds or an alert is sent via an IoT
module (Wi-Fi/GSM).

Battery Backup: Ensures the system works even if the power is lost.

Fingerprint Scanner: Can be added for extra security.

4. Real-Life Applications

Home Safe: To store cash, jewelry, or important documents.

Office Locker: To protect confidential files or equipment.

Student Locker: Used in hostels or dorms to keep personal items secure.

Portable Security Box: Can be placed in vehicles or bags for secure transportation of valuables.

5. Advantages

✔ Increased Security – Prevents unauthorized access.


✔ No Key Required – Eliminates risks of lost or duplicated keys.
✔ Customizable – Users can change the passcode as needed.
✔ Affordable – Low-cost alternative to commercial electronic safes.
✔ Upgradeable – Can be integrated with IoT for remote monitoring.

81
Chapter 7
Conclusion and Future Scope

7.1 Conclusion

The digital lock keypad system developed using the Arduino Uno has proven to be an
effective and practical solution for basic security needs. Through this project, we
implemented a password-protected system that allows access only when the correct
passcode is entered via a 4x4 keypad. When the user inputs the right password, the
Arduino processes the signal and triggers an action—such as unlocking a door (simulated
by an LED or servo motor). If the wrong password is entered, the system denies access
and may display a warning message or activate a buzzer. Using Arduino Uno
successfully demonstrates a low-cost, efficient, and reliable method for securing access to
restricted areas. By integrating a keypad, LCD display, and basic electronic components,
we were able to develop a user-friendly interface that allows users to input a passcode and
control access with ease. The project showcases the practical application of Arduino
programming, digital input/output handling, and security logic implementation. This
system can be further enhanced with features such as EEPROM password storage, a
buzzer for wrong attempts, or even biometric integration for added security. Overall, this
project reflects the potential of microcontrollers in real-world security systems and offers
a strong foundation for further development in embedded systems and IoT-based access
control solutions.

This project allowed us to explore and understand several important concepts in electronics
and embedded systems:

1. Microcontroller Programming: We used the Arduino Uno to control the entire system. This
involved writing code to read keypad input, compare it with a predefined password, and
respond accordingly.

2. Input Handling: The 4x4 keypad required proper scanning and reading logic, teaching us
how matrix keypads work and how to manage user input effectively.

3. Output Display: An LCD module (usually 16x2) was used to give real-time feedback to the
user, like prompting for a password or confirming access, which improved user
interaction.

4. Security Logic: The project highlighted the importance of conditional checks and logic

82
implementation in creating secure systems. Features like password matching, limited
attempts, and feedback on errors were important learning points.

4. Practical Application: This project simulates a real-world digital lock system and can be used
in places like lockers, doors, safes, or any access-controlled environment. It can easily be
upgraded with additional features like EEPROM storage (for saving the password), GSM
modules (for remote alerts), or biometric sensors.

5. Key Takeaways:

The Arduino Uno serves as the main controller, processing user input and controlling the lock
mechanism. A 4x4 or 4x3 keypad enables PIN input, ensuring access control. A servo motor or
solenoid lock acts as the locking mechanism. Additional features such as an LCD display,
buzzer, and LED indicators can enhance usability.

The system can be improved by adding EEPROM storage, RFID, fingerprint sensors, or IoT
connectivity for remote access.

This project demonstrates how microcontrollers can be used for real-world security applications.
It can be further customized for different security needs, making it a practical solution for homes,
offices, or restricted areas.

Overall, this project demonstrated the capabilities of the Arduino Uno in building simple yet
functional security systems. It also served as a hands-on learning experience in hardware
interfacing, coding, and system design. With further enhancements, the system can be made more
robust, scalable, and suitable for real-world deployment.

83
7.2 Future Scope

Future Scope of Digital Lock Keypad using Arduino Uno (Detailed


Explanation)

The digital lock keypad using Arduino Uno is a basic prototype that showcases how
microcontroller-based security systems can be implemented. While the current system is
functional and demonstrates the core concept of password-protected access, there is
significant potential to enhance this project with advanced features and make it more
applicable for real-world use. Below is a detailed explanation of the possible future
developments:

1. EEPROM Password Storage

Current Limitation: The password is stored in the program memory, and it resets if the
Arduino is restarted.

Future Enhancement: By using EEPROM (Electrically Erasable Programmable Read-


Only Memory), the system can retain the password even after power loss. This allows
users to change and save passwords permanently without needing to re-upload the code.

2. Biometric Security Integration

Upgrade Idea: Add a fingerprint sensor or RFID module to enable multi-factor


authentication.

Benefit: Biometric verification increases security as it is unique for each user. This can be
used in high-security areas like lockers, offices, or data centers.

3. Wireless Communication (Bluetooth/Wi-Fi/IoT)

Upgrade Idea: Use modules like HC-05 (Bluetooth), ESP8266 or NodeMCU (Wi-Fi).

Benefit: Enables remote access through mobile apps, and can be connected to cloud
platforms for real-time monitoring, control, and data logging. Useful for home automation
and smart security systems.

84
4. GSM Module for Real-Time Alerts

Upgrade Idea: Integrate a GSM module (like SIM800L) to send SMS alerts.

Benefit: In case of multiple wrong password attempts or unauthorized access, the system
can send alert messages to the owner’s mobile number. This is useful for remote or
unattended locations.

5. Real-Time Clock (RTC) and Time-Based Access

Upgrade Idea: Add an RTC module (like DS3231) to implement time-based access
control.

Benefit: Access can be restricted to certain time windows (e.g., 9 AM to 5 PM), and
entries can be time-stamped. This is helpful in offices and shared workspaces.

6. Touchscreen Interface

Upgrade Idea: Replace the physical keypad with a touchscreen display (like a TFT or
OLED).

Benefit: Improves the user interface and enables on-screen password input, password
changes, and menu navigation.

7. Battery Backup System

Upgrade Idea: Add a rechargeable battery or UPS system.

Benefit: Ensures the lock functions even during power outages. Power management
features can be added to optimize battery usage.

8. Access Logging and Audit Trail

Upgrade Idea: Store access records (who accessed and when) using SD card module
or cloud-based logging.

Benefit: Important for environments where tracking access history is necessary,


such as in labs, banks, or server rooms.

9. Multi-User Access and Role-Based Control

85
Upgrade Idea: Assign unique passcodes or ID cards to different users.

Benefit: Enables role-based access where certain users get different levels of control.
Useful in workplaces and shared accommodations.

10. Integration with Smart Home Systems

Upgrade Idea: Make the digital lock a part of a home automation system.

Benefit: The lock can work with other smart devices like surveillance cameras, lights, and
alarms. Unlocking the door could trigger lights, disable the alarm, or send a notification.

Conclusion on Future Scope

These future improvements make the digital lock keypad system more secure, flexible,
and user-friendly. They also align with modern trends in IoT, home automation, and
smart security. With these upgrades, the simple Arduino-based project can evolve into a
full-featured commercial product suitable for homes, offices, and industries.

86
7.1.1 References

The digital lock keypad project using Arduino Uno was developed using a combination of
practical experimentation, online learning resources, datasheets, and Arduino libraries.
Below is a detailed list of references categorized by type:

1. Books and Educational Materials

"Getting Started with Arduino" by Massimo Banzi & Michael Shiloh

Provided foundational knowledge on Arduino programming and circuit building.

"Arduino Cookbook" by Michael Margolis

Helped in understanding advanced logic implementation, including keypad interfacing


and input validation.

2. Official Arduino Resources

Arduino Official Website – https://www.arduino.cc

Datasheets, example codes, and documentation for the Arduino Uno board and related
libraries.

3. Key Libraries Used

Keypad Library by Mark Stanley & Alexander Brevig

GitHub Repository: https://github.com/Chris--A/Keypad

Used for scanning and reading key presses from the 4x4 matrix keypad.

LiquidCrystal Library (Built-in with Arduino IDE)

87
Used to interface the 16x2 LCD display with the Arduino Uno.

EEPROM Library (Built-in)

Can be used for saving the password permanently across resets (if implemented).

4. YouTube Tutorials and Demonstrations

"Arduino Keypad Door Lock System" – by TechAtHeart

Helped in understanding wiring and password verification logic.

"DIY Arduino Based Keypad Lock" – by GreatScott!

Explained the logic behind comparing entered values with stored passwords and
triggering output actions like unlocking a door.

5. Online Articles and Tutorials

Circuit Digest: Arduino Password Door Lock System

URL: https://circuitdigest.com

Provided a circuit diagram and source code for a basic keypad lock system.

Instructables Projects – "Digital Door Lock using Arduino"

URL: https://www.instructables.com

Offered step-by-step guidance for beginners, including component lists and sample codes.

6. Component Datasheets and Documentation

Arduino Uno R3 Datasheet

For pin configuration, voltage levels, and microcontroller specifications.

4x4 Matrix Keypad Datasheet

88
Understanding how matrix keypads work and how to wire them properly.

16x2 LCD Display Datasheet

For command sets, pin descriptions, and wiring instructions.

Servo Motor (if used) Datasheet

Torque and angle range information needed for lock movement.

7. Community Forums and Discussions

Arduino Forum – https://forum.arduino.cc

Used to clarify bugs in code and get suggestions on improving security logic.

Stack Overflow & Reddit r/arduino

Helpful for understanding errors and optimizing code for better performance.

Conclusion on References

These resources collectively supported the design, coding, and implementation of the
digital lock keypad system. They provided both theoretical understanding and practical
examples, making it easier to troubleshoot issues and enhance the project with additional
features.

89
7.2.2 Data Sheets
1. Arduino Uno – Datasheet Overview

Microcontroller: ATmega328P

Operating Voltage: 5V

Input Voltage (recommended): 7-12V

Digital I/O Pins: 14 (of which 6 provide PWM output)

Analog Input Pins: 6

Flash Memory: 32 KB

SRAM: 2 KB

EEPROM: 1 KB

Clock Speed: 16 MHz

Usage in the Project:

Controls all operations of the lock system (input from keypad, processing password, output to LCD
or servo motor).

Communicates with peripherals using digital/analog pins.

2. 4x4 Matrix Keypad – Datasheet Overview

Rows and Columns: 4 rows × 4 columns = 16 keys

Operating Voltage: 3.3V to 5V

Output Type: Matrix format (each key press connects a unique row and column)

Material: Usually soft rubber or plastic with carbon-coated contacts

Connection Pins: 8 pins (4 rows + 4 columns)

Usage in the Project:

Used to enter the numeric/alphabetic password.

The Keypad library scans each row and column to detect which key is pressed.

90
3. 16x2 LCD Display (HD44780 or compatible) – Datasheet Overview

Display Size: 2 lines × 16 characters

Operating Voltage: 5V

Controller: HD44780 or equivalent

Interface Type: Parallel (4-bit or 8-bit mode)

Backlight: Usually LED-based (can be enabled/disabled)

Current Consumption: Approx. 1mA without backlight

Usage in the Project:

Displays prompts like “Enter Password”, “Access Granted”, or “Wrong Password”.

Connected using 6 Arduino pins (RS, E, D4–D7) in 4-bit mode.

4. Servo Motor (for door lock simulation) – Datasheet Overview


(Example: SG90 or MG996R)

Operating Voltage: 4.8V to 6V

Rotation Angle: 0° to 180°

Control Signal: PWM

Torque: Varies (SG90: 1.8 kg/cm, MG996R: 9.4 kg/cm)

Wires: 3 (VCC, GND, Signal)

Usage in the Project: Simulates door unlocking when the correct password is entered.

The Servo library is used to send the PWM signal from the Arduino.

5. Buzzer (optional) – Datasheet Overview


Operating Voltage: 3V–5V

Type: Active or passive

Sound Output: Around 85 dB

91
Current Consumption: Low (20–30 mA)

Usage in the Project:

Sounds an alert for wrong password attempts or access confirmation.

6. EEPROM (internal to Arduino Uno)

Size: 1 KB

Read/Write Cycles: 100,000 per cell

Persistent Storage: Keeps data after power is off

Usage in the Project (optional):

Used to store passwords permanently so they’re not lost when the Arduino restarts.

Conclusion

Datasheets provide critical specifications like voltage levels, current limits, pin configurations, and
communication protocols. Proper understanding of these ensures safe connections, avoids component
damage, and enables effective programming. Every major component in your digital lock project has
a datasheet that acts like its technical manual.

92
THANK
YOU

93

You might also like