balanga
Posts: 108
Joined: Sat Aug 23, 2014 6:56 pm

Connecting a PIR to PiFace Digital 2

Fri Nov 16, 2018 7:11 pm

I'm trying to get a PIR https://projects.raspberrypi.org/en/pro ... mputing/13 working with a PiFace Digital2 http://www.piface.org.uk/static/img/pif ... iagram.png....

It seems simple enough - there are three pins/wires Vcc, Gnd, and Out. Where do I connect Out?

Here are some instructions, including sample code, although this if for PiFace Didital (1)

https://www.element14.com/community/roa ... ce-digital

Unfortunately the wiring is not clearly shown.

Any help in suggestions about which connectors should be used for which wires would be appreciated.

PhatFil
Posts: 613
Joined: Thu Apr 13, 2017 3:55 pm

Re: Connecting a PIR to PiFace Digital 2

Fri Nov 16, 2018 9:08 pm

you can use Any suitable gpio https://www.raspberrypi.org/documentation/usage/gpio/ some of the 40 pin header pins are dedicated to supplying 5v 3.3v and gnd points. others are addressable and can be used for your i/o.

it might be an idea to start with an led blink project to get you familiar with addressing different pins first.

one of the links above includes the following snippet of python code

Code: Select all

from gpiozero import MotionSensor

pir = MotionSensor(4)

while True:
	pir.wait_for_motion()
	print("You moved")
	pir.wait_for_no_motion()

Code: Select all

pir = MotionSensor(4)
where 4 identifies the gpio the pir out is connected to.
here is a link to gpiozero documentation https://gpiozero.readthedocs.io/en/stable/

balanga
Posts: 108
Joined: Sat Aug 23, 2014 6:56 pm

Re: Connecting a PIR to PiFace Digital 2

Mon Nov 19, 2018 10:31 am

PhatFil wrote:
Fri Nov 16, 2018 9:08 pm

it might be an idea to start with an led blink project to get you familiar with addressing different pins first.
I can make an LED blink without any problems using the PiFace Digital2. What I can't figure out is where to hook up the three wires from the PIR.

PhatFil
Posts: 613
Joined: Thu Apr 13, 2017 3:55 pm

Re: Connecting a PIR to PiFace Digital 2

Mon Nov 19, 2018 3:06 pm

use any gnd point and any +V point or pin to supply power to the pir and a gpio pin you can address and configure for input for the signal connection.


Return to “HATs and other add-ons”