First of all, I have been a huge fan of the Instructables community and all who have been uploading their Instructables here. So, I decided to one day publish my own Instructable.
So, come up here to you with my first Instructable “SafeLock digital Security System using Arduino MEGA”
One day while I was learning Arduino and going on through its tutorials, I thought to make myself something real world working system using it. And so, I thought to make a Security lock system using it, as it might come handy to me in various applications. So first, what I did was I searched for ready made online tutorials for doing the same. I went through quite many of them. But what I saw was few which were simple for a newbie were much more simple. I mean they said you just give a fix password in your code and only that one value will be your password all time, unless you change in code and upload it again. Some used I2C communication. But what if some needs to make it with the simple connections and not to use I2C...? However, the I2C communications are more efficient. But thinking from view of someone who don't know it yet, they might drop their idea of making project. Also, many projects just used LCD, keypad & LED's to show it work. Just enter the password and open it. So, this are quite simple ones, or more complex ones. But what if one wants a security system which is simple to make as well as has got sack full features to work. So, see get to step to see its plus points...
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: So, This Is What I Did
I took on the work of making a simple security system which has loads of features to make it work more efficiently. I have this system which to the upper hand to many of the systems available out, has the following features:
1. When the code is uploaded, for the first time, it greets and then asks the owner to set a password. So, the owner can set any 8-digit password which he thinks suitable. Once the password is set, it will display that it is set and will blink the blue LED. Also, it will notify this by using the buzzer which beeps for few secs.
2. Once set, t will be constantly asking for entering the password, In the lock state. So, if a person needs to enter, he/she needs to enter the 8-digit password. If he/she enters password correctly, then the system greets & welcomes it by displaying it on screen and also the green LED blinks while the message is displayed. The buzzer notifies the same by beeping, while the LED is on. Thus, the door opens.
3. Now suppose any unknown person tries to enter the room and so he starts to jumble upon the keys of our keypad. Than, when he enters any random or unnecessary password element, the LCD show message of the key being invalid and blinks the red led. Also, the buzzer warns for the false entry by beeping.
4. The previous feature may also help any valid person if he enters any other key in between while typing password, helping him by notifying that the key is invalid and he needs to remember it.
5. If any user fails entering correct password for three times, he will be warned it being invalid all three times. Also, after three attempts, the LCD will display that the maximum try limit has reached. So now, user needs to wait one minute to try again to entering the password. This is notified by constant blinking red LED and beeping sound by the buzzer for one minute. Later, the user is again allowed to try again after 1 minute.
6. Also, if one needs to change the password, all that id required is to press the reset switch, which will ask to set the password again.
Thus, it has got tons of features to be working the way a user needs it right...
Now let’s get to the portion of it’s MAKING…!!
Step 2: Tools & Components
The Electronics components you require are:·
- Arduino MEGA 2560 (Brain & Memory)
- USB Cable (connect PC and Arduino to upload code)
- 16 x 2 LCD display (I have used JHD 162A)
- 4 x 4 Keypad (The input device)
- 1 x breadboard (which holds all connections)
- Rgb LED (The one used here is common anode)
- Piezoelectric speaker / buzzer (To notify & warn)
- 10K potentiometer / trim pot (Set LED value for LCD)
- 1 x 270-ohm resistor (prevent LED from BURNING…)
- 2 x 150-ohm resistor
- Male-to-male jumper wires
All the materials used are easily available on online shops. Even, most of you who are geek makers might already be having it. However, if you find difficulty in finding any online, comment it below. I will surely recommend you where to get it.
So, after having all our parts on our work desk, let’s begin the procedure of making it.
Step 3: Circuit Wiring & Assembly
Now, first have a look at the circuit diagram of this whole system which is available in the images attached. Also, I am going to provide here all pin connections here so that you don’t get jumbled & confused in this process, as it might result in improper or no working.
LCD pin : Arduino pin
1 >> GND
2 >> +5V
3 >> trim pot pin A
4 >> 1
5 >> GND
6 >> 2
11 >> 4
12 >> 5
13 >> 6
14 >> 7
15 >> +5V
16 >> GND
Pin A >> LCD pin 3
Pin B >> GND
Pin C >> +5V
Keypad pin : Arduino Pin
1 >> 52
2 >> 50
3 >> 48
4 >> 46
5 >> 53
6 >> 51
7 >> 49
8 >> 47
+VE pin >> Arduino pin 30
-VE pin >> GND
RGB LED wiring (common anode RGB)
RGB pin 1 >> R 270-ohm >> Arduino pin 40
RGB pin 2 >> +5V
RGB pin 3 >> R 150-ohm >> Arduino pin 42
RGB pin 4 >> R 150-ohm >> Arduino pin 41
If you are using a common cathode RGB in your circuit, connect RGB pin 2 >> GND instead of GND pin.
The images below show step by step wiring of each component.
However, I would suggest you to once refer to datasheets of your components so as to know the work of each pin of components. It might sometimes be possible that same component manufactured by different company will have different PIN layout. So, check it before hand and then perform the wiring accordingly.
So, once the wiring is done, let’s move to the programming part in next step.
Step 4: Coding & Uploading of Our System
I have attached the code file here. Get the code for yourself to run it in your circuited system. Once you download it, make any changes you require and then compile and upload it in your Arduino circuit.
Also, one thing I will like to bring to your notice here is that the RGB I used is common anode. It glows when in LOW state and doesn’t glow if in HIGH state. But if you are using common cathode RGB, then it will glow when the output state is HIGH and won’t glow when the output state is low.
I am also attaching images below, of the code being compiled and uploaded successfully.
OK, so without waiting, lets see our security system doing its job.
Step 5: Working of the SafeLock System
- When the code has been uploaded successfully, The screen gives a welcome message to its owner saying “Hi there… (name of owner)”.
- Next, it asks to set the password (which here is any 8-digit password you need to enter).
- Once set, it will prompt LCD screen with message“Password set (some thumbs up icons.)”. Also, the RGB will turn blue blink and the buzzer gives interrupted beeps for some time.
- Once set, User can install the system anywhere.
- Now, the default display on LCD is it asks for the password by displaying ”Enter 8-digit password”.
- A person who needs to enter first requires to type the correct password.
- If a person enters the correct password, the LCD screen will prompt with greetings and welcome message of “Greetings Welcome aboard”. Also, the RGB will turn to green blink and give continues beep for some time. Thus, the lock opens.
- What if a person enters wrong key or any typo occurs???
- So, if any wrong password key is entered, the LCD screen will display ”Sorry, Invalid key” and also the RGB turns to red blink and the buzzer gives a short notice by beeping.
- Here, one more thing to take into account is that the code checks each individual key entry and not just the whole password at once. So if a user has some correct keys entered and then forgets the next key, typing something else, than he will be warned for the same, thus helping him with recovering his password and trying again. Till the correct value of password is entered, the lock doesn’t open.
- But what if the person who needs to enter is not any authorized personnel??? So, he might try to make random password entries. So each time he presses any wrong key, it will display that it is invalid. But it should not keep on going forever, neither should he be able to try each password entry possible right… So, after three invalid entries, the system will stop taking further entries and prompt with message “You have crossed maximum try limits”, “Please try after 1 min”. So, for 1 minute, the LED will constantly give high frequency red blinking and the buzzer will also beep constantly. So, any concerned individual or security personnel might know that there is someone unknown around OR that someone is trying to breach the system and get in.
- After 1 minute, it will get back to its default position of asking the entry of password.
- If the user needs to reset or change the password, he is not required to code the system again. All he is required to do is to just press the reset button on the Arduino and the system will again ask the user to set new password.
- The working steps of this system are attached in the YouTube link mentioned:
Step 6: Finishing Up
Ok, so I hope I instructed great to you people out there in making this security system.
Isn't it simple as well as loaded with all features required to make it valid to be used at our various security instances?
It can be used as door lock, lock our cupboards, lock our cases, and even In our working premises.
So, don’t just sit there, go get your components, follow these instructions, and get yourself acquainted with this awesome & simple Security System.
If you like this Instructable, do like it and vote it in the contests. Currently, it is enrolled in Safe and Secure contest. Also, subscribe me on Instructables and YouTube to be updated for the many more upcoming tutorials & projects.
For now, Have a Great day…..
Participated in the
Safe and Secure Challenge