I need to be able to "push" a button on a control panel using python and an arduino board.

My problem here is that the button in question, when depressed, sends 16 vdc to an outgoing wire that disappears into the bowels of a very large machine. Isolating the ground that completes the button's circuit is infeasible at best although it has continuity to the machine's frame so it could still be joined to an arduino's ground.

This is a problem for me because, with my limited knowledge of electronics, I'm only familiar with methods involving closing the ground using an NPN transistor or an optocoupler connected to an arduino's pin.

If I can share the ground but have no way of turning it off is it still possible to connect the break in the positive wire just as the button does manually with either NPN/PNP transistors, an optocoupler or a combination of both?

I ask because I have several boxes with dozens of types of these but no suitable relays.

Not expecting a schematic but if someone could fill in some of the holes in my knowledge or maybe point me to some appropriate Google search terms I'd be very appreciative.

  • 1
    \$\begingroup\$ Why can't you use an optocoupler here? \$\endgroup\$ Commented Apr 14, 2015 at 15:17
  • \$\begingroup\$ @IgnacioVazquez-Abrams I never realized they could be used like that but looking at the data sheets it seems you're correct. It appears that I just had a poorer understanding of optocouplers than I thought. \$\endgroup\$
    – Snesticle
    Commented Apr 14, 2015 at 16:53

1 Answer 1


I would use a relay for this application. The Arduino would operate the relay, probably with the aid of an NPN transistor, and the relay contacts would be connected in parallel with the switch.

The relay provides galvanic isolation, and the contacts won't care whether they are switching AC or DC, or what polarity DC, or what voltages the contacts are relative to the Arduino ground. (Assuming the contacts have an appropriate rating for the current they are switching.)

  • \$\begingroup\$ Sadly I have no relays handy that would work and I'm in an area that makes getting supplies tough. For anyone coming here from the questions title, though, this answer will almost certainly be applicable. \$\endgroup\$
    – Snesticle
    Commented Apr 14, 2015 at 17:01
  • \$\begingroup\$ I strongly second Peter Bennett's suggestion. Find a relay, or have one sent in. You really want to keep yourself isolated from the machine, and the machine isolated from you for all sorts of reasons. I'm in the automation industry, and would NEVER slap a solid state device in parallel with an operator pushbutton, but I will put a NO contact set there. \$\endgroup\$
    – R Drast
    Commented Apr 14, 2015 at 18:48

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.