When I run grove_pir_motion_sensor.py sample script it prints “Motion Detected” few times and then “-” few times. Those values are flapping all the time every ~0.5-1.3 sec. I tried putting a sensor towards a wall or waving for longer time, but output doesn’t change.
Do you have any idea why the sensor doesn’t recognize motion properly?
Thanks,
Marcin
P.S. I’m attaching output from grove_pir_motion_sensor.py script and troubleshooting logs.txt with hardware info.
Bad news are that firmware update didn’t solved my issue.
I can now see new version: GrovePi has firmware version: 1.2.2
Update was successful (see attached logs), but motion sensor was behaving the same.
Good news are that motion sensor started working after connecting to port D7. I checked multiple times the source code:
# Connect the Grove PIR Motion Sensor to digital port D8
# SIG,NC,VCC,GND
pir_sensor = 8
....
motion=grovepi.digitalRead(pir_sensor)
Any idea why it’s working on D7 port instead of D8?
Hey marcin,
Great to hear that the PIR motion sensor is working for you. It might be working on D7 with the code stating D8 because there are 2 pins in D7 port (7,8). Most of the sensors use pin7 so it corresponds to the same name as that of the port. Can you try out another port like D5, where the pin number should be 4. Can you also post a picture of the sensor.
Hey Marcin,
Can you post a picture of the bottom side of the sensor too, where the pinout is mentioned. Yes the pin number is passed to digitalRead. Can you repeat this test on Port D6 and D7 too. I expect pin 7 to work on port D6 amd pin 8 to work on port D7.
Hey Marcin,
It looks like the grove PIR sensor comes in two variants, one with the sensor out connected to the yellow wire and the other with the sensor out connected to the white wire, which is why you are getting the readings on the other port. We’ll update the documentation on github.