Demo Video

In this project we will create a simple circuit with the gizDuino LIN and PIR motion sensor that can detect movement.

Materials:

Breadboard:

Connections:
RED LED pin 13
PIR Motion Ouput pin 2, Vcc +5V, GND-GND

Upload the following code to the Arduino IDE

/*
Motion Detector using PIR Human Motion sensor
This is an example sketch where you will determine if there's
a motion on your surrounding with LED indicator. Motion Detected,
LED is HIGH.
*/
int LED_INDICATOR = 13;
int PIR_SENSOR = 2;
int STATS = LOW;
int VALUE = 0;
void setup() {
Serial.begin(9600);
pinMode(LED_INDICATOR, OUTPUT);
pinMode(PIR_SENSOR, INPUT);
}
void loop(){
VALUE = digitalRead(PIR_SENSOR);
if (VALUE == HIGH) {
digitalWrite(LED_INDICATOR, HIGH);
delay(100);
if (STATS == LOW) {
Serial.println("MOTION DETECTED! - HIGH");
STATS = HIGH;
}
}
else {
digitalWrite(LED_INDICATOR, LOW);
delay(200);
if (STATS == HIGH){
Serial.println("MOTION STOPPED!");
STATS = LOW;
}
}
}

Documented by: Kayle Urbano

For more details about the projects, see the following reference: Electronics Projects, Tutorials and Reviews. (n.d.). Retrieved from https://randomnerdtutorials.com/