Introduction: Keypad Combiation
Hello makers. Today i will be showing you how to make a keypad combination lock. This keypad has a clear button as well as the ability to change the combination without reprogramming the Arduino. After testing, this combination lock is foul-proof, unless you break the circuit (DUH!!). So let's get building.
Step 1: Parts and Libraries
To make this project, you need:
- An Arduino.
- An LCD display(this code is for a 16*2 LCD).
- A 4x4 Keypad
- Potentiometer(i used a 50k pot)
- Green and Red LED(Or you can program the output to do anything)
- 220 or 270 ohm resistor.
For the libraries, you need:
- Keypad Library: http://playground.arduino.cc/Code/Keypad
-LCD library: Included with the IDE.
Step 2: Circuitry
Just make the circuit by following the schematic above. There is also a download for the Fritzing file if you can't comprehend the schematic from the image.
Step 3: Code and Customizing It
Here is the code for this project. The default combination is 1-2-3-4. To customize this from the code, you edit the array called "rightnumber". You need to put it the number in decimal ASCII. This is because of how my code and the keypad library works. To edit the amount of numbers in the combination, you edit the variable called "combinationlenght". Just make sure your combination length isn't over 14 digits, as the code isn't programmed to handle such length. Also make sure the combination length provided matches with the amount of number in the "rightnumber" array, as not doing so will mess up the program. If you want custom actions for the right and wrong combination, there is a void at the end of the code called "rightaction" and "wrongaction".
Step 4: Usage
You type the combination by pressing the key one by one like you would in a normal lock. A * should pop up every key press. If it doesn't press that key again. To clear the written number(if you got something wrong), press the D key. If you get the combination right or wrong, press D to go the the home screen and be able to type the combination again. This will also turn off the LED. If you get the combination right, you can press C to change the combination without having to reprogram the Arduino. Simply, after pressing C, type in your combination. Again you can use the D key to clear the written number if you typed in the wrong thing. One the number of key presses reaches the combination length, it will ask you if your sure. To say yes(changing the combination to the one you inputed) and return to the home screen, press A. If you don't want to change it(maybe you accidentally pressed the wring key), press B. This will return to the right combination screen, meaning you have the press C to change the combination or press D to go to the home screen.
Step 5: The End and Future Plans
If you followed the steps correctly, you have successfully made a combination lock. For the future of this project, if there is enough demand or if i just want to it, i will make V2 with more features(maybe add a remote control access i don't know). If you guys find a bug in this code, please tell inform me so i could fix it. If you guys want i could potentially make a video explaining how this project works and the code(how it works and how to customize it). Last, if you guys have an idea for a future projects, leave them bellow. Have fun
Participated in the