2

I had a nice setup of a PIR sensor on my Raspbrerry Pi working for about 3 months controlling a light. Recently I had trouble with the light always being on. Checking the logs I noticed that there is a frequent false positive signal. I tried changing the environment and eliminating anything that could cause a problem but to no help.

I finally did a simple test, blocked the PIR so that it does not "see" anything, and ran a small test program to see what I get from the sensor. The results are very strange. I tested it now for 7 times (every time restarting the Pi). In 2 cases, I did not see any false positives. In the rest, I receive a regular pattern of false positives eventhough the sensor is not "seeing" anything. The time difference between the false positive signals seem to be almost constant, but vary between tests.

As an example, here is the log of my last test:

[2016-06-11T17:35:01.701Z]  INFO: testPIR/6377 on raspberry: Value: 1
[2016-06-11T17:35:18.020Z]  INFO: testPIR/6377 on raspberry: Value: 0
[2016-06-11T17:36:07.887Z]  INFO: testPIR/6377 on raspberry: Value: 1
[2016-06-11T17:36:18.044Z]  INFO: testPIR/6377 on raspberry: Value: 0
[2016-06-11T17:37:01.733Z]  INFO: testPIR/6377 on raspberry: Value: 1
[2016-06-11T17:37:18.043Z]  INFO: testPIR/6377 on raspberry: Value: 0
[2016-06-11T17:38:07.889Z]  INFO: testPIR/6377 on raspberry: Value: 1
[2016-06-11T17:38:18.007Z]  INFO: testPIR/6377 on raspberry: Value: 0
[2016-06-11T17:39:01.774Z]  INFO: testPIR/6377 on raspberry: Value: 1
[2016-06-11T17:39:17.907Z]  INFO: testPIR/6377 on raspberry: Value: 0
[2016-06-11T17:40:07.891Z]  INFO: testPIR/6377 on raspberry: Value: 1

This is too regular to be random noise.

I use the onoff Nodejs module to read from the sensor.

Here is my test code:

var Gpio = require('onoff').Gpio,
  pir = new Gpio(17, 'in', 'both');

var bunyan = require('bunyan');
var log = bunyan.createLogger({
   name: 'testPIR'
});

pir.watch(function(err, value) {
  if (err) exit();
  log.info('Value: ' + value);
});

function exit() {
  pir.unexport();
  process.exit();
}

Any idea what could be the source of the problem?

PS: I believe that this is the same phenomenon that is reported by this question but since I am new here, I did not have enough reputation to leave any comments.

  • You need to find out if it is a software or hardware problem first. Can you use a different library on the Pi and see if you still get false alarms? – joan Jun 11 '16 at 19:07
  • 1
    I've seen PIR sensors do odd things when connected to the wrong power source. For example, most that I've dealt with require 5V on their VCC pin, but output a GPIO-safe 3.3V on their OUT pin. However, connecting their VCC to 3.3V results in odd readings on the OUT pin (couldn't say if it was a regular on/off as you're seeing - I didn't dig into it that far). – Dave Jones Jun 12 '16 at 21:01
  • 1
    Sorry I have been on a business trip. Here is what I know so far: sensors: I tried two sensors (same provider) and I see the regular pattern of false detection. libaries I wrote a simple code in python to print the detections and ran it in parallel to the nodejs one, they both detect the same pattern. power I am using 5V. other software last night I reinstalled the OS with almost nothing extra except nodejs and nginx. Today I tested the sensor for about 2 hours. Strangely I get false detection of almost 120s intervals. See the data here: goo.gl/XYvZSc – Trident Jun 20 '16 at 21:23
  • I'm working on a new Pi project and ran across the same problem. Background: I have six (6) PIR sensors working with ESP-1 and ATMega328 boards in my house without issues (versions 1 and 2 of the PIR sensor). My current project uses a Raspberry Pi 3, latest kernel, application in python 2.7, 5 threads, several I2C devices and interrupts from VCNL4010 and PIR sensors. The VCNL4010 interrupt on GPIO24 works fine. The PIR interrupts on motion (rising and falling) as it should but ... I get periodic interrupts on the PIR GPIO23 every ~60 seconds. – Dave Wilson Aug 8 '16 at 16:17
1

I'm wondering if it's because the PIR is in the same case as the Raspberry Pi and it's picking up heat on the back side, from the Pi. The way mine fits together, the PIR is directly over a chip with heat sink. I tried putting a small wad of paper towel between them with no change. I will next try using a Pi1 instead of a Pi3.

enter image description here

0

I had the exact same issue driving me insane for weeks. The false positives would reoccur every minute.

Finally, I figured out that either Bluetooth or WiFi is causing some fluctuations in power. Turned both off and all was ok.

I really hope this is resolving your issue as I can relate to your situation. ;-)

0

Had the same thing. PIR triggering exactly every minute. Suspected power, but could not proof it. Truned off WIFI and voila.. no false triggers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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