Project tutorial
Secure Your Home by a Password

Secure Your Home by a Password © GPL3+

Activate your security system with Arduino and 1sheeld.

  • 2,555 views
  • 0 comments
  • 3 respects

Components and supplies

About this project

A security system is built as we use the keypad sheeld in 1sheeld application to enter a specific password (password is 2016) to activate the security system (LED is on as an indication of a right password).

If the door is open (knob at angle 45 or more)

Light sensor is on, in 1sheeld application camera sensor is on taking photos, music player is on indicating alarm and sms is sent to your twitter account.

1sheeld library is used .

So you need

Download 1sheeld library from this link

http://1sheeld.com/downloads

Download 1sheeld app from this link

https://play.google.com/store/apps/details?id=com...

Get this tutorial to know how to use 1sheeld

http://1sheeld.com/tutorials/getting-started/

Get started:

1- Put the knob sensor and the light sensor from the grove kit to the base board.

2- Connect it with the arduino.

3- Put your 1sheeld on the arduino.

4- Connect between 1sheeld application on your smart phone and the board.

Have Fun :D 

Code

codeArduino
security system sketch
#define CUSTOM_SETTINGS
#define INCLUDE_KEYPAD_SHIELD
#define INCLUDE_CAMERA_SHIELD
#define INCLUDE_TWITTER_SHIELD
#define INCLUDE_MUSIC_PLAYER_SHIELD

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

/* Define an iterator. */
int iterations = 0;
/* A name for the LED on pin 13. */
int ledPin1 = 13;
int sensorPin = A0;    // select the input pin for the potentiometer
int ledPin2 = 5;      // select the pin for the LED
int BuzzerPin = 4;    // select the pin for the Buzzer
int sensorValue = 0;  // variable to store the value coming from the sensor
bool flag ;
int push = 12;


void setup()
{
  /* Start communication. */
  OneSheeld.begin();
  /* Set the LED as output. */
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(BuzzerPin, OUTPUT);
  pinMode(sensorPin, INPUT);
}

void loop()
{
  /* Check if "1" is pressed, iterate one time. */
  if (iterations == 0 && isTwoPressed())
  {
    iterations++;
  }
  /* Check if "2" is pressed, iterate one time. */
  else if (iterations == 1 && isZeroPressed())
  {
    iterations++;
  }
  /* Check if "3" is pressed, iterate one time. */
  else if (iterations == 2 && isOnePressed())
  {
    iterations++;
  }
  /* Check if "4" is pressed, iterate one time. */
  else if (iterations == 3 && isSixPressed())
  {
    iterations++;
  }
  /* Check if any other button is pressed, reset iterations. */
  else if (isOtherButtonPressed())
  {
    iterations = 0;
  }

  /* Check if the number of iterations is 4, blink the LED. */
  if (iterations == 4)
  {
    digitalWrite(ledPin1, HIGH);
    // OneSheeld.delay(500);
    //  digitalWrite(ledPin1,LOW);
    flag = true;
    /* Reset the iterator. */
    iterations = 0;
  }

  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  if ( (sensorValue >= 45) && (flag ) )
  {
    digitalWrite(ledPin2, HIGH);
    /* Turn on the camera flash. */
    Camera.setFlash(ON);
    /* Take the picture. */
    Camera.rearCapture();
    /* Wait for 10 seconds. */
    OneSheeld.delay(10000);
    /* Set the volume. */
    MusicPlayer.setVolume(5);
    /* Turn on the music. */
    MusicPlayer.play();
    /* Post the picture on Twitter. */
   // Twitter.tweetLastPicture("Posted by @1Sheeld");
   if ( push == 1)
   { flag = false ;
   }
  }


}

/* Helper functions check if a certain button is pressed by checking its row and column. */

boolean isTwoPressed() {
  return Keypad.isRowPressed(0) && Keypad.isColumnPressed(1);
}

boolean isZeroPressed() {
  return Keypad.isRowPressed(3) && Keypad.isColumnPressed(1);
}

boolean isOnePressed() {
  return Keypad.isRowPressed(0) && Keypad.isColumnPressed(0);
}

boolean isSixPressed() {
  return Keypad.isRowPressed(1) && Keypad.isColumnPressed(2);
}

boolean isOtherButtonPressed() {
  return ((Keypad.isAnyColumnPressed() || Keypad.isAnyColumnPressed()) && !isTwoPressed() && !isZeroPressed() && !isOnePressed() && !isSixPressed());
}

Schematics

fritzing circuit
Fritzing

Comments

Similar projects you might like

Home Automation using Arduino and 1Sheeld

Project tutorial by Ramy ElMallah

  • 4,460 views
  • 2 comments
  • 12 respects

Arduino - Remotely Open Door via Web with Pattern Password

Project tutorial by phpoc_man

  • 3,232 views
  • 0 comments
  • 18 respects

Secure YUN

Project tutorial by Abhishek

  • 1,721 views
  • 1 comment
  • 12 respects

Control your windows and Bust burglars

Project tutorial by Mahmoud Labib

  • 3,300 views
  • 0 comments
  • 5 respects

Security System With 1Sheeld

Project showcase by nada abdelnaby mady

  • 2,189 views
  • 0 comments
  • 2 respects

Motion Sensing Alarm With Keypad & Password

Project showcase by thehack904

  • 18,438 views
  • 50 comments
  • 56 respects
Add projectSign up / Login