Introduction: Control Your Car Lock With Smart Phone , Don't Care About Distance

About: I'm an Egyptian student studying communications and electronics engineering
  • Let's say that you are very busy at work and you forgot something in your car then you decide to send someone to bring it to you but you don't trust him 100% to give him the keys of your car so what will you do now?
  • What about being in another town far away from your car, the keys are in your pocket and your son wants his bike from the trunk of the car, how can he open the car now?
  • Ouch ...You forgot your keys inside the car and the car is locked how to open it?? should you break the window?? how can you open it?

the solution for these problems is very easy with this smart lock.

The solution for these problems:

when some one is in front of your car and want to open it all he have to do is to press the push button on the door of the car then the mobile camera placed in the car will take a photo of him and send it to the car owner through email and the car owner has the ability to open the lock of the car by calling the phone inside the car, the car lock will open easily and after a short time the door locks again automatically

note: You can use the same lock for your house or your room.

Step 1: Step 1:Tools Used:

  • Hardware
  1. An Arduino board (i use Arduino Uno )
  2. 1Sheeld (1Sheeld

    is a platform for Arduino that allows you to tap into your smartphone's sensors and capabilities and lets you use them in your Arduino projects.)

  3. a micro servo
  4. push button
  5. male to male jumper wires
  • Software
  1. The Arduino IDE which you can download here
  2. 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: Step 2:Wiring and Setup

  1. mount the 1sheeld on the Arduino board.
  2. Make sure the power switch shown above is turned to 5V (for Arduino UNO users) if you're using another Arduino board check here.
  3. Connect your servo motor and the push button as shown in figure.

Step 3: Step 3:The Software

  • Write the following code in the Arduino IDE
  • Upload the code to the Arduino

PS:make sure the 1sheeld is in upload mode as seen in the image above

<p>/*
</p><p>Author: Mohaned Hossam<br>Email: moha.hossam96@gmail.com</p><p>Project name: Control your car lock with smart phone , don't care about distance</p><p>This project is a smart lock project and it is used to unlock your car </p><p>by making a phone call from any where by a mobile number written here in the code </p><p>There is also a button on the car in which a photo is taken by the mobile inside the car after that button is pressed</p><p>*/</p><p>#define CUSTOM_SETTINGS<br>#define INCLUDE_CAMERA_SHIELD
#define INCLUDE_EMAIL_SHIELD
#define INCLUDE_PHONE_SHIELD</p><p>#include <Servo.h>
/* Include 1Sheeld library. */
#include <Onesheeld.h></p><p>/* A name for the button on pin 12. */
int buttonPin = 12;</p><p>int pos = 0; //the position of the servo
</p><p>char callingNumber[] = "enter the mobile no. here"; //the mobole no. of the car owner</p><p>Servo myservo;  // create servo object to control a servo</p><p>void setup()
{
  /* Start communication. */
  OneSheeld.begin();
  /* Set the button pin and onoff as input. */
  pinMode(buttonPin, INPUT);
  pinMode(onoff, INPUT);
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo.write(pos);              // tell servo to go to position in variable 'pos'</p><p>}</p><p>void loop()
{
  /* Always check the button state. */
  if (digitalRead(buttonPin) == HIGH)
  {
    /* Turn on the camera flash. */
    Camera.setFlash(ON);
    /* Take the picture. */
    Camera.rearCapture();
    /* Wait for 10 seconds. */
    OneSheeld.delay(10000);
    /* send the picture via Email. */
    Email.attachLastPicture("
 ", "Someone is on the door" , "  " , 0 );
  }
  if ( Phone.isRinging() )
  {
    /* Check if the phone number calling is the same as our variable. */
    if (strcmp(Phone.getNumber(), callingNumber) == 0)
    {</p><p>      for (pos ; pos <= 180; 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(0);                       // add delay if required
      }</p><p>      delay(20000);
    }
  }
  for (pos ; pos >= 0; pos -= 1) // goes from 180 degrees to 0 degrees
      {
        myservo.write(pos);              // tell servo to go to position in variable 'pos'
        delay(0);                       </p><p>      }
}</p>

Attachments

Step 4: Final Step: Let's Have Everything Together

  1. Mount everything in the car as shown in the figure and put the mobile phone in somewhere inside the car to be able to take photos of the person in front of the car's door. (This step differs from each car to another)
  2. open the 1sheeld application from your smart phone
  3. connect the 1sheeld to your smartphone then open the camera, email and phone shields
  4. put the push button some where outside the car and make sure it is seen and dont worry it is very cheep nobody would think to steal it :D
  5. now it's your time to test that everything is working perfectly

PS: Dont forget to keep your mobile's data and Bluetooth on.

PS: You have to sign in your email any email on the mobile phone which will send the image taken by the camera.