Pages: [1]   Go Down
Author Topic: Problem reading PIR sensor  (Read 1129 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello people

I have trouble reading og a PIR sensor and i can't see what im doing wrong. Im following the tutorial on http://bildr.org/2011/06/pir_arduino/

The problem is that it keep printing motion detected no matter what i do.  smiley-sad

I used the code used in the tutorial:

Code:
int pirPin = 2; //digital 2

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

void loop(){
  int pirVal = digitalRead(pirPin);

  if(pirVal == LOW){ //was motion detected
    Serial.println("Motion Detected");
    delay(2000);
  }

}


I've added a picture as the hook up aswell:
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the sensor you use : https://www.sparkfun.com/products/8630  ?
I can't see the problem, the wiring and sketch seems okay.

Do you have a multimeter, to check the output of the PIR sensor ?
« Last Edit: August 16, 2012, 08:33:50 am by Krodal » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't have that no.. :/

But i do have three of the sensors laying here and they are all acting the same way.

edit: and yes that is the sensors i use.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I have a PIR sensor here, that keeps 'seeing' motion if it is above 25 degrees.
Or it could take 10 minutes after startup.
Did you wait half an hour ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

no i hav'nt tried that. Would it make any difference? This is what is says from the site where i got it from:

"This is a simple to use motion sensor. Power it up and wait 1-2 seconds for the sensor to get a snapshot of the still room. If anything moves after that period, the 'alarm' pin will go low.

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

This unit works great from 5 to 12V (datasheet shows 12V). You can also install a jumper wire past the 5V regulator on board to make this unit work at 3.3V. Sensor uses 1.6mA@3.3V.

The alarm pin is an open collector meaning you will need a pull up resistor on the alarm pin. The open drain setup allows multiple motion sensors to be connected on a single input pin. If any of the motion sensors go off, the input pin will be pulled low.

The connector is slightly odd but has a 0.1" pitch female connector making it compatible with jumper wires and 0.1" male headers."


edit: waiting did'nt give anything.
« Last Edit: August 16, 2012, 10:13:12 am by mortni11 » Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I haven't got any clue.

The pull-up resistor could make bad contact.
If you disconnect the sensor (so the pull-up resistor will keep the signal high) does that stop the messages "motion detected" ? If that doesn't stop it check the resistor.

You need a multimeter to measure the voltages of the sensor. The cheap digital ones are only 4 or 5 euros/dollars on Ebay, and that includes shipping.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 83
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If want to test the sensor to rule out if sensor is the issue, you can do it with test circuit in step 4 without multimeter.  All the best!

http://www.instructables.com/id/PIR-Motion-Sensor-Tutorial/step4/Testing-your-PIR/
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

check the wiring on your sensor.  much to my dismay, i received a few that had wiring as follows:

Brown - Ground
Red - Signal
Black - 5v

it was strange connecting 5v to the black wire but it worked.
Logged

Pages: [1]   Go Up
Jump to: