How to connect a PIR sensor with FLORA?

Hello all,

I would like to create a device, using FLORA, a PIR sensor, and LEDs, that lights up LEDS when motion is sensed. However, I want to use the FLORA as the programmable device and NOT the Uno or Raspberry Pi. I have a background in Computer Science, but I am not as familiar with hardware at the level of connecting wires.

Does anyone know how I would connect the Adafruit PIR sensor to the Adafruit FLORA? There are plenty of tutorials on connecting LEDs to the FLORA, so I have that working already.

PIR Sensor: PIR (motion) sensor : ID 189 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
FLORA: FLORA - Wearable electronic platform: Arduino-compatible [v3] : ID 659 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Edit: Here's what I have so far.

GND to GND. Power to power (not sure if that is correct or if I need an external power source aside from the FLORA). D6 to Out.

I want to make the entire project wearable, as a belt or in a jacket, so I don't want to use a bread board. I have conductive thread, just no clue on the proper wiring.

I am attempting to use this code, found on the forums here to test out the PIR. No luck getting it working yet. I would appreciate any help! Thank you!

/*  
    Motion sensor for Arduino, example code
    Tutorial:  http://www.hacktronics.com/Tutorials/arduino-motion-sensor.html
    Copyright: Mark McComb, hacktronics LLC
    License: http://www.opensource.org/licenses/mit-license.php (Go crazy)
*/

const byte ledPin =  13;    // LED pin
const byte motionPin = 2;   // motion detector input pin 
byte senseMotion = 0;       // variable to hold current state of motion detector

void setup() {
  // set the digital pin directions
  pinMode(ledPin, OUTPUT);      
  pinMode(motionPin, INPUT);
}

void loop()
{
    // Now watch for burglers
    senseMotion = digitalRead(motionPin);
      if (senseMotion == HIGH) {    // burgler found!
      digitalWrite(ledPin, HIGH);
    } else {                      // no burgler, yet...
      digitalWrite(ledPin, LOW);
    }
}

Solution:

Got the PIR working with an answer from the Adafruit Forums! http://forums.adafruit.com/viewtopic.php?f=51&t=40973

Now, I just need to get the LEDs working when motion is detected.

Here is my Arduino code:

int pirPin = 9;  // use pin 9 on the Flora

void setup()
{
  pinMode(pirPin, INPUT);
  Serial.begin(9600);
}

void loop()
{
  long now = millis();
  if (digitalRead(pirPin) == HIGH)
  {
      Serial.println("MOVEMENT");
  }
  delay(500);
}

And my Python code:

import time
import serial
import smtplib
 
ser = serial.Serial('/dev/tty.usbmodem3a21', 9600)
    
while True:
    message = ser.readline()
    print(message)
    if message[0] == 'M' :
        print 'Motion Detected'
    time.sleep(0.5)

What voltage is your battery?

From the PIR description:
"Runs on 5V-16V power (if you need to run it off of 3V you can do that by bypassing the regulator, but that means doing a bit of soldering). Digital signal output is 3.3V high/low. Sensing range is about 7 meters (120 degree cone)"

There is no LED on pin 13 on the flora, it seems.
There is one on pin 7 though.
If the PIR is connected to pin D6, the code should read:

const byte ledPin =  7;    // LED pin
const byte motionPin = 6;   // motion detector input pin

Also, connecting the PIR using alligator clips may not be the best way to do this, it is very easy to short things out this way. In electronics, shorts are not cool.

Pieter