Amr Saleh
Published

Motion activated SMS Shield- Tutorial

Send an SMS every time something moves in your room

Full instructions provided6,256
Motion activated SMS Shield- Tutorial

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
Comment
×1
1Sheeld
1Sheeld
Comment
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
Comment
×1
Breadboard (generic)
Breadboard (generic)
Comment
×1
LED (generic)
LED (generic)
Comment
×1
Jumper wires (generic)
Jumper wires (generic)
Comment
×1

Code

file_7669.txt

C/C++
//1sheeld.com for the steps on adding the libraries to your arduino program

#include <OneSheeld.h> 
int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR sensor)
int PIR = LOW;             
int val = 0;                    

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input
   OneSheeld.begin(); 
}

void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON   
    delay(150);

    if (PIR == LOW) {
       SMS.send("0123456789","Motion DETECTED");  // change number with your own here
       PIR = HIGH;
    }
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
        
    if (PIR== HIGH){
      PIR = LOW;
    }
  }
}

Credits

Burger

Posted by Amr Saleh

Comments