Surilli
Published © LGPL

Detect Motion in Your Surrounding Using PIR Motion Sensor

PIR-based motion detector is used to sense movement. They are commonly used in burglar alarms and automatically-activated lightning systems.

EasyFull instructions provided15 minutes159
Detect Motion in Your Surrounding Using PIR Motion Sensor

Things used in this project

Hardware components

Surilli WiFi
Surilli WiFi
×1
Jumper wires (generic)
Jumper wires (generic)
×3
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

untitled_sketch_2_MZIKkTIJl2.fzz

Code

MotionSensor_final.ino

C/C++
int motion_Sensor_Pin = 16;//Motion sensor output pin is connected to pin 16 of surilli.
int Led_Pin = 0;//built-in LED pin is on pin number 0.
void setup()
{
    pinMode (motion_Sensor_Pin,INPUT);//output from motion sensor is declared as input for surilli.
    pinMode (Led_Pin, OUTPUT);//built-in LED is declared as output
    Serial.begin(9600);
    digitalWrite (Led_Pin,LOW);//initially built-in LED is set LOW.
}

void loop ()
{
      delay(500); //this delay is to let the sensor settle down before taking a reading
      int sensor_value = digitalRead(motion_Sensor_Pin);//read the value from motion sensor and stores in variable "sensor-Value"
  if(sensor_value == 1)
    {
      digitalWrite(Led_Pin,HIGH);//if sensor value is 1 then built-in LED will turn OFF.(LED inverted)
      Serial.println("Motion Detected");
      Serial.println(sensor_value);//prints digital value from sensor.
      delay(100);
    }
else if (sensor_value == 0)
    {
      digitalWrite(Led_Pin,LOW);//if sensor value is 0 then built-in LED will turn ON.
      Serial.println("Searchng For Motion");
      Serial.println(sensor_value);//prints digital value from sensor.
      delay(100);
    }
}

Credits

Surilli

Surilli

22 projects • 19 followers
Surilli is a premiere Internet of Things centric Technology Company aimed at providing cutting edge innovative solutions.
Contact

Comments