Read the statement by Michael Teeuw here.
PIR-Sensor detecting motion even when there's no movement
-
Hi All
I’ve just hooked up my PIR sensor to my Pi3
I ran a variant of this, and it was constantly detecting movement even when I was covering it up, so nothing should have been detected.
Is there an issue with my sensor? Or is that standard? Or can I turn down the sensitivity in some way?
import RPi.GPIO as GPIO import time GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(3,GPIO.OUT) #Define pin 3 as an output pin while True: GPIO.output(3,1) #Outputs digital HIGH signal (5V) on pin 3 time.sleep(1) #Time delay of 1 second GPIO.output(3,0) #Outputs digital LOW signal (0V) on pin 3 time.sleep(1) #Time delay of 1 second
Edit from admin: Please use Markdown on code snippets!
-
I don’t have a PIR sensor to fiddle with … however, why are you setting pin 3 HIGH, and as an OUTPUT? If it’s to power the PIR sensor board, don’t, use either pin 1 or 17, those have a constant 3v3 on them (or if you know your sensor can tolerate 5V, use pins 2 or 4). If it’s to read from the PIR sensor, it needs to be set as an INPUT pin so it can detect when the sensor triggers it.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login