First time using input on Automation Phat


I have used the relay on the Automation Phats quite a bit. This is my first attempt at using the inputs.

I am trying to connect the output of a piece of equipment to my Automation PHat/Raspberry Pi Zero so I can tell when the output is triggered. I have the board configured, and the relay working. I am including a photo shat shows the info from the manual about the control. Any suggestions about how to go about this?

What input would the experts recommend I use? Do I need to connect some voltage in the equation? How should I wire it up?

Many thanks in advance.

The key takeaway from the details you’ve posted is:

“The output acts like a switch to ground.”

IE: This means that the output has no HIGH state by default, and if you wish to read this output using a digital input it requires you to supply some way of making your signal HIGH.

Normally devices like the Pi have a simple way of dealing with this- onboard “pull” resistors. A pull resistor is a very high value resistor (typically 10k+ on a digital IO) that can connect the input pin either to +VCC or GND. This gives that pin a “known” state, by gently pulling it one way or another.

A digital input that isn’t pulled, and isn’t driven to a particular voltage by an external device, will have an unknown and unpredictable state, we call this “floating.”

Automation HAT has a protective buffer in front of the inputs, which thwarts the pull resistors built-in to the Pi. You’ll need to add one yourself.

This might sound complicated, but all you have to do is pick a suitable resistor- try 10k for starters- and connect it between the +5V connection on Automation HAT and the input you wish to use. This will turn that input on by pulling it HIGH, giving you a known ON state.

Now you connect your device to the same input, and when it’s on it will connect the input pin to Ground. Since the digital input pins on the buffer (and the Pi) and any input pins for that matter have a very small input resistance versus the path to ground, this connection will pull your input back LOW and Automation HAT will see it as OFF.

This circuit also serves to invert your signal- Automation HAT is ON when your device is OFF, and OFF when your device is ON. You can simply fix this little detail in code ;)

That worked like a charm! Thank you very much!


Brilliant! You’re welcome.