Secret Knock Project: The Plan

Picture of the Device

Last Saturday, we made the prototype for the secret knock device we are working on. The device, will listen for a secret knock that has been programmed into it. If it hears the correct knock, it drives a motor which it can use to unlock a door, chest, or box. There are plenty of possibilities.  The prototype worked great and tomorrow we are going to solder the components onto a PCB.

We got the idea from: http://www.instructables.com/id/Secret-Knock-Detecting-Door-Lock/

The Circuitry

Here is the diagram for the circuitry (click for higher resolution):

Device Diagram

Here is the schematic:
Schematic Diagram

Explanation

Microcontroller

A microcontroller is basically a computer on a chip. They are so versatile and inexpensive that some sort of microcontroller is present in virtually every electronic device. We are using a microcontroller board that also contains the circuitry necessary to load the program onto the chip from a computer over USB. A microcontroller runs the single program that is loaded onto it continuously. The microcontroller board we are using is called Arduino. For more information about Arduino see www.arduino.cc.

Electricity Basics

Voltage: Can be thought of as the concentration of electrons. A low concentration of electrons can be thought of as positive (+) or HIGH voltage while a high concentration of electrons is generally refered to as negative (-) or LOW voltage.
Current: The flow of electrons. The conventional direction of current flow is the direction that the positive charge is moving. Current flows from + to – (from high to low). Although electrons are actually moving from – to + we are talking about the movement of the positive charge which is in the opposite direction.
Resistance: Resistors are the squiggly lines in the schematic. They restrict the flow of electicity according to ohm’s law.
Ohm’s law:
V=I*R or  I=V/R or  R=V/I
I: current in Amps
V: Voltage in volts
R: Resistance in ohms

LEDs


This is the symbol for an LED.  Physically, the anode wire from the LED is longer than the Cathode wire so that you can differentiate them.  An LED lights up when current is passed through it in the direction of the arrow. Current cannot pass in the opposite direction.  In order to make sure that the LED does not get destroyed you must put it in series (end to end) with a resistor like the following:

The triangle on the top represents + and the lines on the bottom represent – which is also called GND(ground).  In the circuit shown above, the LED will light up.  By connecting the positive end to a pin from the microcontroller you can turn on whether or not that end is conected to + or – which results in the LED turning on or off.

The resistor is necessary beceuse the LED has a maximum current.  The ones we used(http://www.sparkfun.com/commerce/product_info.php?products_id=9650) have a max current of 20 mA.  Therefore, we need a resistance of at least:

R = V/I = (5.0v)/(0.020A) = 250Ω

The Piezo

piezo symbol

The piezo is usually used to generate sound (like a speaker). However piezos and speakers can also convert sound to electricity. The small ammount of electricity generated by the piezo when it hears something loud like a knock or a clap can be detected using the analog input microcontroller with a small ammount of energy.  The symbol for the piezo is the following:

Transistors

File:BJT NPN symbol (case).svg

The symbol above is of the type of transistor used in the circuit that drives the motor.  This is the most difficult part of the circuit to understand.  We use a transistor because the microcontroller doesn’t have enough power to run the motor directly.  A transistor is used for this purpose because it can be used when you want to switch a larger current(the motor) using a smaller current (the signal from the microcontroller).

The current that can pass from collector to emitter is controlled by the ammount of current that passes through from base to emitter.  This is the datasheet for the transistor we used:  http://ee.usc.edu/ee459lib/datasheets/P2N2222A-D.PDF

When the motor is to be turned on, the microcontroller drives pin3 HIGH.  Current flows out this pin through the 2.2K resistor, through the transistor from base to emitter, and then to ground.  The base to emitter current allows current to flow from collector to emitter in the transistor allowing current to flow from +5v through the motor to the collector to the emitter to ground.

More

More is coming soon so check here for updates.  Next time we meet, I’ll take pictures or video.

Advertisements
This entry was posted in Interseason, Knock Lock and tagged , , . Bookmark the permalink.

One Response to Secret Knock Project: The Plan

  1. Pingback: Knock Lock: Part 2 | N.U.R.D. Robotics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s