Problem: It doesn't seem to work very reliably
Solution: The knock sensor needs at least 1 1/2 seconds of silence before and after you enter your knock pattern. If there are any stray knocks during that time it will mess up the reading and not unlock.

The knock sensor picks up any vibration that's strong enough. That means things like loose drawer pulls, wobbly drawers, and loose items lying on top of the desk can inadvertently set off the knock sensor. Sitting down a glass, slamming a door, and even loud music can trigger a knock. The knock surface should also be secure and firm. If it visibly moves when you knock it can trigger phantom knocks. Either improve the environment around the knocks ensor, move it to quieter place, or see "The Knock Sensor Is Too Sensitive" for other ways to work around it.

Alternately the sensor might not be sensitive enough! See "The Knock Sensor Is Not Sensitive Enough" for other ways to work around it.

How do you tell the difference? Knock on your surface while looking at the knock sensor. The red light will blink each time it hears a knock.
Problem: The red LED blinks constantly or randomly.
Solution 1: This usually happens when there is an error or a short in the circuit. Check each connection in the circuit for continuity and shorts, be sure all of the components are the correct values and are connected the right way.

Solution 2: This can rarely be caused by a noisy power supply or external electronic noise near the sensor. Try a regulated power supply and move any high-current devices (electric heaters, refrigerators, air conditioners, etc) away from the sensor.
Problem: The knock sensor isn't sensitive enough!
Solution 1: Change the value of int threshold = 3; in the sketch (line 29) to 2, 1 or even 0. Be sure to upload the modified sketch to the Trinket after you make the change. You might need to temporarily disconnect the connection at pin #3 for it to program correctly.

Solution 2: Use a more sensitive piezo element. A 3/4" element will often more sensitive. (Avoid larger, louder elements as they include driver circuitry which makes them poor sensors.)
Problem: The knock sensor is too sensitive!
Solution 1: Increase the value of of int threshold = 3; in the sketch. (Line 29) This might need to go as high as 200. If you have to go higher than that check your circuit for errors. (See also "The red LED blinks constantly or randomly" above.

Upload the modified sketch to the Trinket after you make the change. You might need to temporarily disconnect the connection at pin #3 for it to program correctly.

Solution 2: Try a smaller piezo element. 1/2" (12mm) elements are about as small as you want to go.
Augh! I forgot my knock and now I can't get in!
Unplug the power to the lock for a bit, then plug it back in. When the Trinket is rebooting it will open the solenoid for a second or two, letting you open the drawer and record a new knock.
I know I knock the correct pattern, but the latch doesn't open.
If the lock opens when the drawer is open, but doesn't open when the drawer is closed that usually means that the lock latch is binding somewhere. It doesn't have a lot of pull so it needs to be able to move freely. Make sure the drawer is closed fully and that the solenoid latch can move freely.
Problem: It reboots when it's trying to unlock
Solution: You probably need a power supply with more amperes. Make sure your power supply provides at least 1A (1000mA) or the latch will pull too much power when it tries to open and the Trinket will reboot.

This guide was first published on Oct 31, 2013. It was last updated on Mar 08, 2024.

This page (Troubleshooting) was last updated on Oct 23, 2013.

Text editor powered by tinymce.