Components and supplies
Breadboard (generic)
Resistor 330 ohm
Servos (Tower Pro MG996R)
Capacitor 100 µF
Jumper wires (generic)
Pushbutton switch 12mm
Standard LCD - 16x2 White on Blue
9V battery (generic)
9V Battery Clip
Arduino UNO
Apps and platforms
Arduino IDE
Project description
Code
Code
arduino
Code
arduino
Downloadable files
Diagram
Diagram
Diagram
Diagram
Comments
Only logged in users can leave comments
rogby
2 years ago
My 1602 LCD is not turning on and when the code is uploaded the Servo just goes back and forth by 45 degrees.
Anonymous user
2 years ago
do you need the capacitor
Anonymous user
2 years ago
Nice job, simple and demonstrate so much more...
chummer1010
2 years ago
Thanks! As silly as using a shoebox is, it worked out great to demo this project.
Anonymous user
2 years ago
Hey :D I have a question, is it possible to make your own password? xD also, is it possible to change your password at any time?
Anonymous user
2 years ago
Thanks for the project. It was easy to create. That is what I was needing for being a complete beginner. Good Job!
Anonymous user
2 years ago
Great project! Just what I'm looking for. This will be my first project, and I have one question. Is there any way to make the lock 'relock' itself automatically once closed and untouched for, say, ten seconds? Thanks for any insight you can provide.
Anonymous user
2 years ago
For some reason the original combination of 123142 never worked but 123423 and several others did Still have not figured out how to reset combination
Anonymous user
2 years ago
can this project be done using qapass 1602a lc 16x2. if yes pls share the schematic on siddhantgmohite10@gmail.com
Anonymous user
2 years ago
Thank you for inspiring me to make a similar project! Here's a solution to the EEPROM problem: void EEPROMkode() { int EEPROMkodeOK = true; int addresse = 10; for (Pos = 0; Pos <= (kodeLengde - 1); Pos++) { Str[Pos] = EEPROM.read(Pos); if (!(strrchr("11234567890", Str[Pos]))) { EEPROMkodeOK = false; } } Str[kodeLengde] = EEPROM.read(kodeLengde); if (Str[kodeLengde] != '#') EEPROMkodeOK = false; if (EEPROMkodeOK) { Str[kodeLengde + 1] = '\\0'; strncpy(kode, Str, kodeLengde + 1); } }
Anonymous user
2 years ago
Nevermind the int addresse = 10;
Anonymous user
2 years ago
Thank you for inspiring me to make a similar project! A solution to the EEPROM problem: void EEPROMkode() { int EEPROMkodeOK = true; for (Pos = 0; Pos <= (kodeLengde - 1); Pos++) { Str[Pos] = EEPROM.read(Pos); if (!(strrchr("11234567890", Str[Pos]))) { EEPROMkodeOK = false; } } Str[kodeLengde] = EEPROM.read(kodeLengde); if (Str[kodeLengde] != '#') EEPROMkodeOK = false; if (EEPROMkodeOK) { Str[kodeLengde + 1] = '\\0'; strncpy(kode, Str, kodeLengde + 1); } }
Anonymous user
2 years ago
I am having a problem while recreating your project. The problem is that numbers that are entered for the passcode are not being stored. Whenever a button is pressed for more than 2 seconds and let go, the number appears on the display and then quickly disappears. Here is a link to what is happening: https://www.youtube.com/watch?v=Ux3bb2e28ds I used both iterations of code (Password 1234E and 123142E) and the same problem persists. With the 123142E code, the screen keeps refreshing. I have recreated this in 123D Circuits and I am having the same problems in the simulation. Have you ran into any similar problems like this and know of any potential solutions?
Anonymous user
2 years ago
Thank you so much you have no idea how much that will help!
chummer1010
2 years ago
That's strange... Check the connections in your buttons, perhaps. Are those normal push buttons? Also, do you have the EEPROM library installed in your IDE? What version are you running? Thanks for asking, this actually feels pretty cool that somebody built this!
chummer1010
2 years ago
I will do the best I can to find a solution. I'm going to take a look at this code tonight/tomorrow and see what is wrong. For all I know I published an older version of the final code by mistake. I'll see what I can do and I'll get back to you as soon as possible.
chummer1010
2 years ago
This is odd... Try something for me. Copy and paste the code into a new sketch and see what happens when you delete ClearCode(); from every line it appears in, and then delete everything in void ClearCode() at the very end.
chummer1010
2 years ago
I noticed in your video and photos you emailed me that your Uno board looks different than mine. What exact model is it? and it is a real Arduino or a clone?
Anonymous user
2 years ago
When i delete every ClearCode(); and delete everything inside ClearCode(), none of the buttons work. I have copied and pasted your code into a simulation with my breadboard layout. If you could check over my simulation and maybe help me find the problem that would be great! https://123d.circuits.io/circuits/2341563-arduino-safe
Anonymous user
2 years ago
It is a real Arduino Uno. Im not so sure on how old they are but I can tell you for certain that they are not clone models. The issue has been recreated in the simulation so i'm sure that it might be a code problem instead of a hardware one. The code should be viewable on the simulation website next to the run simulation button. If you could take a look at it and maybe check if there are any errors of to why its happening then it would be greatly appreciated! :)
Anonymous user
2 years ago
I have checked my buttons and have a version of the code where only pressing enter unlocks the safe then locks it again immediately. I have added a 20 second timer to help with this. I imported in the EEPROM library with "#include <EEPROM.h>" and am running IDE version 1.6.9 and am running version 2.0 of EEPROM.
Anonymous user
2 years ago
Great Job! I just finished the project and it works well but my LCD display is very low on brightness. Any ideas to make it brighter?
chummer1010
2 years ago
I'm working on finding a solution to why this isn't working.. .Have you ever used EEPROM with that particular board before?
chummer1010
2 years ago
Please be patient, I have a lot of other things to do on my hands. Why don't you study the code a little? If this worked 100% you would just be blindly copying and pasting the code and probably never even looked at it.
chummer1010
2 years ago
Glad you got things to work! Could you email me the code so I can post it here? That would be much appreciated. Thanks, Marco
chummer1010
2 years ago
That's great to hear! As for the display, make sure your wiring matches the diagram. Also, what are you using for a power source?
Anonymous user
2 years ago
jeg_er_hvalross, if you still didn't find a solution to your display issue, check if the resistor going into the LED (back-light input) of the LCD is more than 0.1 ohms. ;)
Anonymous user
2 years ago
Hey, I actually have the same problem you had with the numbers disappearing after a second. do you maybe remember after 6 years how you solved this problem? xD Thanks allot :)
Anonymous user
2 years ago
I finally got it to work and have even made it more secure where other people cannot see the password that you are typing in. Thank you for your help.
Anonymous user
2 years ago
Yes I have, Before this project i've done others like temperature sensors with almost the same hardware but a temperature sensor instead of a servo. The thing that bothers me the most is not being able to get it working in a simulation. The exact same problem I am having on the board is the same one as the simulation. On the simulation, I've used the same code as the one on the instructables site and in this case the screen keeps refreshing :( https://123d.circuits.io/circuits/2341563-arduino-safe I have even removed every ClearCode(); command in the simulation code but the problem still persists. Is it possible for you to send the iteration of code you used to get the project working yourself?
Anonymous user
2 years ago
Quick Question, have you made any changes to code for the project to work or have you used the code provided on this page? Im having trouble with getting this project to work correctly and it would really help if I knew if I have to make changes to code. Thanks :)
Anonymous user
2 years ago
Hi Chummer Can you please tell what is the role of the following variables: SaveTimer, SaveDelay, DisplayTimer & DisplayDelay?
chummer1010
2 years ago
Hey, These are all parts of the code for saving a new password, but I never got around to completing that part. I'm working on debugging and cleaning this code up as much as I can. Marco
Anonymous user
2 years ago
Works Great, But when I put in the RIGHT pass code, the servo motor wont turn at all.
Anonymous user
2 years ago
Hi is it possible to change the LCD to I2C lcd? If yes what is the code
cochrane
4 years ago
Thanks for the project. It was easy to create. That is what I was needing for being a complete beginner. Good Job!
Anonymous user
4 years ago
can this project be done using qapass 1602a lc 16x2. if yes pls share the schematic on siddhantgmohite10@gmail.com
Anonymous user
4 years ago
Great work bro. I am working on similar project at this time and I am always read blogs of your and some others who are inspiring me to for that. https://techatronic.com/ldr-sensor-with-arduino-tutorial/ That is the one of my favorite project and I was completed it by the help of this blog you can get idea from that blog also for writing. Keep posting!
Anonymous user
4 years ago
Great project! Just what I'm looking for. This will be my first project, and I have one question. Is there any way to make the lock 'relock' itself automatically once closed and untouched for, say, ten seconds? Thanks for any insight you can provide.
Anonymous user
5 years ago
Works Great, But when I put in the RIGHT pass code, the servo motor wont turn at all.
Anonymous user
6 years ago
do you need the capacitor
stevepcbman
6 years ago
For some reason the original combination of 123142 never worked but 123423 and several others did Still have not figured out how to reset combination
rogby
7 years ago
My 1602 LCD is not turning on and when the code is uploaded the Servo just goes back and forth by 45 degrees.
Anonymous user
7 years ago
Hey :D I have a question, is it possible to make your own password? xD also, is it possible to change your password at any time?
Anonymous user
8 years ago
Hi is there a way to add more buttons and numbers?
Silverhand
8 years ago
Thank you for inspiring me to make a similar project! Here's a solution to the EEPROM problem: void EEPROMkode() { int EEPROMkodeOK = true; int addresse = 10; for (Pos = 0; Pos <= (kodeLengde - 1); Pos++) { Str[Pos] = EEPROM.read(Pos); if (!(strrchr("11234567890", Str[Pos]))) { EEPROMkodeOK = false; } } Str[kodeLengde] = EEPROM.read(kodeLengde); if (Str[kodeLengde] != '#') EEPROMkodeOK = false; if (EEPROMkodeOK) { Str[kodeLengde + 1] = '\\0'; strncpy(kode, Str, kodeLengde + 1); } }
Silverhand
2 years ago
Nevermind the int addresse = 10;
Silverhand
8 years ago
Thank you for inspiring me to make a similar project! A solution to the EEPROM problem: void EEPROMkode() { int EEPROMkodeOK = true; for (Pos = 0; Pos <= (kodeLengde - 1); Pos++) { Str[Pos] = EEPROM.read(Pos); if (!(strrchr("11234567890", Str[Pos]))) { EEPROMkodeOK = false; } } Str[kodeLengde] = EEPROM.read(kodeLengde); if (Str[kodeLengde] != '#') EEPROMkodeOK = false; if (EEPROMkodeOK) { Str[kodeLengde + 1] = '\\0'; strncpy(kode, Str, kodeLengde + 1); } }
subhroneel93
9 years ago
Hi Chummer Can you please tell what is the role of the following variables: SaveTimer, SaveDelay, DisplayTimer & DisplayDelay?
chummer1010
2 years ago
Hey, These are all parts of the code for saving a new password, but I never got around to completing that part. I'm working on debugging and cleaning this code up as much as I can. Marco
xtremegamr99
9 years ago
I am having a problem while recreating your project. The problem is that numbers that are entered for the passcode are not being stored. Whenever a button is pressed for more than 2 seconds and let go, the number appears on the display and then quickly disappears. Here is a link to what is happening: https://www.youtube.com/watch?v=Ux3bb2e28ds I used both iterations of code (Password 1234E and 123142E) and the same problem persists. With the 123142E code, the screen keeps refreshing. I have recreated this in 123D Circuits and I am having the same problems in the simulation. Have you ran into any similar problems like this and know of any potential solutions?
xtremegamr99
2 years ago
When i delete every ClearCode(); and delete everything inside ClearCode(), none of the buttons work. I have copied and pasted your code into a simulation with my breadboard layout. If you could check over my simulation and maybe help me find the problem that would be great! https://123d.circuits.io/circuits/2341563-arduino-safe
xtremegamr99
2 years ago
Thank you so much you have no idea how much that will help!
xtremegamr99
2 years ago
It is a real Arduino Uno. Im not so sure on how old they are but I can tell you for certain that they are not clone models. The issue has been recreated in the simulation so i'm sure that it might be a code problem instead of a hardware one. The code should be viewable on the simulation website next to the run simulation button. If you could take a look at it and maybe check if there are any errors of to why its happening then it would be greatly appreciated! :)
xtremegamr99
2 years ago
I have checked my buttons and have a version of the code where only pressing enter unlocks the safe then locks it again immediately. I have added a 20 second timer to help with this. I imported in the EEPROM library with "#include <EEPROM.h>" and am running IDE version 1.6.9 and am running version 2.0 of EEPROM.
chummer1010
2 years ago
This is odd... Try something for me. Copy and paste the code into a new sketch and see what happens when you delete ClearCode(); from every line it appears in, and then delete everything in void ClearCode() at the very end.
chummer1010
2 years ago
I noticed in your video and photos you emailed me that your Uno board looks different than mine. What exact model is it? and it is a real Arduino or a clone?
chummer1010
2 years ago
That's strange... Check the connections in your buttons, perhaps. Are those normal push buttons? Also, do you have the EEPROM library installed in your IDE? What version are you running? Thanks for asking, this actually feels pretty cool that somebody built this!
chummer1010
2 years ago
I will do the best I can to find a solution. I'm going to take a look at this code tonight/tomorrow and see what is wrong. For all I know I published an older version of the final code by mistake. I'll see what I can do and I'll get back to you as soon as possible.
jeg_er_hvalross
9 years ago
Great Job! I just finished the project and it works well but my LCD display is very low on brightness. Any ideas to make it brighter?
Anonymous user
2 years ago
Hey, I actually have the same problem you had with the numbers disappearing after a second. do you maybe remember after 6 years how you solved this problem? xD Thanks allot :)
raymondogunjimi
2 years ago
jeg_er_hvalross, if you still didn't find a solution to your display issue, check if the resistor going into the LED (back-light input) of the LCD is more than 0.1 ohms. ;)
xtremegamr99
2 years ago
I finally got it to work and have even made it more secure where other people cannot see the password that you are typing in. Thank you for your help.
xtremegamr99
2 years ago
Quick Question, have you made any changes to code for the project to work or have you used the code provided on this page? Im having trouble with getting this project to work correctly and it would really help if I knew if I have to make changes to code. Thanks :)
xtremegamr99
2 years ago
Yes I have, Before this project i've done others like temperature sensors with almost the same hardware but a temperature sensor instead of a servo. The thing that bothers me the most is not being able to get it working in a simulation. The exact same problem I am having on the board is the same one as the simulation. On the simulation, I've used the same code as the one on the instructables site and in this case the screen keeps refreshing :( https://123d.circuits.io/circuits/2341563-arduino-safe I have even removed every ClearCode(); command in the simulation code but the problem still persists. Is it possible for you to send the iteration of code you used to get the project working yourself?
chummer1010
2 years ago
I'm working on finding a solution to why this isn't working.. .Have you ever used EEPROM with that particular board before?
chummer1010
2 years ago
Please be patient, I have a lot of other things to do on my hands. Why don't you study the code a little? If this worked 100% you would just be blindly copying and pasting the code and probably never even looked at it.
chummer1010
2 years ago
Glad you got things to work! Could you email me the code so I can post it here? That would be much appreciated. Thanks, Marco
chummer1010
2 years ago
That's great to hear! As for the display, make sure your wiring matches the diagram. Also, what are you using for a power source?
Anonymous user
9 years ago
Nice job, simple and demonstrate so much more...
chummer1010
2 years ago
Thanks! As silly as using a shoebox is, it worked out great to demo this project.
Anonymous user
2 years ago
Great work bro. I am working on similar project at this time and I am always read blogs of your and some others who are inspiring me to for that. https://techatronic.com/ldr-sensor-with-arduino-tutorial/ That is the one of my favorite project and I was completed it by the help of this blog you can get idea from that blog also for writing. Keep posting!