PIR motion sensor always high

I have bought the PIR motion sensor: PIR motion sensor – Pimoroni
I have wired it up according to this tutorial: How to Interface a PIR Motion Sensor With Raspberry Pi GPIO | Raspberry Pi | Maker Pro
Here is my code:
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN) #Read output from PIR motion sensor
while True:
i = GPIO.input(11)
time.sleep(0.5)
if i==0: #When output from motion sensor is LOW
print(“No intruders”)
elif i==1: #When output from motion sensor is HIGH
print(“Intruder detected”)

However i is always 1, unless I unplug it and it goes to zero. I have tried turning the sensitivity and delay down, hiding the PIR in a box etc. Nothing works, always high.

I have also tried it on pins 7 and 3 and in .net code which works with another PIR I have. Still doesn’t work.

I have a PIR motion sensor attached to a pi zero which controls an addressable led strip. I tested your code on my setup and it works perfectly. Could this be a hardware problem with the PIR?

thanks for looking into this. That was my thought but I wanted to make sure I wasn’t doing something obviously wrong. Do you think I should return the item as defective?

Yes, that’s what I would do. As you’ve tested the PIR on different pins it seems reasonable that the fault is with the PIR.

1 Like