Christiaan Neil Burger
Published © LGPL

My Motion Activated Security Cam project

This project will capture an image and upload it to twitter when motion is sensed!

IntermediateFull instructions provided26,342
My Motion Activated Security Cam project

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
1Sheeld
1Sheeld
×1
1Sheeld
1Sheeld
×1
Jumper cables
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
LEDs with resistors
×1
Android phone with Bluetooth
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

PIR- Motion sensor and 1sheeld

Code

Motion Activated Security Camera CODE

Java
Add to Arduino IDE and UPLOAD to 1Sheeld and make sure that on the 1Sheeld the UART switch is switched to the off position.
//Need to include the following to avoid memory overload:
#define INCLUDE_SMS_SHIELD //sms
#define CUSTOM_SETTINGS
#define INCLUDE_CAMERA_SHIELD //camera
#define INCLUDE_TEXT_TO_SPEECH_SHIELD //text to speech
#define INCLUDE_FACEBOOK_SHIELD //facebook
#define INCLUDE_TWITTER_SHIELD //twitter

#include <OneSheeld.h> 
int ledPin = 8;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR sensor)
int PIR = LOW;             //The motionsensor's value
int val = 0;  


void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare reading sensor as input, this is the part on the Motions sensor that find the difference between no movement and movement
   OneSheeld.begin(); // Begin the onesheeld code

 
}

void loop(){
  //loop begins
    val = digitalRead(inputPin);  // read input value of the movement dectetion pin
  if (val == HIGH) {            // check if the is movement
    digitalWrite(ledPin, HIGH);  // turn LED ON  to indicate movement was found  
    delay(100); //Delays the loop for 1/10 second

    
    if (PIR == LOW) { //if the PIR value is equal to LOW do the following:
       SMS.send("0123456789","Motion DETECTED , Check Twitter for image"); //ADD your NUMBER INSTEAD OF 0123456789 , EDIT YOUR OWN
       PIR = HIGH; //Set PIR to HIGH and NOT LOW sothat it wount do a infinite loop
       TextToSpeech.say("got you"); //phone speaks this is not neaded just remove if you want this silenced 
       Camera.setFlash(ON); // Putting the flash on incase it night
       Camera.rearCapture(); //Taking the picture from back camera
       Twitter.tweetLastPicture("Posted with #1sheeld @1sheeld"); //posting the image to twitter
      // Facebook.postLastPicture("Posted by User");  //ENABLE this if you want to USE FACEBOOK          
       delay(1000); // Delay for 1 seconds sothat the value resets and th movement is different
       
    
    }
  } else { // if no movement
      digitalWrite(ledPin, LOW); // turn LED OFF        
      if (PIR== HIGH){ //nested if , if that value was HIGH , set to low and it wil check everything

      PIR = LOW;
      //loop restarts
    }
  }
}

Credits

Christiaan Neil Burger

Christiaan Neil Burger

3 projects • 9 followers
Friendly an love to solve problems and invent.

Comments