Read the statement by Michael Teeuw here.
PIR Sensor turning display on/off over and over
-
Hello!
tl;dr - display wakes/sleeps repeatedly.
Display sleeps fine, but once PIR Sensor is triggered, the monitor wakes, then immediately sleeps, then wakes, then sleeps, and so on, until I remove myself as a trigger to the PIR Sensor.
FWIW - I utilized a tutorial for setting up the PIR Sensor and testing it via python script to see if it is even working. Here’s the script:
from gpiozero import MotionSensor pir = MotionSensor(4) while True: if pir.motion_detected: print("Motion detected!")
It works, but it continues to print over and over (and so on) until I remove the trigger for the PIR Sensor (much like how the display wakes and sleeps repeatedly).
I’m honestly not sure if it is supposed to print that output over and over (like mine does), or not. But I feel like the two might be connected.
Any pointers here would be much obliged. Thank you!
-
Same here. I verified all the connections and tested using the same script and it keeps printing “Motion detected!” Did you play around with the jumpers on your PIR? I am still trying to figure out if my PIR is defective.
-
@elmerito25 I don’t have a mirror to test, but the code does the following
from gpiozero import MotionSensor pir = MotionSensor(4) while True: #repeat this forever if pir.motion_detected: # if motion is detected print the message print("Motion detected!")
after the print is done it immediately repeats the loop, because their is no sleep, timeout, delay or whatsoever in there. So for me the expected behaviour is that it prints over and over the same message. You could try to check motion not detected
from gpiozero import MotionSensor import time pir = MotionSensor(4) while True: #repeat this forever if pir.motion_detected: # if motion is detected print the message print("Motion detected!") if not pir.motion_detected: # if no motion is detected print the message print("No motion detected!") time.sleep(1)
run this and leave your sensor alone it will print just every second
-
I have the same issue. Maybe it’s related to WiFi. I tested the PIR with on older PI 2, no WiFi. Ran the Python script, working perfectly.
After installing the PIR to my Mirror Pi, a Pi 3 screen wouldn’t go out. Installed the test Python script again and I am getting a lot of false positives, over 5 a minute. So PIR stays highs and screen stays on.
I am thinking that WiFi is interfering with the PIR.
Anybody any experiences or ideas?Thanks,
Herman -
by my mirror it works really nice. i have a question, it is possible the time to change right now it turns the display off after 4 minutes. i would like to change the time maybe 2 minutes or so.
thanks
-
It might be interference. Try installing a ferrite bead. The person whose site I’ve linked below had a very similar problem and describes how he fixed it.
https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/
Renfield
-
@Renfield said in PIR Sensor turning display on/off over and over:
It might be interference. Try installing a ferrite bead. The person whose site I’ve linked below had a very similar problem and describes how he fixed it.
https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/
Renfield
It’s what I had to do with mine… they are very inexpensive…
-
@cowboysdude said in PIR Sensor turning display on/off over and over:
@Renfield said in PIR Sensor turning display on/off over and over:
It might be interference. Try installing a ferrite bead. The person whose site I’ve linked below had a very similar problem and describes how he fixed it.
https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/
Renfield
It’s what I had to do with mine… they are very inexpensive…
Thanks guys! Will try this once I get home tonight!
-
@elmerito25 said in PIR Sensor turning display on/off over and over:
@cowboysdude said in PIR Sensor turning display on/off over and over:
@Renfield said in PIR Sensor turning display on/off over and over:
It might be interference. Try installing a ferrite bead. The person whose site I’ve linked below had a very similar problem and describes how he fixed it.
https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/
Renfield
It’s what I had to do with mine… they are very inexpensive…
Thanks guys! Will try this once I get home tonight!
Thanks @Renfield and @cowboysdude ! Followed your advice and found a ferrite bead on unused USB cable and got the PIR sensor working perfectly!
-
Great to hear. I love it when a plan comes together.
Now I need to scrounge up a bead for my build.
Ren