Things used in this project

Hardware components:
Ard yun
Arduino Yun
×1
Tens70
9V battery (generic)
×1
11026 02
Jumper wires (generic)
×1
range sensor hc-sro4
×1
Software apps and online services:
Logo header
Temboo
Wordmark red
Twilio SMS Messaging API

Schematics

Connections
Connections

Code

IntruderDectectorTESTArduino
//TEST CODE 


#include <SoftwareSerial.h>

int trigPin = 2;
int echoPin = 4;
long duration, cm, inches;

void setup() {

  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  delay(5000);
  Serial.println("Patrol Mode Initiated...");
}

void loop()
{

  digitalWrite(trigPin, LOW);
  delayMicroseconds(1);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(2);
  digitalWrite(trigPin, LOW);

  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);

  inches = (duration / 2) / 74;
  Serial.println(inches);
  if (inches < 20 || inches > 1000) {
  Serial.println("Intruder Detected!");
  Serial.println("Sending text Notification...");
  delay(5000);
  Serial.println("Patrol Mode Initiated...");
  }//end if statement




}//ends loop
Full Code with Text FuntionalityArduino
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information, as described below
#include <SoftwareSerial.h>

int numRuns = 1;   // Execution count, so this doesn't run forever
int maxRuns = 5;   // Maximum number of times the Choreo should be executed
int trigPin = 2;
int echoPin = 4;
long duration, cm, inches;

void setup() {
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  // For debugging, wait until the serial console is connected
  delay(5000);
  Bridge.begin();
  Serial.println("Patrol Mode Initiated...");
}

void loop() {

  digitalWrite(trigPin, LOW);
  delayMicroseconds(1);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(2);
  digitalWrite(trigPin, LOW);

  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);

  inches = (duration / 2) / 74;
  Serial.println(inches);
  if (inches < 20 || inches > 1100) {
  Serial.println("Intruder Detected!");
  Serial.println("Sending text Notification...");

  if (numRuns <= maxRuns) {
    Serial.println("Running SendSMS - Run #" + String(numRuns++));
    
    TembooChoreo SendSMSChoreo;

    // Invoke the Temboo client
    SendSMSChoreo.begin();

    // Set Temboo account credentials
    SendSMSChoreo.setAccountName(TEMBOO_ACCOUNT);
    SendSMSChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
    SendSMSChoreo.setAppKey(TEMBOO_APP_KEY);
    
    // Set Choreo inputs
    SendSMSChoreo.addInput("AuthToken", "e684a4f37ee686636e2b1e24c12f4279");
    SendSMSChoreo.addInput("To", "+14125236422");
    SendSMSChoreo.addInput("From", "+14123608633");
    SendSMSChoreo.addInput("Body", "Intruder Detected!!!!!!");
    SendSMSChoreo.addInput("AccountSID", "ACf3be01a84d78829e5619c16b6e16a9e4");
    
    // Identify the Choreo to run
    SendSMSChoreo.setChoreo("/Library/Twilio/SMSMessages/SendSMS");
    
    // Run the Choreo; when results are available, print them to serial
    SendSMSChoreo.run();
    
    while(SendSMSChoreo.available()) {
      char c = SendSMSChoreo.read();
      Serial.print(c);
    }
    SendSMSChoreo.close();
  }

  Serial.println("Waiting...");
  delay(10000); // wait 10 seconds between SendSMS calls
  
  Serial.println("Patrol Mode Initiated...");
  
  }//end if statement 
  
}//ends loop

Credits

Photo
Matthew Hallberg

My name is Matthew and I attend the University of Pittsburgh for Info Sci and CS. I need motivated friends, serious inquiries send me an email.

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

3D-Printed Prank Vibrating Cup
Easy
  • 1,447
  • 14

Full instructions

The instant your prankee lifts up this 3D-printed cup it starts violently vibrating! The electronics separate from the cup for easy washing.

The Magic Display With Arduino - The Mind Reader
Easy
  • 1,631
  • 6

Full instructions

The Magic Display With Arduino can figure out with a few clues what is your choose on a card with 64 options of numbers, letters or symbols.

Very First Hands On Arduino - Voice Activated LED
Easy
  • 953
  • 9

Full instructions

Use voice command to turn LED on or off.

Get Connected! WiFi Registration Using AP Mode!
Easy
  • 1,640
  • 16

Full instructions

Stop reflashing your devices everytime the WiFi password changes! Learn how to use anduinoWiFi and AP mode to initiate WiFi registration!

Car Blinker
Easy
  • 279
  • 4

Protip

Blink for Vehicles, such as bikes and skates. Easy.

The Soldering Iron Controller for Hakko T12 Tips
Easy
  • 8,972
  • 27

Full instructions

Per-tip calibration and high-frequency temperature check by Timer1.

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback