SHHHH Secret Knock

For my innovation switch project I used an Arduino to detect a sequence of knocks that would then power a toy motor.  “But wait once you show someone your secret knock isn’t it no longer a secret?!”  That’s not a problem because there is a button that you can press which allows you to program a new secret knock.

The sound is registered by a piezo speaker.  There is a green led that blinks when the correct knock is made and a red led that flashes when an incorrect knock is made.

I 3d printed a custom connected to attach the motor to the padlock.  The first round was unsuccessful because the motor I was using was too weak.

image1 image2

Screen Shot 2015-11-05 at 5.45.29 PM

The code is really long but here are some highlights:

const int threshold = 4; This controls how sensitive you have to knock and can be adjusted from 1-1023.

const int rejectValue = 25;
const int averageRejectValue = 15;

These two rows determine how accurately you have to knock on a percentage of 1-100

const int knockFadeTime = 150; This set how long to wait after detecting a knock 

const int lockTurnTime = 650; Sets how long the motor will run

const int knockComplete = 1200; Detects time in-between knocks 

const int maximumKnocks = 20; This sets the maximum number of knocks 

image3image2  image4

The toy motor was not powerful enough to turn the deadbolt.  I acquired a 12v motor with more torque, 3d printed a new connected and it worked!

Here is the video:

Discover more from Making Studio

Subscribe now to keep reading and get access to the full archive.

Continue reading