Introduction: Secret Safe With Knock Lock
This Instructable is based on the original Instructable by lilgfergi (https://www.instructables.com/id/Arduino-Light-Knock-Detecting-Door-Lock/), which actually expands off of an original idea by an Instructable created by graitho labs (https://www.instructables.com/id/Secret-Knock-Detecting-Door-Lock/), and it was inspired by the remix 2.0 competition. I actually began this project unknowing to the challenge, and when I read through the challenges, I saw that this would be a perfect fit. All of the technology and Arduino format and code are almost exactly the same as the code from lilgfergi's knock lock, but the difference is in the application. This lock will be mounted to a picture frame safe on a wall, that will open when the correct amount of knocks are administered. Therefore, this picture frame will not only be a hidden door like many picture frames in the common stereotypical setting, this one will seem like a natural frame that does not open until it is knocked, at which point it will open easily.
Step 1: Overview
I have wanted a picture frame safe for a while, but did not know how to go about it. My worry was that it would swing open if someone hit the wall or something, and because of that it would need a lock. But, it is hard to put a lock on a hidden door that is not supposed to resemble a door at all. I remembered seeing a knock lock on Instructables, and so I decided that was what I was going to do. I used lilgfergi's setup and code, because it has an H-Bridge. This drives the motor backwards, which in turn allows the door to lock and unlock with knocks. Also, I built the circuit the way lilgfergi did, but I removed only the photoresistor because it was giving me problems and also, there is no purpose for it in this situation; it would spend it's time in a dark frame with no way for light to pass. In the next step, I will include pictures of my arduino setup, a link again to lilgfergi's project, and a download of the code.
Step 2: The Circuit
Here's my circuit for the arduino. The only thing I did was removed the photoresistor, and I strongly encourage that; all it did was give me problems and it cannot be utilized in this situation anyways. I also attempted to take a much clearer, doctored up photo so it is easier to see. Now, the circuit is still the same except for the photoresistor though, so it still has to have something in analog input A1 to read, even if that reading comes out to 0 (off). I edited my code a bit differently too, moving around the knocks and patterns. I used a modified servo as my DC motor, so I had to also increase the miliseconds for the motor to run. I was going to remove the photoresistor from the code and post it here, but it is so embedded (you will see when you read through the code) it is nearly impossible to get rid of without completely re-writing the code. Once this is done, you are ready to move on to the next step. For the code, visit this link
and also read the instructable to get most of the background information on the circuit.
Step 3: The Frame
I went to AC Moore to buy the frame for my wall. Pick the picture you want beforehand, because it will not be fun to switch afterwards. Once you have your picture and your frame, cut a thin piece of plywood that's the same size of the frame, I used a quarter of an inch thick, and I attached this to the back of the frame with screws so it could come off. There is no image of this, but it would cover both the black and brown part. Now, if your frame is anything other than wood, feel free to epoxy it, or glue it or whatever. Just remember that the picture cannot be changed after that. After this is done, I attached the arduino to the plywood, and the same with the breadboard. The piezo unit, if desired, can be attached to longer wires so it touches the plywood, but that is up to you. I did not do that. The motor can be attached to the edge, as seen in the picture, because it has to open a latch. I used a servo that was modified, as I recommend, because an arm can easily be attached, but if a DC motor was used, an arm can be put on too. I used a square drill to drill out the area for the servo into the frame and plywood, and then I glued the motor in. Whatever the case with the motor is, when it is locked, the arm should be pointing towards the outside of the frame (overhanging the edge), and when unlocked, it should swing in. This said, the frame is now done.
Step 4: Making the Cabinet
The picture frame part is done, now for the safe. To put this safe in the wall, you should know where your studs are, but if you don't and worst comes to worst, you will just cut one. I have made some sketches in the pictures about how this cabinet should look, because I believe that is the easiest way to visualize this. The dimensions of the frame of the cabinet will basically be four inches deep by the size of your picture frame, because studs are 2x4, and it is very easy to just throw the 2x4s into the area in the shape of the safe. In my case, I am putting mine on a wall that has nothing behind it so technically I am not limited, but most of you probably will have this amount of space between your wall and whatever is behind it. So, all you have to do is make the square frame as shown in the picture.
Step 5: Mounting the Frame to the Wall
To mount the frame to the wall, it is a very simple process. First of all, hidden hinges are needed so it comes flush to the wall, but still opens. SOSS hinges are great, but expensive. Barrel hinges are best for this, but I went with a cheaper option, shown here: http://www.amazon.com/Liberty-H01068C-UC-C5-Non-Mo... . The hinges have to be mounted to the frame, and the frame has to go on the wall so it covers the whole cabinet. Once this is done, take note of how far in deep in the cabinet your arm is that will lock the door. Mark this on the stud, and clear an area out that this arm can fit into, using a drill, or a small dremel cutting wheel if you have access to one as I do. Then, when the door shuts, the arm should be able to swing in and out, therefore completing your knock locking picture frame.
Step 6: Credits and Further Information
If you guys liked this, please vote! There is much more that you can do with this project too; I made the opening code for mine to the tune of "Baby Got Back" by Sir Mix-a-Lot. Also, you could put this kind of lock on anything from a door, as seen in the original instructables, or even secret doors that swing open when knocked (Although they would need larger motors). Also, considering this is based on the remix 2.0 challenge, I would like to thank Graitho and lilgfergi one last time for their contributions to the electronics for this project. If it weren't for you guys, I probably would still be playing with my arduino and finding how to make my circuit work perfectly. Once again, thanks for reading, and please vote!