During weekdays, I seldom bring my key out, but this causes difficulty when my mother left the house. By having no other choices, my mom has to leave the key inside the cabinet beside the door, which has no guarantee of whether the key is safe or not. By having this key lock, the one who is leaving the house can left the key inside this box to prevent others from stealing the key without any protection. Inasmuch as my mom will either be home before dinner or after dinner, I will need to know whether I need to find something to eat or not. This is the reason why the lock prints “Get Some Food”.
Step 1: Prepare the Materials
Arduino Leonardo (Arduino)
Matrix Keypad 4×4 (Amazon)
LCD 16×2 (Amazon)
Micro Arduino Servo Motor SG90 (Amazon)
Jumper Wires Male to Female (Amazon)
Jumper Wires Male to Male (Amazon)
Laser Cut 3D Printed Case x1 (15x20x12cm)
Tape / Clay
Breadboard / Welding Gun
Step 2: Code
1. Download 4 system from the library.
2. Make sure to declare the servo pin as 4 (any number except 2 or 3: both of them will not work if LCD occupies SDA and SCL).
3. Different rows and columns belong to different pins, so make sure to declare the correct one.
4. Set up own passcode for the lock.
5. “resetLocker” means when the system turns back to origin: LCD prints “Get Some Food” and “Pin”, and the servo turns to 40 degrees, which locks the box (the degree depends on different servo or the position of the servo).
6. “unlockdoor” works if the user enters the correct password, making the servo to turn to 110 degree (open) and the LCD print “pass”. In the other hand, the LCD will print “Wrong! Try Again” if the passcode is incorrect.
7. By pressing “*”, users can clear the password they entered; by pressing “#”, the machine can check for the passcode.
Step 3: The Circuit
1. Plug in all the wires in the pins declared for the coding part.
2. Be aware of the positive and negative electrode or else the components might break (positive electrode: 5V, negative electrode: GND).
3. If the breadboard occupies a large space, use a welding gun solder to connect the wires together. In order to let the circuit operate, make sure the wires are not burned out, and the solder surrounds the wires (Tips for welding: Use the welding gun to heat the wires, put in the solder to let it melt until the liquid surrounds the wires, then remove the welding gun and the solder).
4. Using a breadboard: pin 6-13 should be the keypad, pin 4 is for servo, LCD’s SCL and SDA connect to the two pins on the left. The positive and negative electrode of both servo and LCD should be in the positive and negative part of the breadboard, then use two other wires to connect the holes of the breadboard to 5V and GND.
5. Using a welding gun: pin 6-13 should be the keypad, pin 4 is for servo, LCD’s SCL and SDA connect to the two pins on the left. The negative electrode of both the servo and LCD should be in the two holes of GND, but there is only one 5V hole, which means the positive electrode of both the servo and LCD should be together using soldering and them connect both of the wires to the 5V wire.
Read more: Key Safe