jonp
New Member
Posts: 4
|
Post by jonp on Jul 22, 2019 17:45:28 GMT -8
I've been puling my hair out on this one for a week. I've connected a Grove motion sensor to the Pi2Grover board and am reading the pin with the code below, but the pin remains high regardless of the sense of the motion sensor (testing it with a logic probe). I've verified that the sensor is pulling the output pin (the yellow wire) high or low based on motion when it's not connected to the Pi2Grover board, so the sensor is working. But when connected to the Grove connector the pin (that's connected to the yellow cable) always stays high. In fact that pin is always high even if I initiate it with a GPIO_PUD_DOWN setting. It seems that pin stays high no matter how it's initialized and pulled by an external device. The code I'm using is below. What am I missing? Thanks.
import RPi.GPIO as GPIO
import time
GPIO.setmode (GPIO.BCM)
MotionSensorPin=16
MotionSensorState = 0
GPIO.setup(MotionSensorPin,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
print 'PULLED DOWN'
time.sleep(5.0)
while counter < loopcount:
MotionSensorState=GPIO.input(MotionSensorPin)
print ('Motion sensor read state ',str(MotionSensorState))
time.sleep(1.0)
loopcount = loopcount -1
GPIO.cleanup()
|
|
|
Post by SDL on Jul 23, 2019 6:41:50 GMT -8
Hmmm. The Pi2Grover board has a 10K pullup on each pin. Post a picture of the wiring.
Also tell me the exact Grove motion sensor you have. I might have one around here to test.
BP
|
|
jonp
New Member
Posts: 4
|
Post by jonp on Jul 24, 2019 4:38:10 GMT -8
Hi - here's the motion sensor: www.amazon.com/gp/product/B00T5J737A/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1. I don't know how to post a picture but the Grove connector from the motion sensor is plugged into the D16/19 connector on the Pi2Grover although I've tried it on many other connectors. Also - I'm guessing (although it doesn't appear to be documented anywhere) that the sharing of the ports (like D16 and D19 being on the same Grove connector) means that the primary wire (yellow) is connected to the first-numbered port and the secondary wire is connected to the second-numbered port. Is that right? Attachments:
|
|
|
Post by SDL on Jul 24, 2019 12:14:59 GMT -8
Great. I'll look around and see if I have one now.
BP
|
|