PIR Sensor won't wake up
i want to install for my Magicmirror project a PIR Sensor (HC-SR501) for switching the monitor automatically on/off.
i have already tested MMM-PIR-Sensor and MMM-PIR. But both have the same issue.
After the adjusted delay the monitor switches off. But there is no chance to wake it up again.
It seems to me that i have installed something wrong in the pins.
In both modules i need a value for sensorPin:
That mean the "out"wire of the PIR? thats right. That mean according my Occupancy i have to put “16” into it?
karsten13 last edited by
should be 23 (not 16)
Thx. now the table should be clear.
But the PIR doesn’t work.
After delay the screen switch off.
But i can breakdance in front of the sensor. It happend nothing…
but if i remove the cable from sensorpin 23 the sceen wakes up.
There are some news about my Sensor problem.
i tried to install these steps according this link
i made two sh-scripts for screen on & off
then i created this phyton
!/usr/bin/env python import sys import time import RPi.GPIO as io import subprocess io.setmode(io.BCM) SHUTOFF_DELAY = 10 # seconds PIR_PIN = 17 # Pin 11 on the board def main(): io.setup(PIR_PIN, io.IN) turned_off = False last_motion_time = time.time() while True: if io.input(PIR_PIN): last_motion_time = time.time() sys.stdout.flush() if turned_off: turned_off = False turn_on() else: if not turned_off and time.time() > (last_motion_time + SHUTOFF_DELAY): turned_off = True turn_off() time.sleep(.1) def turn_on(): subprocess.call("sh /home/pi/Pir-Sensor/monitor_on.sh", shell=True) def turn_off(): subprocess.call("sh /home/pi/Pir-Sensor/monitor_off.sh", shell=True) if __name__ == '__main__': try: main() except KeyboardInterrupt: io.cleanup()
i can start this with
and it seems that it works.
But in the code i defined a delay of 10 seconds. But after it, it happend nothing.
the weird thing is, that the screen turn off after exact 2 minutes. If i move in front of the sensor the screen turn on again.
But if i do nothing or cover the sensor with something the screen turn on after exact one minute.
does anybody has an idea, whats wrong there?
ebolisa last edited by
@sceetch I’ve, more or less, the same setup but the sh files stored in the MagicMirror folder.
@sceetch Which Raspberry Pi board are you using?
@dbg i’m using Raspberry Pi 3 Modell B Plus (B +)
I have no idea whats wrong.
I can change the delay time value randomly. There is no effect. After exact 2 minutes the screen turn off.
Could it be, there is something activated in the tvservice?
@sceetch off is because the module does this no motion was detected
I installed the MMM-PIR-Sensor last week and I had a similar problem. I just couldn’t get the sensor to work with the module. I spent a lot of time and tried a few different things and nothing worked… in the end I updated the wiringPi GPIO access library (I’m using a Pi 4 Model B).
And now it’s working OK. I’m not saying this will fix your problem. It may be that an install I did overwrote the wiringPi files on my Pi or rolled them back in some way, but it worked for me.
@sceetch also i think u need to make sure the sensor actually works