0% found this document useful (0 votes)
14 views26 pages

Embedded Systems and IOT Design Smart Lock System Report

The project report outlines the design and development of a smart lock system using an Arduino microcontroller, a 4x3 keypad, a solenoid lock, a relay module, and an I2C LCD display for secure access control. The system allows users to enter a predefined passcode to unlock the door, with components and programming details provided for implementation. The report includes a working principle, connection diagrams, and sample code for the keypad and LCD integration.

Uploaded by

Sakthi Vel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views26 pages

Embedded Systems and IOT Design Smart Lock System Report

The project report outlines the design and development of a smart lock system using an Arduino microcontroller, a 4x3 keypad, a solenoid lock, a relay module, and an I2C LCD display for secure access control. The system allows users to enter a predefined passcode to unlock the door, with components and programming details provided for implementation. The report includes a working principle, connection diagrams, and sample code for the keypad and LCD integration.

Uploaded by

Sakthi Vel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Embedded Systems And IOT Design (ET3491)

Project Report
Smart Lock System Using Arduino

Submitted by:

I.Sakthivel (950521106018)

V.Navin Karthick (950521106013)

T.Ponmathankumar (950521106014)

A.Rejoy (950521106015)

M.Yogeshwaran (950521106030)
A)Objective:
Design and develop a secure and user-friendly door lock system using Arduino
microcontroller, a 4x3 keypad, solenoid valve, relay, and an I2C LCD display. The
system will provide secure access control to a door, allowing authorized users to enter
a predefined passcode
.
B)COMPOENTS REQUIRED

1.1 Arduino Uno board


This microcontroller depends on the ATmega328P. There are all out of 20 pins (0-
19) out of which 6 are simple information sources, 14 are computerized input yield
pins(6 pins give PWM voltage) which can like be utilized as broadly useful pins, a
ceramic resonator of recurrence 16 MHz, a USB association, a force jack and a reset
button. It has a working voltage of 5V. It contains all that expected to help a
microcontroller.

1.2 4x4 Matrix Keypad


The 4x4 Network Keypad interfaces is to require the input from the individual.
Ready to enter the preset secret word to test the legitimacy of the watchword. On
the off chance that the watchword is substantial at that point, the entryway bolt will
be opened. In case invalid, the entryway bolt will proceed to be bolted. The 4x4
Matrix Keypad includes 4 rows and 4 columns. There is a transfer that connects
every row and column. In our project We will use only the numeric between 0-9 keys
along with # to change the password.
1.3 16x2 LCD display with I2C adapter
The I2C 16×2 Arduino LCD Screen is using an I2C communication interface. It is
able to display 16×2 characters on 2 lines, white characters on blue background.
This show overcomes the disadvantage of LCD 1602 Parallel LCD Show in
which you'll squander almost 8 Pins on your Arduino for the show to urge working.

1.312v Solenoid lock


The Solenoid bolt indicates a lock for electrical locking and opening.. It is accessible

in opening within the control on mode sort, and locking and keeping within the
control on mode sort, which can be utilized specifically for circumstances. The
control on opening sort empowers opening as it were whereas the solenoid is fueled
on.A 12V DC power supply is an adapter designed to supply precisely 12 Volts of
direct current to a device. The voltage supplied must precisely match the
requirements of the equipment
Relay module 5v
A 5V hand-off module may be a single or multi-channel hand-off module that works
with a moo level trigger voltage of 5V DC. The input voltage can be from any
microcontroller or rationale chip that yields a advanced flag.

WORKING PRINCIPLE

How Keypads Work

The buttons on a keypad are arranged in rows and columns. A 3X4 keypad has
4 rows and 3 columns, and a 4X4 keypad has 4 rows and 4 columns:

Beneath each key is a membrane switch. Each switch in a row is connected to the
other switches in the row by a conductive trace underneath the pad. Each switch in
a column is connected the same way – one side of the switch is connected to all of
the other switches in that
column by a conductive trace. Each row and column is brought out to a single pin,
for a total of 8 pins on a 4X4 keypad:

Pressing a button closes the switch between a column and a row trace,
allowing current to flow between a column pin and a row pin.

The schematic for a 4X4 keypad shows how the rows and columns are connected:

The Arduino detects which button is pressed by detecting the row and
column pin that’s connected to the button.
This happens in four steps:

1. First, when no buttons are pressed, all of the column pins are held HIGH, and
all of the row pins are held LOW:

2. When a button is pressed, the column pin is pulled LOW since the current
from the HIGH column flows to the LOW row pin:
Beneath each key is a membrane switch. Each switch in a row is connected to the
other switches in the row by a conductive trace underneath the pad. Each switch in
a column is connected the same way – one side of the switch is connected to all of
the other switches in that
column by a conductive trace. Each row and column is brought out to a single pin,
for a total of 8 pins on a 4X4 keypad:

Pressing a button closes the switch between a column and a row trace,
allowing current to flow between a column pin and a row pin.

The schematic for a 4X4 keypad shows how the rows and columns are connected:

