Currently I am using 2 pins, one as output and one as input. The output pin is operating a solenoid circuit. My question is, is it safe to connect the output pin to a input pin even because I want to also read if the output pin is currently in a high or low state. Below is my circuit:

enter image description here

  • This is by far the best example of overkill.
    – SBF
    Commented Aug 3, 2018 at 14:37

1 Answer 1


Yes that will be quite safe. Just make sure you never expose a GPIO to a voltage less than 0V or more than 3V3.

Actually there is no need to use a separate GPIO to read the output level. On the Pi you can read the level of a GPIO regardless of its mode (INPUT, OUTPUT, ALT0, ..., ALT5).

  • Thanks, I think I'll just use another pin for input reading. I'm gonna use it for some if else conditions in my webserver server side programming.
    – Onjieee
    Commented Aug 3, 2018 at 17:54
  • The second part IS THE ANSWER because it utilizes the device and also shows the author's knowledge. Why use (unnecessary complex) hardware when software will do the job? BTW - in case driving solenoid I would prefer optical coupling and not direct drive as demonstrated.
    – Jan Hus
    Commented Aug 3, 2018 at 18:01
  • Yes I'm aware it can be done in command line or python but the environment im currently using is nodejs and the library im using is sensitive wheter the pin is set to INPUT or OUTPUT
    – Onjieee
    Commented Aug 6, 2018 at 7:38

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.