0
\$\begingroup\$

I'm attempting to get a PIR sensor working with an Arduino Duemilanove. Nothing fancy yet, just attempting to get accurate high or low values from it first.

The PIR sensor was bought from Cool Components. The alarm pin is an open collector and I am therefore using a pull up resistor (10k). There is a fritzing breadboard diagram below. The wire colours from the PIR are not the same however. Looking down at the circuit side of the PIR sensor with the wires at the bottom they are: red - brown - black (There is a link to an image of it on the Pirate Pad link below). So, here is the first point of confusion:

1) The datasheet for this component (check PiratePad) as supplied on the product page implies that the power should be the black wire and the alarm should be red. I've tried the circuit both ways and am getting anomalous results with both.

The second point of confusion is:

2) ...that depending on which way round I wire the power & alarm I am getting either no changes at all to the values from the alarm pin or seemingly random fluctuations between high and low.

Diagram:

Fritzing diagram  of PIR circuit

[RM]: As built: Note that connector housing appears to have retention latch slots on opposite side to website photos. If so the as-built diagram is as per mechanical pictures and the opposite of the word instructions.

enter image description here

int pirPin = 2; //digital 2
int ledPin = 13;

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


void loop(){
  int pirVal = digitalRead(pirPin);
  Serial.println(pirVal); 
  if(pirVal == LOW){ //was motion detected
    Serial.println("Motion Detected");
    digitalWrite(ledPin, HIGH);
    delay(2000); 
  }
  digitalWrite(ledPin, LOW);
}

And this is a few sources of information that I've found and followed to no avail: http://piratepad.net/sbIgN9KIeB

Any advice would be gratefully received.

\$\endgroup\$
8
  • \$\begingroup\$ From the colors my best guess would be black=ground, red=power, yellow=output. \$\endgroup\$ Commented Nov 18, 2013 at 14:04
  • \$\begingroup\$ Hi there. The PIR sensor in the fritzing diagram has different wire colour to the PIR sensor I have. Here is an image of my PIR sensor. \$\endgroup\$
    – gfte
    Commented Nov 18, 2013 at 14:52
  • \$\begingroup\$ Are there a set of jumpers on the backside? On my PIR (don't know the brand) there is a jumper that dis/enables the retriggering feature. This causes the sensor to continuously go on/off as it detects motion, turn it off and you get one single long detection signal. \$\endgroup\$
    – Ron J.
    Commented Nov 18, 2013 at 15:03
  • \$\begingroup\$ With the colors you show my guess would be black=ground, red=power, yellow=output. \$\endgroup\$ Commented Nov 18, 2013 at 15:45
  • \$\begingroup\$ @RonJ. Unfortunately not. There are no jumpers on the back of my PIR. I don't think the anomolous results I'm getting are consistent with non-retriggering though. \$\endgroup\$
    – gfte
    Commented Nov 18, 2013 at 17:57

4 Answers 4

1
\$\begingroup\$

These devices require (typically) 10-24v to operate reliably due to the onboard regulator. With a supply as low as 5v all sorts of stability issues will occur.

Try powering the PIR with 12v connected as its supply. Retain the 10k resistor though as this is performing the open collector level conversion and giving an output that will swing from 0-5v. Interestingly, if this were connected to the Arduino 3.3v terminal then the ouput level will swing from 0v to 3.3v and this is the beauty of of using open collector devices. They can allow compatibility between circuits of different logic and supply levels.

Have a look at this useful resource for the explanation of "open collector" devices.

http://www.evilmadscientist.com/2012/basics-open-collector-outputs/

\$\endgroup\$
0
\$\begingroup\$

It is clearly answered on the page you linked to for the PIR sensor. Quoting directly from the second paragraph:

Red wire is power (5 to 12V). Brown wire is GND. Black wire is open collector Alarm.

\$\endgroup\$
5
  • \$\begingroup\$ As I mentioned in the question this is not consistent with the information on the datasheet: sparkfun.com/datasheets/Sensors/Proximity/SE-10.pdf \$\endgroup\$
    – gfte
    Commented Nov 18, 2013 at 17:59
  • \$\begingroup\$ @gfte: But it is exactly consistant with your photo. \$\endgroup\$ Commented Nov 18, 2013 at 19:55
  • \$\begingroup\$ +1 I don't know why this got downvotes. As far as I can tell, Olin is spot on. The Cool Components web page specifies the connections, and the datasheet is black and white. The only thing you could safely infer from the datasheet is that the center wire is ground, which is again consistent with the web page. \$\endgroup\$
    – Joe Hass
    Commented Nov 18, 2013 at 22:47
  • 2
    \$\begingroup\$ @JoeHass This answer was downvoted when it was in it original form before editing by W5VO. In the original form the answer started with "This is a dumb question since..." \$\endgroup\$
    – mikeY
    Commented Nov 19, 2013 at 19:49
  • \$\begingroup\$ If we consider the 2 points that I raise in the original question this does partially answer one of them. I have tried the wires in this suggested arrangement and as suggested by the datasheet (which, to reiterate, are inconsistent/opposite). However trying both of these arrangements is still giving me the anomalous results (either no change or random change depending on circuit). I am hoping someone might be able to explain why this is? \$\endgroup\$
    – gfte
    Commented Nov 20, 2013 at 8:58
0
\$\begingroup\$

There APPEARS to be some inconsistency between housingf pinout and stated colours.

Tracing where the wires go should be easy enough.
Connection MAY be to 3 points shown or may not.

Supplied photos is 'a bit small' but may connect as shown below.

IF that is an LM324 or equivalent then power + should go to regul;ator (pin 4) and power - to ground or similar.

If the IC marked as a ?regulator? is one the rest follows.

Device shown as ?Qout? appears to be a transistor BUT seems to have a ? in the O/C lead to alarm out. Photo too poor to tell with certainty.

enter image description here


As a deleted answer noted, PIRs work by changes in level between zones - usually from something crossing an interzone boundary. A simple 2 or few zone detector may need substantial movement to trigger.

\$\endgroup\$
0
\$\begingroup\$

Not the least problem is that there are multiple similar models of PIR board commonly available, it seems, with little care for consistent wiring or conventional use of wire colors. There are at least two models with four mounting holes, and one model with two mounting holes.

As an example, here's a page that shows two different models, apparently is unaware they are different, and discusses wire functions by color, and shows some photos. Might be helpful or might not. http://itp.nyu.edu/physcomp/sensors/Reports/PIRMotionSensor

I suggest searching google images for "PIR sensor", which turns up hundreds of images of the product, and of wiring diagrams, and photos of built projects. Try to find your exact unit in some photos, and inspect the wiring used.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.