How can an Arduino UNO board has the ability to help solve outside world issues?
Introduction:
The main purpose of my project is to show you how to make a cheap electronic keypad door lock using an Arduino UNO board, a keypad, and a servo motor. By using this system you will be able to unlock and lock a door in a very unique and creative way. By hooking up the 8 pin keypad to the Arduino, as well as a green/red LEDs, and also a servo motor, you can lock and unlock anything using a 3 digit code. Connecting the servo motor to your door knob could be a very creative way to add more security. This servo motor will work only if you put the 3 digit code that you assign it. For example: If your code is "159" when you type those three digits, the green LED will turn on making the servo motor rotate. Then the door will be unlocked without the necessity of a key. When you want to lock your door and secure it, type the "*" button to reset the servo motor. This will turn the red LED on, locking your door.
Problem:
With an Arduino UNO board, you will be able to create your own password lock door system. Nowadays, we are facing a lot of security issues and the risk of something being robbed or stolen. This is currently and has always been a really big problem in our society. If you use this project properly, you will be able to use it as a solution to security. You would need to protect it or maintain it safe in order to be useful. My goal is to decrease insecurity and the action of someone being robbed. Even though this project is mainly created for educational reasons, it can be applied to solve a real-world conflict.
Hypothesis:
My project demonstrates my purpose because it is about security. My project will provide a unique way to lock your door and make you feel with more security than a regular lock. My project, even though it is mostly for educational reasons, it can still bring a creative way to lock your door. The outcome will be successful and will bring the security that oneself needs in their doors. One can easily attach the servo to their door knob, and with the 3 digit code that you assign the program, you will be able to lock and unlock your door.
Variables:
pass[6] – is the array used to save and hold the user defined password.
check[6] – is the array used to collect & hold user input. This user input data (in check[] array) is compared with pass[] array to authenticate password.
entry – is the variable used to identify initial entry point of the program. User is asked to SET a 5 Digit Password at installation of Lock. Hence we need a variable to identify entry and loop 5 times to collect 5 digits and save them to pass[] array. The same variable is later made use of to Change Password. When the key for Changing Password (here ‘C’) is pressed, this variable is simply assigned a zero value (the initial state of variable). This forces the program control to re enter the Password Setting Loop of the program.
key_id – is the variable used to identify a key press and perform some actions in the program (that should happen only on a key press). By default this variable is set zero initial value. Whenever a key is pressed in keypad, this variable will be assigned a value =1. You may check the keyscan() function to see this. This simple trick helps to identify a key press and perform various actions on that key press (based on the value of key press). This variable is set to zero at different points in the program (to prevent the value 1 in key_id variable being identified as a false key press). You may check them as well.
Note:- col_scan – is the actual variable that gets activated to a LOW on key press (hence helps in identifying key press). But this variable is actually a part of the keypad interfacing program (version 2).
count – is the variable used to iterate the index of check[count] ( user input array ). count variable is initialized to 1. Each user input will be saved to check[] array in order of the increment of count variable.
temp_press – is a temporary variable to hold the value of key press. The value of key press is assigned to temp_press variable as a return result of the keypress() function. keypress() is the function defined to identify value of key press.
lcd_count – is a simple counter variable used to iterate the column position of LCD module. This variable helps to display user input data successively in row 2 of LCD module.
i,j,flag – are just dummy variables used in the program. i,j are used as counter variables inside for loop. flag is used to hold status of checkPassword() subroutine (the function used to compare user input data and the SET password ). A decision is made based on the value inside flag variable.
Materials:
Arduino UNO board
Keypad 4x4
Jumper Cables
Green and Red LEDs
Servo Motor
220 Ohm Resistor
Description of images.
Each image shows the materials I used for my project, and also how it was connected to make it work. The last image is how it looks when everything is connected and running.
Analysis:
You can change the 3-digit password to whichever password you want. I wanted the password to be “159”, that’s the reason it was working (unlock) for me. If it is your first time doing this kind of projects, I would suggest you keep it as simple as possible. Therefore, it would be a lot easier to learn and understand what is happening during the programming. My hypothesis was correct because using this password (“159”), I can unlock and lock any door to maintain more security. My experiment proved my hypothesis, because even though it is mainly for educational reasons, it can still be applied to solve a real-world issue that is currently happening.
Procedure:
First of all, you will need to download and install the Arduino software (Download the Arduino Software here). Then you will start with the connections using the Arduino UNO board, the keypad 4x4, the servo motor, and the green and red LEDs with the 220 Ohm Resistor. First, you will need to connect the keypad to the Arduino UNO board. These are the connections you will need to do with the jumper cables: Keypad pins 8,7,6,9,5,4,3,2 to the Arduino UNO board. Then connect the positive side of the Red LED to pin 12, and the positive side of the Green LED to pin 13. Connect both negative sides of both LEDs (Green and Red) to the 220 Ohm Resistor; you can solder those cables to the resistor. And when both negative sides of the LEDs are connected to the Resistor, then connect the resistor to ground. The last thing you will need to connect will be the servo motor. Connect the black cable of the servo motor to ground, the red cable to 5 volts, and the yellow cable to pin 11. Finishing connecting everything, now you will connect the Arduino UNO board to your computer in order to run the program.
You will need to use the following code to make your cheap lock using a keypad and a servo work:
#include <Servo.h> #include <Keypad.h> Servo ServoMotor; char* password = "159"; // change the password here, just pick any 3 numbers 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'} }; byte rowPins[ROWS] = { 8, 7, 6, 9 }; byte colPins[COLS] = { 5, 4, 3, 2 }; Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); int RedpinLock = 12; int GreenpinUnlock = 13; void setup() { pinMode(RedpinLock, OUTPUT); pinMode(GreenpinUnlock, OUTPUT); ServoMotor.attach(11); LockedPosition(true); } void loop() { char key = keypad.getKey(); if (key == '*' || key == '#') { position = 0; LockedPosition(true); } if (key == password[position]) { position ++; } if (position == 3) { LockedPosition(false); } delay(100); } void LockedPosition(int locked) { if (locked) { digitalWrite(RedpinLock, HIGH); digitalWrite(GreenpinUnlock, LOW); ServoMotor.write(11); } else { digitalWrite(RedpinLock, LOW); digitalWrite(GreenpinUnlock, HIGH); ServoMotor.write(90); } }
To make everything neater and ordered. You can put everything together (the cables, Arduino UNO board, servo motor, etc) in a regular box. And that's it, following carefully each and one of the steps you can successfully build your own lock.
Conclusion:
In this project, I proved that oneself can add more security to their door in a very unique and creative way. Using this Arduino Lock Security System can help you to add more security when locking your door. One will be able to unlock and lock any door with a simple 3-digit password. It can easily be built and ready to be used in real-world situations. The conclusion of this project is how can an Arduino UNO board has the ability to help solve world issues.
Applications & Further Research:
What is the application of your project in daily life/economy?
My project can be applied in daily life for an addition in security for your door. It can help people maintain security in their places, even though this project it is more for educational purposes. Besides the project is cheap, it is a very unique and creative way to maintain security in a place. Arduino can teach in a very easy way how programming is used and how it can be applied in other projects. Doing this type of projects are a golden ticket to get recognized in society and in the world.
What further study do you recommend given the results of your experiment?
To go more in-depth in electronics engineering, this project can be improved and make it a lot better for society to have even more security in their doors. This project can be added a little more of difficulty to make it a lot effective when solving insecurity. Making this project effective in real-world conflicts, you can revolutionize the way of seeing security.
What would be the next question to ask?
Will an Arduino password security system last for a long time period? Will this project positively impact society?
If you repeated this project, what would you change?
I would add even more difficult tasks onto this project, and I would improve the way that it was built. This project can easily be improved positively to be even more effective when trying to solve real-world issues that are currently happening.
References:
Programming Arduino Getting Started with Sketches 1st Edition (November 8, 2011 by Simon Monk).
Arduino™ Sketches: Tools and Techniques for Programming Wizardry (August 14, 2015 by James A. Langbridge)
http://www.open-electronics.org/arduino-door-lock-using-4x4-keypad-and-servo-motor/amp/
Special thanks to Mr. Fatih Gozuacik (Mr. G) for his continuous guidance.