Introduction: Gesture Controlled Door Lock With Arduino and Electric Peppermill
I was searching for an instructable that is reusing the built in door lock to make an electric door lock without using the key manually.
All I found were instructables with a separate additional second door lock. So I started to build my own one to reuse the built in door lock.
Step 1: Overview: How It Works #1 Outside the Door/room
As only authorized people should have access from outside of the door, the
- gesture sensor
- 2 x LEDs
are places on the outside of the door.
- If a certain customizable gesture is recognized > the door opens
- If another customizable certain gesture is recognized > the door closes
Step 2: Overview: How It Works #2 Inside the Door/room
As only authorized people can be behind the door you do not need a gesture sensor. Two pushbuttons tor opening and closing the door are enough. So the following parts are at the inside/in the room
- The mechanical part:
- adjusted electric peppermill
- The electrical part:
- Arduino or microcontroller motor shield or L293D
- 2 x pushbuttons on breadboard
- Connection between mechanical and electrical part
Step 3: What You Need
- arduino or other microcontroller (lower costs)
- electric peppermill (lower costs) or geared motor
- morphable plastic (lower costs) or laser printer
- gesture sensor for the microcontroller (I used sparkfun RGB and gesture sensor APDS-9960)
- L293D (lower costs) or Motor Shield(I used Adafruit Motor/stepper/servo shield V2)
- 2 x pushbuttons
- 2 x LED
- 2 x 150 K resistors for the LEDs
2 x 10 k or 15 k resistors for the pushbuttons
adjustable transformator (5 - 12 V depending on what your peppermill motor needs ;Details follow)
Step 4: Overview: the Mechanical Part
First was to find a geared motor as most of the 5V motors do not have the strength to turn the key in the look.
I found a very cheap electric peppermill (~5$). Next problem to solve was to fix the key into the peppermill.
As I do not have a 3D printer I took morphable plastic (I used the prduct MultiMorph). Details follow.
Step 5: Overview: the Electric Part
- My aim was to open/close the door without using the key. Instead I wanted to use gestures as known from the smartphone to open close the door. So I bought a SparkFun RGB and Gesture Sensor.
- To connect the motor to the arduiuno I first used a L293D. This was not a good idea. Autumns in germany can be with much air humidity. This L293D gave up to work. So I switched to a Adafruit Motor Driver V2 which was more expensive. But if you live in california. Don't care. Take the L293D.
Step 6: Peparing the Peppermill
Remove the red parts. All you need is (except love)
- the metallic extension on the motor
- a part of the case for adjusting the motor on the door
After removing attach variable holders to the left and right side of the transparent plastic case.
With morphable plastic you can make a holder for the key
Step 7: The Cirquit Overview
Recommendations: As there are many pitfals : go slowly! One step after the other. Check, it the steps works. Than go on
If possible, do not solder at the beginning. Instead use jumper wires. If it works --> Solder it.
Steps (This is just an overview; details follow below):
- Adjust the motor shield on the arduino.
- Adjust the pushbuttons with the appropriate resistors on a breadboard an connect them to the motorsield
- Connect the motor inclusive separate voltage (see screenshot in one of the next steps)
Upload the sketch and check if the pushbuttons work
Connect the gesture sensor via male/female jumper wires to the arduino.
Prepare the LEDs with resistors
- If all works; Solder the parts one after the other and....
- Check if it still works!
If all works > Fix everything with hot glue
Step 8: The Arduino Cirquit #1 Motorshield
Adjust the motor shield on the arduino.
If available use extra long pins as shown above. No checks necessary at the moment
Connect the peppermill motor
Connect separate voltage as shown above
Step 9: The Arduino Cirquit #2 TWO Pushbuttons for Manual Open and Close (connect Pushbuttons to PINs 8 and 9)
THE PICTURE ABOVE IS JUST A SAMPLE. We use Pins 8 and 9 on the motor shield
If you have not yet used a pushbutton goto:
Important: For each button you need a 10k or 15k resistor
If you want to use my sketch, connect pushbuttons to PINs 8 and 9. It is not important which pushbutton to which pin.
Upload the sketch and Check
Step 10: The Arduino Cirquit #3 Attach Gesture Sensor
The image shows how to connect the gesture sensor to an arduino. As we use a motorshield use the corresponding motorshield pins :-)
Use the following pins:
Arduino Pin APDS-9960 Board Function<br> 3.3V VCC Power GND GND Ground A4 SDA I2C Data A5 SCL I2C Clock 2 INT Interrupt
Run your sketch again and do some checks using the serial monitor of the arduino IDE
If neccessary enhance the coding with some
statements to find errors
Step 11: The Arduino Cirquit #4 Attach 2 X LED
Solder 150 K resistors to one LED-leg
Solder some cable.
- It is useful for your overview to take a red cable for the long leg of the LED (=Anode)
- It is useful for your overview to take a black cable for the short leg of the LED (=Cathode)
If you want to use my sketch, connect:
ledGreen = PIN 13
ledYellow = PIN 12
Do some checks again
Step 12: Finally
If all works; Solder the parts one after the other and make a check after soldering a single part (Motor and buttons, gesture sensor, LEDs)
If everything is fine, put hot glue to fix the parts
- Adjust the circuit on the room-side
- Drill wholes in the door for 2 x LED and the gesture sensor.
Step 13: The Sketch
Good to know:
The gesture sensor throws an interrupt. Each gesture is represented by an integer.
In my simple example:
The green LED is on, when the sketch is waiting for gestures.
If a gesture is recognized the yellow LED turns on
The interger representation of a recognized gesture is added to the variable gesteKumuliert.
After amountGestures - times (In my example amountGestures = 6) gesteKumuliert gets evaluated.
- If it is lower than lower than 18 the user was waving left to right an vice versa
- If it is lower than greater than 17 the user was waving left to right an vice versa
If the user made a mistake the user can wait for resetTime which is set to 5 minutes and start again. The green ligh indicates if the sketch is ready again
The sketch is attached
If you have any questions leave a message