This is a project made for Make course. It is a deadbolt opener for an entryway door that features voice recognition for user input.
What you will need:
- Arduino UNO or compatible
- EasyVR 2.0 shield package [includes software, shield, microphone, and arduino libraries] (https://www.sparkfun.com/products/12656)
- 3 LEDs of different color [red, yellow, green]
- 3 pullup resistors [330 ohm]
- Miscillaneous jumpers
Stepper Motor 5V DC 4-Phase 5-Wire
ULN2003 Driver Board
Make box [CAD file can be obtained from www.makecourse.com]
3D printed deadbolt clasp
small piece of hard foam
9 volt battery
arduino compatable 9 volt battery supply cable
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Set Up Voice Commands
In this step, we will be setting the commands we will use to call, lock, and unlock the deadbolt.
Using the software that comes with the EasyVR Commander software, record your voice into the Trigger command. This is the command you speak to call upon the EasyVR Shield. I chose to record the word "door".
Next we will record in Group 1. For the first and second commands, I used the words "open" and "lock".
Finally, we click on the 'create sketch' icon on the top toolbar and the software will upload our voice files onto the shield and open an arduino shell that contains the initialization of the VR shield with respect to the voice files uploaded to it.
Step 2: Setting Up the Circuit
Using the schematic above, we can create the physical circuit for our device. The 4 motor control pins are connected in decending order on the arduino (IN1 to D7, IN2 to D6...).
The stepper controller will take a direct jump from +5 on the arduino shield. The LEDs should have their 330 ohm pullup resistors between the digital pin on the arduino and the positive polarity of the respective LED.
I bound all of my LEDs together in electrical tape to keep them together and looking tidy when placed in the crack of a door. Be mindful not to short any of your connections.
Step 3: Writing the Code
To write this code, the first step is to include our stepper library. We can find where libraries are included in the VR shell by finding #include"EasyVR.h". Next we set our global variables for our stepper pins, LED pins, our stepper control function, last position variable (lpos) and our start-up variable (p).
Next, in our setup function, we will assign all of our digital pins as outputs and set the speed of our stepper motor. 60 is a speed I chose to respond quick, but also maintain accuracy.
The VR shell code conducts many serial and birdge connection tests in the following area. To add the meat of our code, scroll down until you see a calling for a function named 'void action()'. This is where we assign tasks for the arduino when certain voice commands are recognized by the EasyVR 2.0 shield. The first piece of code is to light the green LED upon system start-up. This is written to be started up when the door is unlocked. As you can see, the variable 'p' will only be equal to zero the first time this function is looped.
Group 0, which is the trigger word "door" is already set by the shell code to lead into group 1. This means to lock the door, a user would say "door" ::pause:: "lock".
Scrolling down to Group 1, we can see our 'lock' and 'unlock' case statements. If the user tries to unlock the door and the door is already unlocked, the yellow light will illuminate for a short period, then extinguish. The same falls true for a locked door given the 'lock' command. When the lock command is given to an unlocked door, the stepper will rotate *deg* steps. deg is the variable given to my rotation constraint (90 degrees) divided by my motor's degrees per step ratio. The illuminated LED will switch from green to red.
And that is that. Our dirty work is now complete.
Step 4: Putting It All Togther
Once the circuit is built and the code uploaded to the arduino + shield, we can package it all in the make course box. Mine was custom printed with arduino supports, but the box itself is non-conductive so feel free to strap it down with some electrical tape or hot glue. Hot glue is easy to remove and dries to the printed plastic very quickly.
A notch has been cut out of my make box to allow the LED cable ribbon and microphone to come out. This ribbon will feed through the crack of the door so the user can see the deadbolt status indicator lights from outside as well not muffle the inbound voice token.
A hole should be cut in the lid to allow for your deadbolt clasp to rotate freely. Use the small piece of rigid foam to prop the motor up from the bottom of the case. The foam is easily shaved to acquire the right height.
Once everything inside the make box, strap a 9 volt battery to the arduino compatible cable and tighten down the lid. Your VR door security system is good to go for instillation!
Step 5: Installation
Once everything is packaged together, you should have this!
Just connect it to the inside of your door, secure the LEDs and microphone on the outside and you are good to go!