The Arduino detects which button is pressed by detecting the row and
column pin that’s connected to the button.

This happens in four steps:

3. First, when no buttons are pressed, all of the column pins are held HIGH, and
all of the row pins are held LOW:

4. When a button is pressed, the column pin is pulled LOW since the current
from the HIGH column flows to the LOW row pin:

5. The Arduino now knows which column the button is in, so now it just needs
to find the row the button is in. It does this by switching each one of the row
pins HIGH, and at the same time reading all of the column pins to detect which
column pin returns to HIGH:

6. When the column pin goes HIGH again, the Arduino has found the row pin
that is connected to the button:

From the diagram above, you can see that the combination of row 2 and
column 2 could only mean that the number 5 button was pressed.
Connect the Keypad to the Arduino

The pin layout for most membrane keypads will look like this:

Follow the diagrams below to connect the keypad to an Arduino Uno, depending
on whether you have a 3X4 or 4X4 keypad:

Follow the diagrams below to connect the keypad to an Arduino Uno, depending
on whether you have a 3X4 or 4X4 keypad:
How to Find the Pinout of Your Keypad

If your keypad’s pin layout doesn’t match the ones above, you can probe the pins
to figure it out. You’ll need to build a test circuit by connecting an LED and a
current limiting resistor to the Arduino (or any 5V power source) like this:

First, find out which keypad pins are connected to the button rows. Insert the
ground (black) wire into the first pin on the left. Press any button in row 1 and hold
it down. Now insert the positive (red) wire into each one of the other pins. If the
LED lights up at one of the pins, press and hold another button in row 1, then insert
the positive wire into each one of the other pins again. If the LED lights up on a
different pin, it means the ground wire is inserted into the row 1 pin. If none of the
buttons in row 1 make the LED light up, the ground wire is not connected to row 1.
Now move the ground wire over to the next pin, press a button in a different row,
and repeat the process above until you’ve found the pin for each row.

To figure out which pins the columns are connected to, insert the ground wire
into the pin you know is row 1. Now press and hold any one of the buttons in
that row. Now insert the positive wire into each one of the remaining pins. The
pin that makes the LED light up is the pin that’s connected to that button’s
column. Now press down another button in the same row, and insert the positive
wire into each one of the other pins. Repeat this process for each one of the other
columns until you have each one mapped out.

Programming the Keypad

For a basic demonstration of how to setup the keypad, I’ll show you how to print
each key press to the serial monitor.

Install the Library

We’ll use the Keypad library by Mark Stanley and Alexander Brevig. This library
takes care of setting up the pins and polling the different columns and rows. To
install the Keypad library, go to Sketch > Include Library > Manage Libraries and
search for “keypad”. Click on the library, then click install.

The Code for a 4X4 Keypad

Once the Keypad library is installed, you can upload this code to the Arduino if
you’re using a 4X4 keypad:

CODE: For Keypad 4X3

include< “Keypad”>
include<”LiquidCrystal_I2C”>
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};

byte rowPins[ROWS] = {9, 8, 7, 6};


byte colPins[COLS] = {5, 4, 3, 2};

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins,


ROWS, COLS);

void setup(){
Serial.begin(9600);
}

void loop(){
char customKey = customKeypad.getKey();

if (customKey){
Serial.println(customKey);
}
}

The Code for a 3X4 Keypad

If you’re using a 3X4 keypad, you can use this code:

#include <Keypad.h>

const byte ROWS =


4; const byte COLS
= 3;

char hexaKeys[ROWS][COLS] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};

byte rowPins[ROWS] = {9, 8, 7, 6};


byte colPins[COLS] = {5, 4, 3};

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins,


ROWS, COLS);

void setup(){
Serial.begin(9600);
}

void loop(){
char customKey =

customKeypad.getKey(); if (customKey)

Serial.println(customKey);
}
}

Lines 3 and 4 in the code above set the number of rows and columns on the keypad.

Lines 6-11 define which characters are printed when a particular button is pressed
on the keypad. The characters are laid out just as they appear on the keypad. If
your keypad has a different layout, you can define which characters are printed
when you press a button. For example, say your keypad has a column of letters on
the left instead of the right. You would just change it to this:

char hexaKeys[ROWS][COLS] = {
{'A', '1', '2', '3'},
{'B', '4', '5', '6'},
{'C', '7', '8', '9'},
{'D', '*', '0', '#'}
};
After you upload the code, open the serial monitor. When you press a key, the
value will be printed out:
Now let’s see how to print the key presses on an LCD. 4X4 keypads use 8 pins and
3X4 keypads use 7 pins. That takes up a lot of pins, so I’m going to use an I2C
enabled LCD because it only needs 4 wires to connect to the Arduino.

Install the LiquidCrystal_I2C Library

To use an I2C enabled LCD on the Arduino, you’ll need to install the
LiquidCrystal I2C library by Marco Schwartz. This library is nice because
it includes most of the functions
available in the standard LiquidCrystal library. To install it, download the ZIP file
below, then go to Sketch > Include Library > Add .ZIP Library:

