Project tutorial

Unlock Your Door With a Hand Gesture © CERN-OHL

Using gesture recognition technology to open door locks.

  • 1,744 views
  • 0 comments
  • 6 respects

Components and supplies

Apps and online services

About this project

I was browsing the TechCrunch website a while ago, when I stumbled on an article talking about gesture recognition technology being used to open door locks. While the product is not out yet, I thought to do my best with my smartphone and some components I have laying around.

Step 1: What We Need to Begin

Hardware

  • One door bolt (the one i am using is already mounted on the door)
  • Male to male jumper wires
  • A piece of striped wire

Software

  • The Arduino IDE which you can download here
  • Get the 1Sheeld Arduino library and the phone app here

PS: Make sure to go through the 1Sheeld intro tutorial here and how to use 1Sheeld with different Arduino boards here. I will be using Arduino Uno for the rest of the tutorial.

Step 2: Wiring and Setup

Make sure the power switch shown above is turned to 5V (for Arduino Uno users) if you're using another Arduino board check here.

  • Mount the 1Sheeld on the Arduino board
  • Connect your servo motor as shown in figure

VCC ==> to the 5V in your 1Sheeld GND ==> to your GND in 1Sheeld

Signal ==> to pin 10 in your 1Sheeld

Step 3: Software

  • Simply, the code reads the values of your phone's accelerometer and checks for a predefined gesture.
  • Upload the attached code and let's move to the next and final step.

PS: Make sure the 1Sheeld is in upload mode as seen in the image above.

Step 4: Putting It All Together

  • Mount the components on the back of the door as seen in pictures.
  • Attach the servo to the bolt using the striped wire.
  • Connect the servo to the 1Sheeld as specified in step 2.
  • Connect the Arduino to your laptop and make sure the code is uploaded.
  • Switch the 1Sheeld back to operating mode.
  • Open your 1Sheeld app and connect your phone to your 1Sheeld board (check 1Sheeld tutorial here if you haven't already).
  • Select the accelerometer and buzzer shields (the first two from the top), and press on the multiple shields icon at the top right of the app.
  • Now, hold your phone flat -screen facing upward, rotate your phone left until the screen is facing left, and put your phone in an upright position. (Or you can watch the video :D)
  • Voilà! The door is unlocked (and will automatically re-lock after a short delay).

Finally I want to encourage you to tinker around with the project; add or remove from it however you see fit. And if there's anything I can help you with, please let me know.

PS: Tune the delay to see what works best for you.

Code

FWGORKNIRXT8IHA.inoC/C++
//the code is made to unlock a door with a specific gesture 
// if you need help or want to contact me regarding the project you can do that at :adham.negm@ieee.org

#define CUSTOM_SETTINGS
#define INCLUDE_ACCELEROMETER_SENSOR_SHIELD
#define INCLUDE_TERMINAL_SHIELD
#define INCLUDE_BUZZER_SHIELD



/* Include 1Sheeld library. */
#include <OneSheeld.h>
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

int state=0;   //marks the state of the phone



void setup() {
  /* Start communication. */
  OneSheeld.begin();
    myservo.attach(10);  // attaches the servo on pin 10 to the servo object


}

void loop() {


  while(state==0){
     Terminal.println(AccelerometerSensor.getX());// print accelerometer values to the terminal shield for debugging purposes
    if(AccelerometerSensor.getX() > 5)
    {Terminal.println("A");
    state =1;}
  }

    
    while (state==1){
      
                  Terminal.println(AccelerometerSensor.getX()); // print accelerometer values to the terminal shield for debugging purposes
                 if(AccelerometerSensor.getX() > 8)
                   {Terminal.println("B");
                      state =2;}
    }


    while (state==2){
                  Terminal.println(AccelerometerSensor.getY()); // print accelerometer values to the terminal shield for debugging purposes
                  if(AccelerometerSensor.getY() > 5)
                  {Terminal.println("C");
                   state =3;}
      }


       while (state==3){
                  Terminal.println(AccelerometerSensor.getY()); // print accelerometer values to the terminal shield for debugging purposes
                  if(AccelerometerSensor.getY() > 8)
                  {Terminal.println("D");
                      Buzzer.buzzOn();
                      // Door Opens
                      for (pos = 0; pos <= 50; pos += 1) { // goes from 0 degrees to 180 degrees
                                                                 // in steps of 1 degree
                       myservo.write(pos);              // tell servo to go to position in variable 'pos'
                         delay(15);                       // waits 15ms for the servo to reach the position
                                                            }
                        Buzzer.buzzOff();
                        delay(10000);
                        Buzzer.buzzOn();

                      
                      //Door Closes
                      for (pos = 50; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
                           myservo.write(pos);              // tell servo to go to position in variable 'pos'
                             delay(15);}
                      Buzzer.buzzOff();

                   state =0;}
      }


  



}

Schematics

Schematic
Untitled pczam9w152

Comments

Similar projects you might like

Unlock your door with a knock

Project tutorial by Ashraf Nabil

  • 28,787 views
  • 15 comments
  • 67 respects

Smart Door with Face Unlock

Project tutorial by Divins Mathew

  • 13,028 views
  • 4 comments
  • 26 respects

Simple Door Prank with Arduino 1Sheeld

Project tutorial by Zowail

  • 1,502 views
  • 0 comments
  • 7 respects

Hand Gesture Controlled Robot

Project tutorial by Mayoogh Girish

  • 82,677 views
  • 86 comments
  • 95 respects

How can you Report Thief with a Photo on Twitter by Arduino

Project tutorial by ahmed ismail

  • 1,927 views
  • 0 comments
  • 8 respects

RFID Based Automatic Door System

Project showcase by Robodia Technology

  • 56,563 views
  • 26 comments
  • 138 respects
Add projectSign up / Login