2

I have a setup with a Raspberry PI model 3 a PIR sensor and a OEM HDTV Pi IR-Camera with two LED modules (pictures below).

I'm running a little Python script triggering a camera recording whenever the PIR sensor is detecting motion.

Now, the problem is that the sensor is detecting a lot of false positive motions. It seems to just trigger about every 30 seconds. I have tested the setup with two different PIR sensor but the issue remains.

I found out that the sensor seems to work ok as long as the camera is not being connected. Somehow the camera seems to interfere with the PIR sensor.

I'm no electronics expert so I'm kind of stuck and don't know what to do. Any help from you guys is highly appreciated.

Here's my Python script and some pictures of my setup:

from gpiozero import MotionSensor
from picamera import PiCamera
from datetime import datetime

sensor = MotionSensor(4)
camera = PiCamera()

while True:
    sensor.wait_for_motion()
    print("I can see you!")
    filename = "Intruder_{0:%Y-%m-%d_%H:%M:%S}.h264".format(datetime.now())
    camera.start_recording(filename)

    sensor.wait_for_no_motion()
    print("I don't see any motion")
    camera.stop_recording()

GPIO PIR sensor wiring PIR sensor settings Complete setup

1

You can reduce the sensitivity of the PIR sensor by turning the little yellow trimpot ("Phillips screw") anti-clockwise. On your photo it is the top one.

This adafruit overview could be helpful.

Make sure that no unwanted infrared transmitter triggers the PIR sensor, like LEDs or (television) remote control unit.

Regarding your python script: I would add camera.close() in a new line after camera.stop_recording(). And KeyboardInterrupt to stop the running script from command line by pressing ctrl+c:

from gpiozero import MotionSensor
from picamera import PiCamera
from datetime import datetime

sensor = MotionSensor(4)
camera = PiCamera()

while True:
    sensor.wait_for_motion()
    print("I can see you!")
    filename = "Intruder_{0:%Y-%m-%d_%H:%M:%S}.h264".format(datetime.now())
    camera.start_recording(filename)

    sensor.wait_for_no_motion()
    print("I don't see any motion")
    camera.stop_recording()
    camera.close()

    except KeyboardInterrupt:
        camera.close()
        exit()
|improve this answer|||||
  • Unfortunately this didn't resolve the problem. It's still triggering about every minute. Any other ideas? – tk78 Feb 23 '18 at 10:37
  • "every 30 seconds" and now "every minute" - sounds like the trimpot has an effect. Have you terminated the script, added camera.close(), screw the trimpot a little bit, started the script and then checked the result or without stop/start? – Fabian Feb 23 '18 at 16:05
  • You're right. But the interference seems to be the problem. I.e. when the PIR measures it seems to be influence by the camera. – tk78 Feb 24 '18 at 16:40
  • 1
    @Favian Ok, it was definitely the two IR LEDs screwing with the IR sensor. I removed both LEDs from the camera and voila. Everything working perfectly! – tk78 Feb 25 '18 at 15:04
  • 1
    FYI: There was still another issue. Either WiFi or Bluetoot causes some fluctuation in power supply. Turned both off and the issue never occured again. – tk78 Mar 21 '18 at 21:02
1

to help others with the triggerless PIR responses i can tell about my experiences: I have my Pi with PiCamera near the Front door, and outside is my PIR activated light. The Pi runs mjpeg-streamer constantly. When I start the app on my smartphone to view it, the Light switches on. Since I don't have ethernetwires near the front door, I used a Devolo Powerline Adapter set. When I started to send loads of data THAT triggered the PIR sensor. So, maybe you recognize yourself in this setup, or maybe you have another 'old' peace of electronics nearby? maybe the Pi power adapter is noisy? PIR sersors work on fairly low voltage and is (therefore) relatively sensitive for external noise as well.

|improve this answer|||||
1

Apparently the problem is noise on the PIR power line triggering the PIR. This can be caused by virtually any other device, even the MCU doing something. I have the same problem caused by the MCU going into sleep mode. Some suggest filters on the power line, some get away with delaying re-arming of the PIR until nothing else is happening which could cause a teeny spike. The latter is working so far for me.

|improve this answer|||||

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.