I have an external board which ends in a simple relay.
I connected one wire to one GPIO pin and the other to GND.
I need to check status change of that pin. I'm working in python.
Thanks
I have an external board which ends in a simple relay.
I connected one wire to one GPIO pin and the other to GND.
I need to check status change of that pin. I'm working in python.
Thanks
Hoping that I understood the description correctly this is a circuit that should do the trick. Note the additional resistor (pull-up) compared to the way that is explained in the question. Without it the following happens: relays is open - Pi's input is "floating"; relays is closed - Pi's input is low. Which is why you are not detecting a proper change of state when the relays toggles. With the pull-up resistor a defined voltage level is applied to the input pin.
See also: https://www.raspberrypi.org/learning/physical-computing-guide/pull_up_down/ (note that they propose another series resistor to limit the current in the case the GPIO pin is set to output).
simulate this circuit – Schematic created using CircuitLab