Password Access With Arduino PDF
Password Access With Arduino PDF
Password Access With Arduino PDF
Table of Contents
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
http://www.instructables.com/id/Password-access-with-arduino/
Intro: Password access with arduino
This instructable will show you how to make a pass-code lock system using the Arduino Mega board.
Whenyou type the right code, an LED lights up an the servo moves to open a lock.
What you will need:
--->one Arduino Mega (the arduino uno or duemilianove does not have enough digital pins for this project)
--->one LCD module
--->one Keypad
--->one Battery pack (or you can use the USB cable and PC power)
--->one 10K Ohm potentiometer
--->four 10K Ohm resistors
---> Breadboard
---> hookup wire
--->one servo
Now comes the contrast potentiometer which has to be connected to pin 3 of the LCD.
The potentiometer will have 3 pins. Take the middle pin and connect it to pin 3 of the arduino with hookup wire. Connect the othere two pins one to +5v and the other to
GND(ground). The order does not matter.
Now let's do a test: power up the arduino. The LCD should light up. If it does then Great! If the LCD does not light up then turn off the power and check the wires.
Never change, move, or take out wires from the circuit board when the Arduino is powered up. You may permanently damage the Arduino.
If the light works rotate the potentiometer all the way to the right and all the way to the left until you see 2 rows of black squares. That's the contrast.
Now take out the power and let's hook up the LCD to the Arduino with the signal wires so we can display something on it.
Ready? Let's go!
http://www.instructables.com/id/Password-access-with-arduino/
Connect the pins as follows:
LCD Pin 4 --> Arduino Pin 2
LCD Pin 5 --> Arduino Pin 3
LCD Pin 6 --> Arduino Pin 4
LCD Pin 11 --> Arduino Pin 9
LCD Pin 12 --> Arduino Pin 10
LCD Pin 13 --> Arduino Pin 11
LCD Pin 14 --> Arduino Pin 12
#include <LiquidCrystal.h>
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
Copy and paste it in an arduino environment window, make sure you have the board and serial port set correct and click UPLOAD after you plug in the usb with the
arduino.
You will see the TX and RX led's blinking, that means the code is going to the arduino.
push the reset botton once on the arduino, tune the contrast, and you should see Hello World displayed.
Congratulations! You've got the LCD working! :)
http://www.instructables.com/id/Password-access-with-arduino/
Step 2: Wire the Keypad to the Arduino
OK. Now that we're done with the LCD and we got it working, it's time to connect the keypad to the arduino. This can be a little tricky depending on what type of keyboard
you are using. In my case, I used a 3x4 keypad that I had for some time.
If you have a keyboard that is made especially for connecting to an arduino, then it's easy. You just look at the datasheet for it and it tells you exactly how to hook it up.
If you have a keypad and you have no datasheet for it then hang on cause I was in the same situation.
Mine had on the back a diagram that shows you which pins are connected together when you press a certain key.
If you don't have that, you will have to use a multimeter and figure out which pins are connected together when you press each key.
To do that, take your multimeter and set it on continuity(the diode symbol).
Then put the test leads on pins 1 and 2 of the keypad. Now press every key until you get continuity.
Take paper and a pen and write down the key(ex:1, 2, #) and the two pins(ex: 6[1;2]).
Do so for every key until you get all of them figured out.
Make a table:
1=1+5
2=1+6
3=1+7
4=2+5
5=2+6
6=2+7
7=3+5
8=3+6
9=3+7
*=4+5
0=4+6
#=4+7
Now plug the pins of the keypad in a breadboard and let's start connecting it.
Connect the pins for rows 2 and 3( in my case pins 2 and 3) to +5v through 10K Ohm resistors. Do the same with the pins for column 1 and 3 pins( in my case pins 5 and
7).
(The arduino uno does not have enough digital pins so it does not fit this project.)
That should do it for the keypad. :) we're one step closer to finish. Hang in there. :) Almost done.
http://www.instructables.com/id/Password-access-with-arduino/
http://www.instructables.com/id/Password-access-with-arduino/
Step 3: Connecting the servo
OK, the servo is very simple.
It has 3 wires: Red, Yellow(or white or orange), and black.
Connect the red wire to +5v, the black wire to GND, and the middle wire to digital pin 8.
That's it for the servo.
G o to the link above and download the libraries: keypad and password.
They are two files. take the files and put them in /Arduino/Libraries.
http://arduino.cc/playground/uploads/Code/Keypad.zip
http://arduino.cc/playground/uploads/Code/Password.zip
#include <Password.h>
#include <LiquidCrystal.h>
#include <Keypad.h>
#include <Servo.h>
Servo myservo;
int pos = 0;
LiquidCrystal lcd(2,3,4,9,10,11,12);
Password password = Password( "4321" );
const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns
// Define the Keymap
char keys[ROWS][COLS] = {
{'1','2','3',},
{'4','5','6',},
{'7','8','9',},
{'*','0',' ',}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = {25, 24, 23, 22}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {28, 27, 26}; //connect to the column pinouts of the keypad
const int buttonPin = 7;
int buttonState = 0;
#define ledPin 13
void setup(){
myservo.attach(8);
pinMode(buttonPin, INPUT);
lcd.begin(16, 2);
digitalWrite(ledPin, LOW); // sets the LED on
Serial.begin(9600);
keypad.addEventListener(keypadEvent); //add an event listener for this keypad
keypad.setDebounceTime(250);
}
void loop(){
http://www.instructables.com/id/Password-access-with-arduino/
keypad.getKey();
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
lcd.clear();
}
}
void guessPassword(){
if (password.evaluate()){
digitalWrite(ledPin,HIGH); //activates garaged door relay
delay(500);
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(3); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=50; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(3); // waits 15ms for the servo to reach the position
}
else{
digitalWrite(ledPin,LOW);
lcd.print("INVALID PASSWORD ");
password.reset(); //resets password after INCORRECT entry
delay(600);
lcd.clear();
}
}
After that the LED on the arduino board will light up for a short time and the servo will move to open the lock.
http://www.instructables.com/contest/makeitmove/?show=ENTRIES
http://www.instructables.com/contest/toy/?show=ENTRIES
http://www.instructables.com/contest/micro2/?show=ENTRIES
Thanks for reading this 'till the end and I hope you liked it.
File Downloads
Password_LCD_Servo.pde (2 KB)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Password_LCD_Servo.pde']
http://www.instructables.com/id/Password-access-with-arduino/
Related Instructables
Comments
4 comments Add Comment
Of course if you follow the connection layout you can use solderable PCB's and make a more durable and permanent circuit. But make your first try and
tests on the solderless breadboards. You can also get theese from radioshack (except for the servo). Go to the orange hyperlinks and check those out.
And, good luck on your future projects! :)
http://www.instructables.com/id/Password-access-with-arduino/