Shop OBEX P1 Docs P2 Docs Learn Events
PIR Sensor detects motion in empty room — Parallax Forums

PIR Sensor detects motion in empty room

kenkenkenken Posts: 13
edited 2013-10-02 20:27 in Accessories
Hello everybody,

My new PIR Sensor is connected to an Arduino using the code from the Arduino Playground (http://www.arduino.cc/playground/Code/PIRsense). It is directed towards a wall in an empty room. There is a window on the side but it is far enough away so no direct sunlight can come in. I tested it for 24 hours. Every 2-5 minutes it detected motion (even during the night).
It should not be caused by noise as it keeps quiet when I cover it with a ceramic cup.
I have also made sure that there is no motion during the calibration time.

Can anybody tell me what's wrong with this sensor? Or what I can do to make it work?

I would appreciate yor help very much.

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-03-15 15:35
    Which position is the Mode jumper in, H or L?
  • PublisonPublison Posts: 12,366
    edited 2011-03-15 15:46
    Why so many problems with the PIR lately? (Talking to myself)

    Try putting the PIF in the end of a empty paper towel tube to reduce the focal width, and tell us how that worked. I use this method all the time to remove extraneous triggers.

    And then toilet paper tube to fine tune.


    kenken wrote: »
    Hello everybody,

    My new PIR Sensor is connected to an Arduino using the code from the Arduino Playground (http://www.arduino.cc/playground/Code/PIRsense). It is directed towards a wall in an empty room. There is a window on the side but it is far enough away so no direct sunlight can come in. I tested it for 24 hours. Every 2-5 minutes it detected motion (even during the night).
    It should not be caused by noise as it keeps quiet when I cover it with a ceramic cup.
    I have also made sure that there is no motion during the calibration time.

    Can anybody tell me what's wrong with this sensor? Or what I can do to make it work?

    I would appreciate yor help very much.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-15 15:47
    Does the room have forced-air heating by any chance?

    -Phil
  • kenkenkenken Posts: 13
    edited 2011-03-16 07:13
    PJ Allen wrote: »
    Which position is the Mode jumper in, H or L?


    It is in H mode.
  • kenkenkenken Posts: 13
    edited 2011-03-16 07:14
    the heating is off, but spring is coming....
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-03-16 08:27
    Do you have a Radio Shack nearby? Many of those stores were stocking the PIR sensor and it might be worth picking up an extra just in the off chance you have a bad sensor.

    Robert
  • kenkenkenken Posts: 13
    edited 2011-03-16 08:44
    Publison wrote: »
    Why so many problems with the PIR lately? (Talking to myself)

    Try putting the PIF in the end of a empty paper towel tube to reduce the focal width, and tell us how that worked. I use this method all the time to remove extraneous triggers.

    And then toilet paper tube to fine tune.

    I tried but it didn't change anything. It seems to be a hopeless case?
  • kenkenkenken Posts: 13
    edited 2011-03-16 08:48
    Thanks for the hint. Unfortunately I had to mail order it. The delivery costs are more expensive than the sensor itself.
    So you think the sensor might simply not be working properly? It behaves really strange. Night or day, light or darkness it keeps firing every 2- 5 minutes.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-16 09:58
    I've had cases with my burglar alarm's PIR sensor (RadioShack-branded, not from Parallax) where, if the sun is low in the sky, shining through a tree whose shadow is projected on the wall of my shop through a window, and the wind is blowing, it will detect "motion".

    It will also detect tiny critters like mice. Are you sure that room is "empty" when you're not looking? :)

    -Phil
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-03-16 10:10
    kenken wrote: »
    Thanks for the hint. Unfortunately I had to mail order it. The delivery costs are more expensive than the sensor itself.
    So you think the sensor might simply not be working properly? It behaves really strange. Night or day, light or darkness it keeps firing every 2- 5 minutes.

    There isn't enough details yet to determine what the problem is yet. Just thought that if you had an opportunity to pickup another sensor it would be easy to swap that out and see if it made any difference.

    I think it is important to mention that we don't know for sure that the SENSOR it firing every 2-5 minutes. All we know at this point is that your program thinks it is....

    - How is everything wired up?

    - Do you have a diagram on how the PIR sensor is wired to your board?

    - Could you post a picture so we can see if anything looks out of place?

    - How are you powering your project? Is a wall power adapter or battery? Is the power source electrically noisey?

    - Is there any pull-up or pull down resistors installed on the I/O pin? Perhaps adding a 10K or ever 20K resistor may help.

    - Have you tried a different I/O pin in case something is messed up with the particular pin you've selected?

    Let us know,

    Robert
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-03-16 13:32
    ... if the sun is low in the sky, shining through a tree whose shadow is projected on the wall of my shop through a window, and the wind is blowing, it will detect "motion"...

    The same might happen if sunlight (or perhaps other IR sources such as distant campfires, hot factory stacks, etc.) ripple off of water. But I would think window glass would filter out those wavelengths. PIRs I've used in the past don't seem to "see" through windows.
  • kenkenkenken Posts: 13
    edited 2011-03-18 14:29
    Thanks Robert for your thoughtful questions:

    I don't have a camera at hand, but I have a lot of experience with soldering. So I can exclude for sure that the problem comes from inappropriate wiring. The connections are very easy: GND connects to GND, 5V to 5V and the output of the sensor to a digital pin of my arduino. I have tried several digital pins: same result.
    In the software I activated the internal pulldown resistor. According to your suggestion I also put a 10K external resistor. The wires from Arduino to the sensor are about 2m long.

    After observing for a longer time I came to the conclusion that it must nevertheless have something to do with some noise in the power system.

    First I had Arduino powered from USB: motion detection every 2-5 minutes (sensor always under ceramic cup)
    Then I used a separate power supply: the detection has a slightly longer intervall.
    And when I switch off my soldering iron, which is connected to the same multi-outlet power strip, the sensor detects motion. So I conclude that the other detections should come from other peaks somewhere else (computer?).

    The problem is that I have no other choice than having the Arduino, the computer and the power supply on the same power strip.

    Do you have any clue how I could filter the noise? I tried to put a 100nF ceramic capacitor (the only one around) between GND and 5V close to the sensor. No success. From my point of view the PIR sensor is a bit too sensitive. I mean what I else can I do than provide a separate power supply (which I would like to avoid for space reasons...)

    Thanks for your help so far,
    Ken
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-03-18 19:16
    2 meters to the PIR... that's a stretch.
    What if you locate the PIR near the arduina, for troubleshooting purposes, leads short as possible (<<2m)?

    PE - If they're not already, you could try loosely twisting the power leads, 1 turn / inch (25mm) or using 3-lead shielded mic-headphone cable? ** It'd be better/best to know whether the misfire occurs with the short leads.
  • kwinnkwinn Posts: 8,697
    edited 2011-03-18 20:58
    Try powering the micro and sensor from a battery and see if the problem goes away. If so it is power related. If not you are picking up radiated noise or IR.
  • kenkenkenken Posts: 13
    edited 2011-03-19 11:20
    I shorten the wires down to 20 cm (8 inches), but the detection is still the same.
    PJ Allen wrote: »
    2 meters to the PIR... that's a stretch.
    What if you locate the PIR near the arduina, for troubleshooting purposes, leads short as possible (<<2m)?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-03-19 12:55
    You could try a low-pass filter (attached), if it's really some
    power glitch forcing the PIR to re
    461 x 190 - 9K
  • kwinnkwinn Posts: 8,697
    edited 2011-03-19 14:42
    2 points.

    1 - This sensor has a digital output signal of constant minimum duration and voltage.
    2 - It detects changes in the infrared image of an area

    If you have covered the sensor (attached with 2 meter leads) and the triggering does not occur that is an indication that it is not a power or noise pickup problem. Using a battery as the power supply and repeating the test with the sensor covered and then uncovered should confirm this.

    To determine the cause you could use a video camera/recorder and microphone to monitor the area the sensor covers to see what if any events occur when the sensor is triggered. This could be something like the furnace coming on, a vehicle passing by, etc.
  • kenkenkenken Posts: 13
    edited 2011-03-21 09:59
    PJ Allen wrote: »
    You could try a low-pass filter (attached), if it's really some
    power glitch forcing the PIR to re
  • kenkenkenken Posts: 13
    edited 2011-03-21 10:18
    kwinn wrote: »
    If you have covered the sensor (attached with 2 meter leads) and the triggering does not occur that is an indication that it is not a power or noise pickup problem. Using a battery as the power supply and repeating the test with the sensor covered and then uncovered should confirm this.

    Thanks Kwinn, I have tried to use batteries, but that causes the Sensor to fired continuously. Don't ask me why. Might be because the Arduino I use is the NG-version that has trouble with external power?
    Neverthelss, in the end I need to power it via USB anyway, butI slowly get tired of this sensor. It seems it is out of control and slowly detecting motion under my cup - with or without low-pass filter. It starts to depress me... it is not usable I am afraid.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2011-03-21 16:13
    kenken wrote: »
    Thanks Kwinn, I have tried to use batteries, but that causes the Sensor to fired continuously. Don't ask me why. Might be because the Arduino I use is the NG-version that has trouble with external power?
    Neverthelss, in the end I need to power it via USB anyway, butI slowly get tired of this sensor. It seems it is out of control and slowly detecting motion under my cup - with or without low-pass filter. It starts to depress me... it is not usable I am afraid.

    kenken, I don't mind sending you another PIR sensor for comparison. Drop me your shipping address kgracey@parallax.com.

    Thanks, Ken
  • kwinnkwinn Posts: 8,697
    edited 2011-03-21 20:09
    kenken, I would suggest you take Ken Gracey up on his offer and try your setup with it. I have found that what they sell is of excellent quality and reliability. Never had a problem with any of it. I am also sure they will take extra care to make sure it is working before it goes out the door. If that sensor gives you problems then It is almost certainly something other than the sensor causing it.
  • kenkenkenken Posts: 13
    edited 2011-03-22 10:45
    Ken Gracey wrote: »
    kenken, I don't mind sending you another PIR sensor for comparison. Drop me your shipping address kgracey@parallax.com.

    Thanks, Ken

    Thank you for your offer of sending me a second PIR sensor for comparison.
    I think I might really use it:
    To exclude all errors on my side, I have borrowed another new Arduino board. With this one I was able to test the sensor with batteries. The sensor (still under a ceramic cup) kept detecting motion...
  • TrevorBTrevorB Posts: 2
    edited 2011-05-01 21:38
    I was having a similar issue with getting constant readings off the PIR using an Arduino UNO powering only by USB. My setup has the + fed from the 5V on the Arduino, - to the GND, and the OUT going to a 220 ohm resistor and LED going back to ground. I am getting the LED to light up every 4-6 seconds when the output jumper is set to low; it is on for 10-60 seconds when set to high. I measured the voltage across the 5V and GND on the Arduino when the circuit is attached and get 4.98 Vdc with occasonal dips to 4.95 Vdc. I get a measurement of 3.25 Vdc from the OUT if it is not connected to the circuit.

    I used the same circuit and powered the PIR straight from a DC power supply, adjusted to 5.01 Vdc, and now it seems to be stable. The OUT measures 3.28V when it pulses High. So, since the PIR is designed to work down to 3.3 Vdc, I adjusted my PS to 3.34 Vdc and ran to circuit again. It is stable again with an Vout of 1.62 Vdc. Just to be 75% scientific on this one, I put the circuit back on the Arduino, still reading 4.97 Vdc, and it is still randomly flashing.

    I had to make up for the other 25%, so I powered the Arduino with a AC-DC Wallwort converter, and ran it using the 9V, 7.5V and 6V settings. All of them allowed the Arduino to produce a stable 4.99 Vdc on the 5V pin and the sensor worked perfectly. There was only one last possible setup to test: Vin on the Arduino powered from the USB. The Vin was putting out 4.5 Vdc, and since the PIR works down to 3.3 Vdc, I gave it a shot and the original problem showed up again.

    I don't have enough equipment in my basement to scope the Arduino power supply for noise, so I am going to conclude that it has something to do with the power coming from the USB. I'll have to poke around the Arduino forums for solving this issue; they might have more to say.

    Trevor B
  • Jorge PJorge P Posts: 385
    edited 2011-05-18 10:01
    I have had this same problem when USB power was connected and my PIR was connected to 3.3 volts (3.28v) using the PE Kit.

    I connected the PIR + to 5V and the problem went away, but returned when I connected USB. In the KE Kit manual, the setup and testing section, it states that when no battery/power is connected, the LED should be dimly lit when USB is connected. Could this have anything to do with the false reading, eg. adding more power to the V+ bus on the bread board???

    NOTE: I have the Parallax PIR sensor that was the first version, Rev A that has no rev markings, not the new PIR Rev B. I purchased it from Radio Shack.

    So it works fine at 5V power without USB connected to the micro (Propeller in this case) for me. I have yet to test it out using 3.3V and connecting the PIR output to a micro pin, only tested with a led connected to gnd and PIR out.
  • piguy101piguy101 Posts: 248
    edited 2011-07-17 18:29
    I believe it could still be your power supply. I used a low current power supply, and when the PIR detected motion, a LED would go on and it would drop the voltage by less than a tenth of a volt, but the PIR did not like any change in voltage and kept firing off continually because every time it did, the voltage would drop ever so slightly. Does your circuit change the amount of current it draws when the PIR is in detected/not detected state?
  • kwinnkwinn Posts: 8,697
    edited 2011-07-18 00:58
    Having worked extensively with pir detectors that control lighting in buildings I can only say there are soooo many things that can cause false triggering. To date I have found that having a heating/cooling diffuser, laptop charging station, portable heater, or any device that changes the temperature or air flow in the field of view of the sensor will trigger the sensor. Even car headlights shining through a window will do it.

    Cover the sensor with a small box covered with aluminum foil or tape and see if the problem goes away. If it does the problem is NOT with the sensor or electronics.
  • kiranvarmakiranvarma Posts: 1
    edited 2013-10-02 09:10
    I am really thankful to the Ken Ken and Jorge P, Kwinn and other member who involved in this discussion.
    I too found the same problem with PIR sensor when i was interfaced with Stellaris Launchpad board powered by usb. I searched a lot of websites, no one provided the correct solution. Still the same problem - continous false trigger by PIR sensor without Human presence. Finally i was landed on this page, as discussed in this thread, i have provided separate power supply to the PIR sensor and then connected the grounds of the power supply and MSP430 launch pad ground pin. Its works fine. So we have to provide the noise less power supply and not to use USB power coming from the PC or LAPTOP.
    Once again Thank you all!

    I am going to post the same on my site:
    http://www.npeducations.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-10-02 09:17
    Backing up a bit, it seems you mentioned that with a cup over the sensor it does not trigger. This would seem to indicate that there is a change the IR field the sensor is seeing when the cup is not over it. If the sensor was defective or it were a power supply noise issue then I would expect the same results with the cup covering the sensor.

    Edit: I guess I misread...I thought you originally were not getting detection under the cup.
  • garyggaryg Posts: 420
    edited 2013-10-02 20:27
    Hi
    I've been following this thread very closely.
    Interesting!

    In the past, I've fabricated two projects using these PIR sensors.

    One of them, my Billy Bones deer deturrent, uses a tube similar to Publison's comment in Post 3
    This one works very good and is not affected by changes in ambient light or temperature.
    I do realize that PIR sensors are sensing heat changes.

    My second project was a Garden Owl deturrent.
    The Garden Owl was an attempt at using the full PIR sensor field of view.
    The Garden Owl works good from around sunset until about 9:00am.
    After about 9:00am, it starts false triggering every few minutes.

    This thread got me thinking that the PIR sensor is very sensitive in it's wide angle view.
    Restricting the view, while it makes it more focused, makes it more usable.

    Thats just my two cents worth.

    I hope this helps resolve your troubles.

    Gary
Sign In or Register to comment.