Motion Sensor

Motion Sensor


Simple Arduino example to print out PIR (pyroelectric infrared) values using a motion sensor director.


1 x PIR motion sensor detector
1 x Arduino Uno
1 x breadboard
female to male jumper wires
jumper wires



Arduino sketch

Inspect Serial monitor (9600) for PIR readings.
Adapted from Adafruit example.
 * Prints out PIR values on 9600.
 * Connect OUT of PIR to A0, GND to GND, VCC to 5V.
int pirPin = A0;  //define a pin for Photo resistor

void setup()
    Serial.begin(9600);  //Begin serial communcation
    pinMode(pirPin, INPUT);

void loop()
    Serial.println(analogRead(pirPin)); //Write the value of the PIR to the serial monitor.
    delay(10); //short delay