PIR Sensor FeatherWing

Easily connect the Adafruit PIR (motion) sensor to your Adafruit Feather or Particle Argon/Boron/Xenon with this custom designed FeatherWing.   The PIR Sensor FeatherWing is specifically designed to accept the Adafruit PIR (motion) sensor.   It includes the 10 k pullup, and you may optionally wire the LED on the board to a digital output.   The signal wire from the PIR sensor needs to be soldered to your digital input of choice.   A small 4 x 24 0.1" pitch prototype area is added too.  

This FeatherWing will work with the SparkFun OpenPIR or Adafruit PN 189 PIR or Parallax SKU 555-28027 PIR motion sensor.  

 

 

PIR Sensor FeatherWing PCB

 


/*

  SE-10 PIR motion sensor


  The signal pin goes high when motion is detected, low when not detected.  
  Use a 10k pullup resistor between the signal and power.
  
  The LED lights when motion is detected, turns off when motion stops.

*/

////////////////////////////////////////////////////////////////////////
//  SE-10 PIR motion sensor
byte pinPIRsensor = 5;  // Signal from PIR sensor
byte pirState = LOW;   
// pinMotionLED is optional digital output for LED indication of 
// PIR activity detected.
byte pinMotionLED = A5; //19
////////////////////////////////////////////////////////////////////////


void setup() {
  pinMode(pinPIRsensor, INPUT);
  delay(1);
  
  pinMode(pinMotionLED, OUTPUT);
  delay(1);
  digitalWrite(pinMotionLED, LOW);
  delay(1);

  // Blink pinMotionLED to verify it is working..
  for (int i=1; i<10; i++) {
    digitalWrite(pinMotionLED, HIGH);
    delay(25);
    digitalWrite(pinMotionLED, LOW);
    delay(25);
  }
  
} // setup()

 
void loop(){
  
  if (digitalRead(pinPIRsensor) == HIGH) {
    if (pirState == LOW) {
      // motion detected
      digitalWrite(pinMotionLED, HIGH);
      pirState = HIGH;
    }
  } else {
    if (pirState == HIGH) {
      // motion ended
      digitalWrite(pinMotionLED, LOW);
      pirState = LOW;
    }
  }
  
  
} // loop()

 


Do you need help developing or customizing a IoT product for your needs?   Send me an email requesting a free one hour phone / web share consultation.  

 

The information presented on this website is for the author's use only.   Use of this information by anyone other than the author is offered as guidelines and non-professional advice only.   No liability is assumed by the author or this web site.