Introduction: Building a Locked Box
Step 1: Assembling the Project
If you move the project into a box, you’ll need to make holes for the LEDs and the switch. You’ll also need to make a latch for the servo motor to spin into. It will probably also be helpful to have a hole to run your USB cable through so you can continue using the serial monitor to watch the knock values.
Cut 2 holes in your box: one on the side, and a second through the cover flap. Place the servo in the box so that the arm can move in and out of the holes when closed.
Secure the servo in place with some tape, again making sure the arm can easily rotate through the slot you made.
Continue to the next step.
Step 2: Improving the Project
You may need to rearrange your breadboard and Arduino, or solder the LEDs and switch to make them accessible to the exterior of your enclosure. It also helps to have the top of the piezo component pressed up against the surface that you are knocking on.
Soldering is a process of joining two or more metal components together with an adhesive that is melted between the joint. If you’ve never soldered before, ask someone who has experience to help you out, or try practicing on some scrap wire first.
- Continue to the next step.
Step 3: Think About It...
This example simply counts the right number of knocks, no matter how long it takes. You can start to make a more complex example by creating a timer with millis().
Use the timer to identify if the knocks happen in a specific period of time. (Look back at the Digital Hourglass Project for an example of how a timer works.) You aren’t limited to simply finding knocks in a specific range. How could you look for complex patterns of knocks based on the amount of vibration and timing together? There are a number of examples online that talk about how to do this, search for “Arduino knock lock” to discover more examples of this type of project.
Congratulations, you have completed this project!
Check out other great projects here.
We have a be nice policy.
Please be positive and constructive.