I want to control a garage door opener with the PI, and the normal button is just a momentary switch.

Is it possible to use a PNP transistor to simulate a switch? Hook one wire to the collector, one to the emitter, and a gpio output to the base, then trigger it for 1 second or so? Or am I way off? I already have a magnetic reed switch to tell if the door is open or not. It would be cool if I could tell it to open or close remotely.

1 Answer 1


Simple answer NO.

It is theoretically possible if the devices share a ground, and polarities are correct (which assumes you have the circuitry of the device), however good (safe) practice would isolate the circuits.

Use a relay.

  • Yeah, guess that makes a lot more sense. At least I can use a really small and cheap relay since it's not much power.
    – AndyD273
    Commented Jan 16, 2017 at 13:20

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.