6
\$\begingroup\$

I am designing a board that will be plugged into a computer and will read the status of a button ~50 m away in an office environment (it's actually a lot closer, but the cable is long).

I think it's a good idea to galvanically isolate the button wiring from the computer, since the PC will be grounded. I don't want any faults on the wiring to be able to damage the computer.

I'm assuming less than 100 ohm resistance for the cable, and while a simple series resistor would work, I think having a constant current sink for the opto LED is safer (i.e. if the cable has to be a lot longer, or shorter, etc.).

Is this a sensible approach to it? Cost/space is not much an issue, so I could add some protection/filtering circuitry, but I'm not entirely sure where/how to do it, so I'd be happy to hear some suggestions.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
8
\$\begingroup\$

Looks like too much circuitry, which leads to more cost, complexity, failures. There is nothing in the question that indicates anything more than series resistors are required. Adding components, like isolated switching power supplies, adds components with much higher failure rates than a few resistors and diodes. The circuit below is well protected, simple, reliable, and goes high/low when switch is closed/open. There would need to be a specific, compelling reason to add all that circuitry in the question.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 2
    \$\begingroup\$ Fair points, but I am less worried about the board itself failing than it causing some damage to the computer due to the long cable being connected to say, AC mains, by accident etc. I guess high voltage resistors and some fuses would solve that. This is a one off project so cost isn't an issue. I do feel quite relieved that this approach would be enough in most cases though. \$\endgroup\$ – Wesley Lee Mar 29 at 18:02
  • 1
    \$\begingroup\$ You may forgo the fuses, as D1+D2 clamp circuit voltages to acceptable levels. \$\endgroup\$ – scorpdaddy Mar 29 at 18:24
6
\$\begingroup\$

That looks fine to me, but you may wish to put a diode across the optoisolator LED in case you get some ringing in the choke or wiring.

The two transistor current sink might be slightly better and maybe 100K is a bit on the high side for the resistor. Eg,

schematic

simulate this circuit – Schematic created using CircuitLab

You could also flip the current limiter and put it on the other rail. Right now the opto sees a lot of common mode voltage change when the switch is pressed. Grounding the photodiode would reduce that because of the coupling capacitance of the DC-DC.

\$\endgroup\$
  • 1
    \$\begingroup\$ And less different parts to place with 2 transistors instead of diodes. (Oh nvm now there is a diode back again :P ) \$\endgroup\$ – Wesley Lee Mar 29 at 17:50
4
\$\begingroup\$

A simpler way would be to use a shielded cable (to shunt noise and ESD away), and then protect the microcontroller inputs with diodes to VCC and ground.

The resistance of the cable is most likely to be between 1 or 10 ohms (as long as the AWG is more than 30 gauge).

\$\endgroup\$
3
\$\begingroup\$

I would make a current loop. Simple, cheap and reliable. You can connect the transistor in a common collector configuration if you want a non-inverted output. The optocoupler LED must be rated for at least 20 mA.

enter image description here

\$\endgroup\$

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.