I have a ceiling fan remote that I want to control using the Raspberry Pi. Instead of sending RF signals or buying a Wi-Fi wall switch to do any of this, I'd like to use an existing RF remote and press the buttons in software by making electrical connections using GPIO.

If I take a paperclip and attach it to metal connections at either end of the button, it will trigger the button as if I pressed it.

Knowing this, how would I connect up the connections at the sides of the button to the Raspberry Pi's GPIO such that I could trigger the electrical connection in software?

I need to know which pins to connect, what resistors I'd need and why, and what I'd do in software (such as set HIGH and immediately set LOW after) to make the electrical connection as if I pressed the button on the remote by hand.

2 Answers 2


Connect a relay or an NPN transistor to bridge the two sides of your switch and program the Pi to set the base of the transistor or relay to high for about half a second - as if a button were being pressed.


Doing a quick search for "raspberry pi push button", I got this answer, which would seem to answer your question. https://www.allaboutcircuits.com/projects/build-a-raspberry-pi-pushbutton-switch/

I don't mean to sound snarky and day 'google it and come back with the results', but I wonder if there's more to this question.

One big thing is: don't connect the input pins to the 5V outputs.

  • This article is taking about adding a programmable button to RPi. I'm asking about triggering an already-soldered button by attaching wires and some mechanism to trigger the button press in software.
    – Sawtaytoes
    Aug 18, 2017 at 19:05
  • Ah, so you're looking to send a command as if a button had been pressed? Sep 18, 2017 at 17:11
  • Yeah. A relay solved the issue for me.
    – Sawtaytoes
    Sep 18, 2017 at 23:55

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.