I am very confused and hoping someone can point me in the right direction.

What I would like to achieve is converting an external relay switch (from a normal everyday gate receiver) into a signal that my pi could receive.

So a person pushes a button on a remote control the receiver closes a circuit (I am guessing) and a wire into a GPIO pin(s) then is able to tell my program that the button was pushed.

Is this possible and if so, what pins and what would the code look like?

(first prize: how would I be able to determine what relay was switched, ie : button 1,2,3,4)

I do not want to use the raspberry pi RF receiver module because I would prefer the rolling code security of normal gate receivers.

Thank you for any tips.

  • More information on the receiver and it's spare relay would be required to answer this question, you need to know if the relay is set up for voltage-free output or not. Most relays would be but would not like to assume this. If you have a DMM then it's something you could determine by taking some measurements. – Roger Jones Jan 17 '19 at 14:09
  • There's no such thing as a "normal everyday gate receiver" - they are all different, and most of them don't have 4 channels / buttons. Mine has only one. – Dmitry Grigoryev Jan 21 '19 at 10:04

If you can convert the signal from the relay into under 3V3, you can send it into a GPIO pin and read the input (exactly the same as reading a button press), or trigger an event when it changes. DO NOT send more than 3V3 into the Pi, you'll fry it.

I did something similar recently using a doorbell. When the doorbell rang it flashed an LED on the receiver. I tapped into that line and passed it into a GPIO pin, read it like a button.

If you have a different signal going from each relay into a differente GPIO then you know which one triggered the event.

Plenty of ways to code it, I recommend the gpiozero Python library - look at the examples and recipes in the docs: https://gpiozero.readthedocs.io/en/stable/

| improve this answer | |
  • The spare relay output may well be voltage-free (in most cases they are), in which case you'd use a GPIO pin with the internal pull-up wired to the relay NO (or NC) pin and GND from the Pi wired to the relay COM pin. – Roger Jones Jan 18 '19 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.