1

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 Aug 3 '18 at 14:37
3

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 Aug 3 '18 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 Aug 3 '18 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 Aug 6 '18 at 7:38

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.