Raspberry Pi GPIO Input Protection

Hi All,

I have a device that controls 4 dry-contact relays and I want to read the output from these relays.

The easiest approach would be to use a pull-up resistor on the PI’s GPIO pins and then connect the GPIO (via a current limiting resistor) along with GND to the relay to monitor its state, however I’m worried that this won’t provide enough protection to the PI’s 3v3 GPIOs.

I intend on having about 2m of cable between the Pi and the device with the relays and this is going to live in an AM Transmitter hut, so potentially a lot of resonant EMI that could damage the pins.

I was hoping I might find a hat or board that presents the GPIO pins with built-in pull up resistors and even better, something that offers protection (e.g. zener or clamp diodes) as I’m not an electronics engineer and will struggle to get this right, but have so far not had any luck.

Am I overthinking this?
Does such a board or module exist?


I presume you are connecting to the relay’s control signal, not the switched output. You haven’t indicated what voltage this signal is, but this device:

will provide logic level shifting from a high level input of any likely value to the low level 3.3V that the Pi requires, with built-in pullups. It might not handle very high voltage spikes but it is possible that bypass capacitors would cope adequately with any RF induction.

If greater signal separation is required then an optoisolator would be suitable.


Hi Jonathan
If you need to monitor the STATE of the relay, ie HAS IT ACTUALLY OPERATED you really need a spare relay contact.
You could monitor the voltage applied to operate the relay easily enough but that does NOT mean the relay has actually operated.

If we knew exactly what the relay is switching there might be a way around the problem but failing that the extra contacts would be the only SURE way.
Cheers Bob
The AM transmitter radiation is another problem. I am assuming this feeds an antenna pretty much just outside the hut.
Whether this is a problem depends on how well the hut is shielded and how well the Transmitter itself is built to avoid any radiation from that source. If this is a home grown installation this aspect might not be too good.

Hi @Jonathan274793, Welcome to the forums!!!

The others here have covered this pretty well.

This was going to be my suggestion.
We have some available as breakout boards.

Hi Jeff

That is not going to tell you if the relay has actually operated. A lot depends here on EXACTLY what Jonathan wants to monitor. If it is the ACTUAL relay state it could be a problem but when we find out more detail it might be doable.

As for interference from the AM transmitter there are a lot of factors here which will have to be described but it can be handled. One project of mine had up to half a million watts of HF power dancing around the antenna farm but by doing things properly and taking basic precautions we had no trouble.
Cheers Bob

1 Like

That’s why I made my presumption clear. OP can ignore the response if it is not applicable.