I've got a fairly simple circuit that I've made where a motion detector is connected to a Raspberry Pi B+ GPIO by way of a fairly long ~30ft stretch of wire. The detector is being powered by a 9V battery and the schematic is as follows:
I'm running a python script to pick up the motion and it is as follows:
import RPi.GPIO as gpio import time gpio.setmode(gpio.BCM) gpio.setup(17, gpio.IN) while True: print ("LOW","HIGH")[gpio.input(17)] time.sleep(.5)
I was getting an output that was consistently 9-11 HIGHs, then 9-11 LOWs then repeating, and I was wondering what was up so I disconnected the PIR motion detector, leaving the wire not connected to anything, and I got the same result: a consistent fluctuation between low and high.
From my research, LOW for GPIO is roughly <0.54V while HIGH is >2V. Measuring the difference in voltage between the wire and the Raspberry Pi GND pin (PIN 39) gives me 0.32V consistently, with no fluctuation. Why is this happening, and how can I fix it?