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.
