Check out this great DIY Project over at Adafruit submitted by Steve Hoefer.
Nothing says “There’s something valuable here!” than the sight of a lock. But what if the lock was invisible and the unlocking key could be transmitted through solid matter? No one would even know there was a lock, much less how to pick it.
That’s what the Secret Knock Activated Drawer Lock does. It hides all of the lock mechanism away and can only be unlocked by something you know: a secret pattern of knocks.
A solenoid locks secures the drawer while a piezo buzzer listens for knocks. A Trinket compares the knock pattern to the stored secret knock and if they match the solenoid latch retracts and the drawer can be opened. Setting your own custom knock is as simple as holding down a button and tapping the new rhythm.
The project is relatively straight forward and you should be able to complete it in an afternoon.
As always, read and understand this guide completely before starting the project.
Tools
This project demonstrates installing it on a drawer but you could easily put it on the inside of a cabinet door.
It does other things too, like read the button to see if it should program a new knock, etc.
The code is liberally commented and but here are a couple things you might be interested in modifying:
int threshold = 3;
(line 29) If the knock sensor is too sensitive you can try raising this value. Usually values below 10 work best, but values up to 250 have been known to work. (If you need to raise this above 250 then you probably have something wrong with your circuit or components.)
const int rejectValue = 25; const int averageRejectValue = 15;
const int rejectValue = 25;
const int averageRejectValue = 15;
(line 30-ish) These two percentages indicate how accurate the knock needs to be to unlock. Raising these numbers allows a sloppier knock to work. Lowering them requires a more strict knock.
1: The Piezo. Solder the piezo buzzer to the back of the PCB so it can be installed flush against the desk/drawer/etc and hear knocks more clearly.
2: Wire Length. The length of wire between the lock and the knock sensor depends on where you plan to mount it. (See “Installation” section for more information.) Measure your distances and be sure to allow some extra for movement of drawers and doors. You should be able to put the lock several feet from the detector without any problems.
If you’re installing them close to each other then simply cut the connector off the solenoid lock.
3: Programming. The circuit uses the Trinket’s pin #3. In some cases you might need to disconnect the 2.2KΩ resistor from pin #3 to program the circuit.
Note that my sample programs just fine with pin 3 connected, but your mileage may vary. If you want to be extra sure of being able to program it after it’s soldered in place consider using female headers to mount the Trinket, or put a jumper between pin #3 and the 2.2KΩ resistor.
Unplug the Trinket from USB and plug in the 12V power supply and then be sure it can accurately detect a knock, unlock on command, and record new knocks, as described below.
If it doesn’t behave, see the “Troubleshooting” section for what might be going wrong.
When the red light goes out and the lock closes, it’s now listening for a knock and is ready to go.
Operation: The default secret knock is the classic Shave And A Haircut. To change it, see “recording” below.
Recording a new secret knock:
Now that you’re sure that it works, it’s time to install it.
First you need to rotate the latch so it will latch when you close the drawer or door.
We’ll do the simplest installation which places the lock solenoid on the front of the drawer and latches against the frame of the drawer or door.
The lock solenoid needs to have enough spacers behind it so the latch will clear the frame when the drawer is closed so the latch will lock.
The latch also needs to be able to move freely when the drawer is closed. The solenoid isn’t super powerful, and if it’s wedged too tightly it won’t retract when activated. You will probably need to add add some spacers between the lock and the drawer/door.
Position it vertically so the latch smoothly slides under the drawer frame and fasten it in place with #4 wood screws. Drill pilot holes for the screws so the wood doesn’t split.
The knock sensor needs to be fastened somewhere out of sight, but where you can knock easily and clearly on the other side. For a door that location is probably on the inside of the door. For a drawer it can be inside of the face of the drawer, along the side of the cabinet or under the surface of a the desk.
Wherever you put it you’ll probably want to be able to reach the programming button.
Use 1/2″ #4 wood screws to attach the perfboard to the inside of the sounding surface. Attach it so the piezo is against the knocking surface, and carefully tighten the screws to hold it in place. Reinforce and stabilize the perf board with some spacers of scrap lumber. (I used a bit of 1/4″ (6mm) square dowel between the perfboard and the drawer face, you can see it to the left in the picture below.)
After everything is in place and tested, tack the cables in place with hot glue, cable ties, or cable staples.
Remember: if you forget the knock or something else goes wrong you can disconnect the power for a moment to unlatch the lock for a couple seconds. If you run into any problems check out the Troubleshooting guide, Otherwise enjoy your super secret hiding place!
Tags: Secret Knock Lock
The scorching South African heat can really take a toll…
Amaze your friends with this easy to make an cool…
YouTube content creator wermy (no real name given) has produced a work…