If you havent already, see the previous post outlining the project here. Rather than using the device to lock a door with a deadbolt we will use it to lock a box. We are using a servo rather than a motor because it is easier make the locking mechanism with a servo.
We are planning on finishing the project on friday when we meet again.
I made the picture above using Inkscape.
Once we connect everything together and complete the final assembly as is shown above, the knock lock should work. However, we still need to add the button for programming in new secret knock patterns, and a battery connector so that the circuitry can operate within the box independent of the computer. I think it would also be a good idea to add a switch accessible from outside the box in series with the battery so that the circuitry can be switched off when not in use and the battery does not run down permanantly locking the box.
How Does a Servo Work?
A servo contains a motor and a position feedback sensor. Using these sensors, it positions itself at a particular angle depending on the data signal.
The servo is controlled with three wires: ground, power, and control.
The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow, orange or white and should be connected to a digital pin on the Arduino board.
The control signal controls the angle the servo is set to. The protocol for this signal is called PWM or pulse width modulation. The servo expects a pulse sent from the microcontroller every 20ms. The length of the pulse determines the angle of the servo. There are many different types of servos but should behave according to:
When programming it shouldn’t be necessary to generate this signal manually, as it can be generated automatically in software.