I'm basically trying to find something that can push a button for me. I want to be able to control it through code, just like you can with motors, LEDs etc.. via the GPIO on a Pi.

I want it to extend and retract fairly quickly (1 second or less) and with enough force to push a button - the button has slightly less resistance than a standard lightswtich.

I have no idea what to Google hence me asking on here!

I'm running Pi 2.

  • 1
    You may want to look at a linear actuator, or a servo motor with a pushrod. Commented Nov 16, 2015 at 9:41

5 Answers 5


Have a look here:

A solenoid with a moveable pushrod can be driven fairly quickly and develop the force to push a button. They are usually cheap and easy to energize, e.g. using a simple transistor to drive the current (see here).

Update 01/2019

The MagPi, Issue 70, p. 24, endorses a product for this task - the MicroBot Push (no affiliation), see here, though it comes at a steep price of $50.

PUSHING THE LIMITS Some devices require human interaction to work. This fun device is an internet-connected buttonpusher. Now, from anywhere in the world, you can start the coffee machine. Using Prota OS, your Raspberry Pi can trigger it too.


I believe the most appropriate device would be a solenoid. They are quite common. For a simple button pressing solenoid, something like this might work well. I would recommend that you put a soft tip on the front so that repeated presses do not damage the button.



It's easy enough to find solenoids, servos etc with the power to push a button.

The tricky bit is the mounting. Humans are really very good at pressing buttons on arbitary things, compensating for slight changes in the position of the thing, compensating for the reaction force exerted on their own body. Where nessacery providing support for the thing the button is pressed on.

On the other hand a mechanical button pusher is likely to need to be held in a very precise location relative to the button for reliable operation. In many cases the difficulty of building such a mount turns out to be more trouble than just soldering some wires to the back of the switch and hooking them up to a relay.

  • A vocabulary clarification: I'm pretty sure Peter meant an R/C servo such as this one: adafruit.com/product/1143 . They come in a wide range of speeds and torques. Note that conventional R/C servos take a different command format than 'digital' servos. To use such an R/C servo, you'll need (1) the part ('horn') that fits the output gear/spline (2) something that generates a compatible command. I suggest you buy, rather than trying to bit-bang the command signal, since the timing is tricky. Adafruit.com, pololu.com and sparkfun are some suppliers I've had good luck with.
    – Catalyst
    Commented Sep 22, 2019 at 0:16

Urban legend and The Daily WTF have it that CD drives are all too often used for this purpose.

  • 1
    Amusing but this might have been better as a comment. Any suggestions on how to interface the (SATA/IDE) CD drive to the Pi via the GPIO (or USB), in order to cause the eject mechanism to actuate? Commented Nov 17, 2015 at 11:11
  • 2
    It may be amusing, but it's also a perfectly legitimate option. As for interfacing, any USB CD/DVD unit should work, and the eject utility should suffice to actuate it.
    – Jeremy
    Commented Nov 17, 2015 at 13:00
  • A ∓1 - the size/weight of the average PC CD/DVD drive would tend to rule it out - OTOH the strength of whatever holds it up to the button will likely be enough to stop it being moved out of alignment - and the distance of travel means a human could still get their hand in to operate the button themself - just in time for the CD drawer to pop-out and hit them... 8-)
    – SlySven
    Commented Dec 27, 2015 at 2:08

Solenoid yes but the best version I found was a car door unlock solenoid. You can push or pull with it. I used a 12v power supply and a transistor controlled from the GPIO pin.

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.