Read the statement by Michael Teeuw here.
UPDATE: Replaced my PIR-Sensor with a Doppler Microwave Sensor.
-
Can you share your python code? Perhaps there’s something there
-
@sdetweil sry about that
@uros76 i hope thats not the problem
import RPi.GPIO as GPIO import time import datetime switch=11 GPIO.setmode(GPIO.BOARD) GPIO.setup(switch, GPIO.IN) try: while True: if GPIO.input(switch) == 1: now = datetime.datetime.now() print(now.strftime("%Y-%m-%d %H:%M:%S"), "something") time.sleep(5) except KeyboardInterrupt: print("Bye Bye") finally: GPIO.cleanup()
thanks for the help
-
@Lipax try different gpio pin, like a pin 18 which is a GPIO 5. It’s default set to input function. Don’t forget to adjust the python code, change switch to 18.
You might check the GPIO 0 (your pin 11) if it is set to input. Use command: raspi-gpio get 0 or raspi-gpio get to check all GPIO’s.
Also, use a multimeter to measure the voltage coming out from sensor. It should be around 3.3V for few seconds when sensing detected. This way you can monitor if actual detection / voltage is coming from sensor.
-
@uros76
i forget to mention i already changed the pin, i first tried pin 7 beforeaccording to pinout.xyz my pin 11 is gpio 17
GPIO 17: level=0 fsel=0 func=INPUT
thank you very much for helping me, i dont have a multi meter but ill ask my father to do that. u think its not the sensor sending the signal? maybe it picks up something with the wire along the way? i dont have a engineering background.
-
@Lipax you need to be sure that sensor is not the cause.
Measuring it’s sensing, output voltage and duration is a good way of confirming if sensor works ok. -
it took a long time but i tested the voltage, i can upload a video somewhere if u want. the wrong positive and the regular ones look the same for me. it kinda spikes to ~5v and then instantly goes to 3.3 and stabilizes
-
@Lipax there you go, nothing wrong with the software code. It’s the PIR sensor giving false positives. Nothing you can really do about that. Perhaps a different brand/quality of PIR sensor if it will help but I doubt.
As mentioned before, due to exact same problem I gave up on PIR sensor completely and moved to the microwave. This works for me now over 3 years. without false positives.
-
@uros76 ty ill maybe try to find another microwave sensor. pir i find really ugly try to stay away from them. really sad i didnt get the microwave sensor working. thanks for the help