0
\$\begingroup\$

I have a 24V solenoid device, that is able to push and pull a small pin, that I would like to control with a 5V micro controller.

The solenoid has a reed switch connected to 24V that indicates whether the pin is currently out or in. In order to read this with the micro controller, I can either use a voltage divider to get it down to a safe 5V, or I could use an optocoupler and completely separate the solenoid and mcu.

The optocoupler sounds like the most safe option, but here's the thing: I'm already controlling the solenoid with the mcu using a mosfet. So there is already a common ground between solenoid and mcu.

So my question is: Is there any reason to use the optocoupler instead of a simple voltage divider in this case, where we already have a common ground?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

My experience is that optocoupler does make sense only when using isolated grounds. If not, a simple voltage divider should be fine.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ If you designed the system with ground loops then an opto-coupler may be necessary to defeat the resulting ground bounce -- but usually, the answer to that problem is to avoid ground loops in the first place. \$\endgroup\$
    – TimWescott
    Apr 27, 2022 at 19:34

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.