I'm building a project on mi Pi 3 and I was wondering if it's possible to simulate a button press.

What I mean is, I have a control board for a screen, that has buttons: volume up, down, power, etc.

What would happen if I desolder the button, and proceed to solder ground to one end and v+ to the other one (3.3 logic), and set the GPIO pin to high?

Would that simulate a button press?

  • 4
    No one can say unless you explain the circuit the button connects to.
    – Milliways
    Dec 17 '16 at 6:49
  • 2
    Why simulate a button instead of just hook up a button? Dec 17 '16 at 7:04
  • 2
    When I want to simulate an input I just set the GPIO high or low externally to the program. That simple approach will probably work for 90+% of Pi applications.
    – joan
    Dec 17 '16 at 8:58

if i desolder the button, and proceed to solder ground to one end and v+ to the other one (3.3 logic) and set the gpio pin to high would that simulate a button press?

If you want to use the GPIOs directly and you are sure the button uses 3.3V logic, make sure there is a common ground between the device and the Pi, then you only have to deal with the button's input (one connection). The other one can be left disconnected.

You need to determine which one is the input and whether that input is active high, in which case it sinks current, or active low, in which case it is a source. This may be a problem, because either way there will be a positive and negative terminal when tested.

However, you can try it both ways with the same setup. You want a decent size resistor in between, a few kΩ +.

If the button input is active high, then the GPIO should be set low and when driven high will emulate a click. If the button is active low (i.e., a press is when the input is sent to ground), then the GPIO should be set high and driven low to emulate a click.

As long as the resistor is there, you have a common ground, and the buttons are 3.3V logic, you can test both possibilities with both leads safely, and once you have it straight, leave the other side disconnected.

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.