KEY LESS DOORLOCK SYSTEM
BY USING AUDRINO
BY
SULAIMAN SAIT F
YOGESH S
REQUIRED COMPONENTS
ARDUINO
KEYPAD
LCD DISPLAY
DC LOCK
RELAY MODULE (5V)
9V BATTERY
10K POTENTIOMETER
220-ohm RESISTOR
ARDUINO UNO
PIN OUT DETAILS OF ARDUINO UNO
FEATURES OF AUDRINO UNO
Microcontroller : ATmega328.
Operating Voltage : 5V.
Input Voltage : 7-12V.
Digital I/O Pins : 14
Analog Input Pins : 6.
DC Current per I/O Pin : 40 mA.
DC Current for 3.3V Pin : 50 mA.
Flash Memory : 32 KB
SRAM : 2 KB (ATmega328)
EEPROM : 1 KB (ATmega328)
Clock Speed : 16 MHz
TECHNICAL SPECIFICATIONS IN
ARDUINO
Arduino Uno is a open source microcontroller board
based on ATmega328p microcontroller.
It has 14 digital pins (out of which 6 pins can be used as
PWM outputs)
It has 6 analog inputs,On board voltage regulators etc.
Arduino Uno has 32KB of flash memory, 2KB of SRAM and
1KB of EEPROM.
It operates at the clock frequency of 16MHz. Arduino Uno
supports Serial, I2C, SPI communication for
communicating with other devices.
4 * 4 KEYPAD
Key Specifications
Maximum Rating: 24 VDC, 30 mA
Interface: 8-pin access to 4x4 matrix
Operating temperature: 32 to 122 °F
(0 to 50°C)
Dimensions: Keypad, 2.7 x 3.0 in (6.9
x 7.6 cm)
LCD DISPLAY
Pin
Function Name
No
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable resistor VEE
Register
4 Selects command register when low; and data register when high
Select
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
RELAY MODULE
Specifications:
5V rated signal input
1-channel relay module with optoisolation
Power state and relay activation LED
indicators
Relay maximum ratings: AC 250V/10A, DC
30V/10A
Inputs:
VCC - for driving the relay electronics (5V)
GND
IN - Control line input, 5V, minimum 4mA
COM - Jumpered to GND to control for
positive signal activation
DC LOCK
SPECIFICATIONS
Holding force: 0.25kg
Energized forms:
intermittent
Unlocking time: 1S
Dimensions: 54 x 42 x
28 m
CIRCUIT CONNECTION
CONNECTION EXPLANATION
First, connect the 4X4 keypad to the Arduino and connect the
first six pins on the 4X4 keypad with the A0 and A5 pins on the
Arduino.
Then connect the last two pins on the 4X4 keypad module to
digital pins 3 and 2 on the Arduino.
After that, connect the LCD to the Arduino. The connections for
connecting the LCD with the Arduino are as followsConnect pin 1
on the LCD, which is the VSS pin, to GND on the ArduinoConnect
pin 2, which is the VDD pin, to the 5V pin on the ArduinoConnect
pin 3, which is the V0, to the middle of the 10k potentiometer
and connect the other two pins on the potentiometer to 5V and
GND on the Arduino.
CONNECTION EXPLANATION
This pin is for setting the LCD’s contrast.Connect pin 4, which is
the RS pin, to pin 7 on the ArduinoConnect pin 5, which is the
R/W pin, to the GND pin on the ArduinoConnect pin 6, which is
the Enable pin, to pin 6 on the ArduinoConnect pins 11, 12, 13, and
14 which are the data pins, to the pins 5, 4, 3, and 2 on the
ArduinoConnect pin 15, which is the LCD’s backlight pin, to 5V on
the Arduino through the 220-ohm resistorConnect pin 16 on the
Arduino, which is the negative pin of the backlight, to GND on
the Arduino Last, we will connect the DC lock with the Arduino.
The Lock operates on a voltage from 7 to 12V, so we cannot
directly connect it to the Arduino..
CONNECTION EXPLANATION
To connect it to the Arduino, we will require a relay
and a battery.Connect the signal pin of the relay to
pin 10 on the Arduino and the lock’s VCC and GND to
5V and GND on the Arduino. Then on the other end of
the relay, connect the negative of the battery to the
common on the relay and the NO (Normally open) on
the relay to one side of the lock. Then connect the
other side of the lock to the positive terminal on the
battery.
OPERATION
Whenever the keys are pressed, they are matched with the
keys already stored. If the keys that are pressed match the
initial password stored in the EEPROM which is ‘1234’, then
the lock will open up. If the password does not match,
then it will print “access denied” on the LCD.
If the ‘#’ key will be pressed, it will ask you to enter the
current password and if it matches, then it will ask you to
enter the new password and the password will be
changed.
AUDRINO CODE
#include<Keypad.h>
#include<LiquidCrystal.h>
#include<EEPROM.h>
LiquidCrystal
liquid_crystal_display(9,8,7,6,5,4,);
char password[4];
char initial_password[4],new_password[4];
int i=0;
int relay_pin = 10;
char key_pressed=0;
const byte rows = 4;
const byte columns = 4;
AUDRINO CODE
char hexaKeys[rows][columns] = {{'1','2','3','A'},{'4','5','6','B'},{'7','8','9','C'},{'*','0','#','D'}};
byte row_pins[rows] = {A0,A1,A2,A3};
byte column_pins[columns] = {A4,A5,3,2};
Keypad keypad_key = Keypad( makeKeymap(hexaKeys), row_pins, column_pins, rows, columns);
void setup()
{
pinMode(relay_pin, OUTPUT);
liquid_crystal_display.begin(16,2);
liquid_crystal_display.print(" SULAIMAN");
liquid_crystal_display.setCursor(0,1);
liquid_crystal_display.print("Electronic Lock ");
delay(2000);
liquid_crystal_display.clear();
liquid_crystal_display.print("Enter Password");
liquid_crystal_display.setCursor(0,1);
initialpassword();
}
AUDRINO CODE
void loop()
{
digitalWrite(relay_pin, HIGH);
key_pressed = keypad_key.getKey();
if(key_pressed=='#')
change();
if (key_pressed)
{
password[i++]=key_pressed;
liquid_crystal_display.print(key_pressed);
}
AUDRINO CODE
if(i==4)
{
delay(200);
for(int j=0;j<4;j++)
initial_password[j]=EEPROM.read(j);
if(!(strncmp(password, initial_password,4)))
{
liquid_crystal_display.clear();
liquid_crystal_display.print("Pass Accepted");
digitalWrite(relay_pin, LOW);
delay(2000);
liquid_crystal_display.setCursor(0,1);
liquid_crystal_display.print("Pres # to change");
delay(2000); liquid_crystal_display.clear(); liquid_crystal_display.print("Enter
Password:"); liquid_crystal_display.setCursor(0,1); i=0; }
AUDRINO CODE
liquid_crystal_display.clear();
liquid_crystal_display.print("Enter Password:"); liquid_crystal_display.setCursor(0,1);
i=0;
}
else
{
digitalWrite(relay_pin, HIGH);
liquid_crystal_display.clear();
liquid_crystal_display.print("Wrong Password");
liquid_crystal_display.setCursor(0,1);
liquid_crystal_display.print("Pres # to Change");
delay(2000);
liquid_crystal_display.clear();
AUDRINO CODE
liquid_crystal_display.print("Enter Password");
liquid_crystal_display.setCursor(0,1);
i=0;
}
}
}
void change()
{
int j=0;
liquid_crystal_display.clear();
liquid_crystal_display.print("Current Password");
liquid_crystal_display.setCursor(0,1);
while(j<4)
{ char key=keypad_key.getKey(); if(key) { new_password[j++]=key;
liquid_crystal_display.print(key); } key=0; } delay(500);
AUDRINO CODE
char key=keypad_key.getKey();
if(key)
{
new_password[j++]=key; liquid_crystal_display.print(key);
}
key=0;
}
delay(500);
if((strncmp(new_password, initial_password, 4)))
{
liquid_crystal_display.clear();
liquid_crystal_display.print("Wrong Password");
liquid_crystal_display.setCursor(0,1);
liquid_crystal_display.print("Try Again");
AUDRINO CODE
delay(1000);
}
else
{
j=0;
liquid_crystal_display.clear();
liquid_crystal_display.print("New Password:");
liquid_crystal_display.setCursor(0,1);
while(j<4)
CODE FOR AUDRINO
char key=keypad_key.getKey();
if(key)
{
initial_password[j]=key;
liquid_crystal_display.print(key);
EEPROM.write(j,key);
j++;
}
}
liquid_crystal_display.print("Pass Changed");
delay(1000);
}
AUDRINO CODE
liquid_crystal_display.clear();
liquid_crystal_display.print("Enter Password");
liquid_crystal_display.setCursor(0,1);
key_pressed=0;
}
void initialpassword()
{
for(int j=0;j<4;j++)
EEPROM.write(j, j+49);
for(int j=0;j<4;j++)
initial_password[j]=EEPROM.read(j);
}
THE END