1

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

2
  • Could you draw a diagram. I'm not sure what is going on. This probably isn't the right site for the question as it has almost nothing to do with the Raspberry Pi.
    – joan
    Nov 20, 2016 at 19:05
  • The external board is an electrified fence controller. It has a normal open or normal close relay that gives tension when an alarm is happening. I need to read that from my gpio.
    – leandronn
    Nov 20, 2016 at 19:09

1 Answer 1

0

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).

schematic

simulate this circuit – Schematic created using CircuitLab

1
  • You understood perfectly. I'll test it tomorrow and let you know. Thanks.
    – leandronn
    Nov 20, 2016 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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