PROJECT:
"Automatic Door close
& Password Based Unlock Protect"
Made by:
FARAZ AHMED
Bsc(EE) APCOMS
13-5-2016 , 6:00pm
Contact Faraz
Bsc(EE) APCOMS
13-5-2016 , 6:00pm
Contact Faraz
VIDEO:
****
COMPONENTS:
·
Arduino Uno/Mega x1
·
Breadboard x1
·
4×4 Keypad x1
·
Servo Motor x1
·
Red LED x1
·
Green LED x1
·
220 Ohm x2
·
Jumper Cable
PIN MAPING FOR LCD:
PIN MAPING HEX KEYPAD,LEDS & SERVO:
DESCRIPTION:
Download the Libraries if you don’t have
from internet...........
This article will be updated soon ,
Sorry for inconvenience….Admin
Sorry for inconvenience….Admin
C-CODE:
#include
<Keypad.h>
#include
<Servo.h>
#include<LiquidCrystal.h>
LiquidCrystallcd(10,
9, 8, 7, 6, 5);
char*
password = "786";
int position
= 0;
const byte
ROWS = 4;
const byte
COLS = 4;
char
keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byterowPins[ROWS]
= { 3, 2, A5, A4 };
bytecolPins[COLS]
= { A3, A2, A1, A0 };
Keypad
keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS );
intredPin =
12;
intgreenPin
= 13;
void setup()
{
// set up the LCD's number of columns and
rows:
lcd.begin(16,
2);
// Print a message to the LCD.
pinMode(redPin,
OUTPUT);
pinMode(greenPin,
OUTPUT);
servo_Motor.attach(11);
setLocked(true);
lcd.print("Input
Password");
lcd.setCursor(0,1);
lcd.print("To
Unlock Door");
}
void loop()
{
// print the number of seconds since reset:
char key =
keypad.getKey();
if (key ==
'*' || key == '#' )
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Door
is Closed");
position =
0;
setLocked(true);
}
if (key ==
password[position])
{lcd.clear();
lcd.setCursor(0,0);
lcd.print("Door
is Unlocked");
lcd.setCursor(0,1);
lcd.print("Now
Welcome");
position ++;
}
if (position
== 3)
{
setLocked(false);
}
delay(100);
}
voidsetLocked(int
locked)
{
if (locked)
{
digitalWrite(redPin,
HIGH);
digitalWrite(greenPin,
LOW);
servo_Motor.write(11);
}
else
{
digitalWrite(redPin,
LOW);
digitalWrite(greenPin,
HIGH);
servo_Motor.write(180);
}
}
REFERENCE WEBSITE:
http://www.letsarduino.com/project-20-arduino-door-lock-using-4x4-keypad-and-servo-motor/
--------------------------------------
Thanks for visiting Website J
*********************
0 comments:
Post a Comment