Read the statement by Michael Teeuw here.
PIR Sensor turning display on/off over and over
-
@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 -
Hi all,
Thanks for the reactions. I ordered one and will test tomorrow.
Herman -
i gave up on my PIR sensor cause this was happening to me…guess who is searching for a Ferrite bead tomorrow!!!