I was trying to get my PIR sensor working but I got really strange readings. I unplugged everything from the breadboard, including the motion sensor but I still got a signal to the GPIO pin. After some testing I realized that whenever I have a cable connected to that pin (cobbler or single) I constantly get random signals.
This is my code:
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) PIR_PIN = 25 GPIO.setup(PIR_PIN, GPIO.IN) print "start" try: while True: if GPIO.input(PIR_PIN): print "Motion" else: print "No" time.sleep(0.5) except KeyboardInterrupt: print "Quit" GPIO.cleanup()
I get "no" a few seconds, then I get "Motion" a few seconds and so on. But if I disconnect the cable from the Pi there's only "No" readouts.
I've tried changing pin but there's not change. I also tried setting the wifi dongle on a extension cable to get it away from the Pi but that didn't help either.
Isn't this super basic stuff?