PIR Issues?

Does anyone else run into issues with PIR sensors constantly reporting a true value (1)?

I’ve tried both my pi zero ws and two sensors, one on a breadboard and one with GPIO pins.
Wires are all connected correctly and have tried several different GPIO pins as well.
Double checked that the sensor does indeed return an integer as well.

The script aways returns a 1 when the wire is plugged in and will only return 0 when I unplug it from it’s GPIO pin.

Is there some voltage coming from PIR.
Raspi gpio looks for 3.3VDC for high (1). Is it possible there is some voltage coming through PIR

I place 2k ohm resistor in circuit. Is PIR using physical switch(might hear click when switch ON/OFF) or transistor switch.

I’m using the same layout as this except I’m using the 5V connector

trying to figure out how to code block here but having some issues

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
PIR_PIN = 23

GPIO.setup(PIR_PIN, GPIO.IN, GPIO.PUD_DOWN)

current_state = 0
while True:
try:
time.sleep(0.1)

    current_state = GPIO.input(PIR_PIN)
    if current_state==1:
        print ('Motion GPIO pin %s is %s' % (PIR_PIN, current_state))
        time.sleep(1)
   elif current_state==0:
        print ('No Motion GPIO pin %s is %s' % (PIR_PIN, current_state))
        time.sleep(1)
except KeyboardInterrupt:
    GPIO.cleanup()

I was facing the same issue with PIR sensor and esp8266 which work fine but sometimes randomly triggers every 20 sec… when I watched @bruhautomation latest video about multi-sensor he said that it happens when PIR and ESP8266 are close to each other…keep distance between both and it worked fine. I don’t know if there PIR and Pi having the same issue when they are close. you can give it a shot.

1 Like

Verify RPi recognize HI/LOW condition correctly

“gpio readall” command shows gpio state.
Trip motion and check state accurate.

After confirm pi readout, look at output from your script.

1 Like

@tmjpugh @ashfaaaa

Thanks for the suggestions - you want to know what the crazy thing was?
After testing on 2 pi zeros / 3 sensors using different pins and different power sources - I finally gave it a shot to change the ground pin I was using like “WHY NOT!?”

That was it… -____- it started working after that.

1 Like