So, this motion sensor works when it is taped to my desktop computer...but when I move it to the wall, specifically a higher spot on the wall, it just keeps giving back an input signal. So here is a script I am using:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
PIR_PIN = 2
GPIO.setup(PIR_PIN, GPIO.IN)
i = 0
try:
print("PIR Module Test (CTRL+C to exit)")
time.sleep(2)
print("Ready")
while True:
if GPIO.input(PIR_PIN):
i = i + 1
time.sleep(1)
print(i)
except KeyboardInterrupt:
print("Quit")
GPIO.cleanup()
Simple and straight forward.
This is the output
pi@raspberrypi:~ $ python motion.py
PIR Module Test (CTRL+C to exit)
Ready
1
2
3
4
5
6
7
8
9
and so on. So when I move the location of the sensor in a higher spot in the room, the sensor just keeps going off. I'm trying to understand why.