LiquidCrystal I2C.zip

The Wire Library

The Wire library is needed to add support for I2C communication. It comes
packaged with the Arduino IDE, so there’s no need to install it. But if for some
reason it’s not installed on your system, go to Sketch > Include Library >
Manage Libraries and search for “wire” to install it.

Connect the Keypad and LCD

Once the libraries are installed, connect the ground and Vcc pins of the LCD to the
Arduino, then connect the LCD’s SDA and SCL pins according to the table below
for the different Arduino boards:
Well that’s about it. It’s not hard to set up a keypad at all. I think with a little trial and
error you should be able to modify the code above to work with most of the projects
you’d want to use a keypad for. But if you run into problems, just let us know in the
comments and we’ll try to help you out.

ii) BLOCK DIAGRAM


Smart Lock System using Ardiuno UNO the 4X3 keypad is used to enter the password
on 4x3 matrix and lcd display with i2c is used to display the password and enter the
password to demonstrate on digital logic input relay module is used to trigger the
solenoid valve if the password is correct the solenoid valve is open if incorrect solenoid
valve is not open

wires. Arduino has many different types of pins, each labeled on the board and used for
different functions.
Arduino Uno: Arduino is an opensource gadgets stage based on easy-to-use equipment
and computer program. Arduino sheets are able to studied inputs - light on sensor,
finger on button or twitter message - and turn it on an yield enacting a engine,turning
on an Driven, distributing something online
LCD Display: LCDs (Liquid Crystal Displays) are used in embedded system
applications for displaying various parameters and status of the system.16×2 LCD is
named so because; it has 16 Columns and 2 Rows.

4*4 Keypad: The 4 x 4 Network Keypad Module may be a non-encoded network


keypad comprising of 16 keys in parallel. The keys of each push and column are
associated through the pins exterior – stick R1-R4 as labeled adjacent to control the
lines, when C1-C4, the columns.
Relay Module: A 5V hand-off module may be a single or multi-channel transfer
module that works with a low-level trigger voltage of 5V DC. The input voltage before
ii)Working Principle
After upload the code in ardiuno the code is successfully uploaded to read the keypad
input data on the input if password is valid the solenoid lock is open if password is
invalid solenoid lock is not open
CODE :

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>

#define Password_Length 5
char Data[Password_Length];
char Master[Password_Length] = "2004";

const byte ROWS = 4;


const byte COLS = 3;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; // Adjusted for 4 rows
byte colPins[COLS] = {5, 4, 3}; // Adjusted for 3 columns

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS,


COLS);

LiquidCrystal_I2C lcd(0x3F, 16, 2); // Address 0x27, 16 columns, 2 rows

int relayPin = 11; // Relay control pin


bool isPasswordCorrect = false;
byte data_count = 0; // Declaration of data_count

void setup() {
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, LOW); // Ensure relay is initially closed

lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Enter Password:");
}

void loop() {
char customKey = customKeypad.getKey();
if (customKey) {
if (customKey == '#') { // Check if the entered key is the submit key
if (strncmp(Data, Master, Password_Length - 1) == 0) { // Compare entered
password with master password
lcd.clear();
lcd.print("Correct Password");
if (!isPasswordCorrect) {
digitalWrite(relayPin, LOW); // Open solenoid valve
isPasswordCorrect = true;
delay(5000); // Keep the solenoid valve open for 5 seconds
digitalWrite(relayPin, HIGH); // Close solenoid valve
isPasswordCorrect = false; // Reset password flag
delay(1000); // Delay for readability
}
lcd.clear();
lcd.print("Enter Password:");
clearData();
} else {
lcd.clear();
lcd.print("Incorrect Password");
delay(2000); // Delay for readability
lcd.clear();
lcd.print("Enter Password:");
clearData();
}
} else if (data_count < Password_Length - 1) {
Data[data_count++] = customKey; // Add key to password buffer
lcd.setCursor(data_count - 1, 1);
lcd.print('*'); // Display asterisks for entered characters
}
}
}

void clearData() {
for (int i = 0; i < Password_Length; i++) {
Data[i] = '\0';
}
data_count = 0;
}
OUTPUT:1
OUTPUT: 2

If password is correct solenoid valve is opened while Password is wrong


CONCLUSION

Result The system is controlled by Arduino. Passwords can be entered from the
keyboard. If the password matches the one registered in Arduino, the door will open.
The results of the model are as expected. This project provides sufficient security if no
password is provided.This project provides enough security as long as the password is
not shared. We have successfully tested ourproject. The results of the demonstrate were
as per our desire. Thus, everybody can manage to shop for such locking framework at
least cost to keep his valuable things safe.

Result:
Design and develop a door lock system using Arduino microcontroller,
a 4x3 keypad, solenoid valve, relay, and an I2C LCD display,DC
adapter to provide secure and convenient access control is
Succesfully
Result:
Design and develop a door lock system using Arduino microcontroller, a 4x3 keypad,
solenoid valve, relay, and an I2C LCD display,DC adapter to provide secure and
convenient access control is Succesfully

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy