2

A Raspberry Pi's GPIO header includes power pins, and enough I/O pins to drive multiple servo motors.

When using this header's 5V supply to power servo motors directly (rather than using external power) it's very easy to place too much load on the PI, causing low-voltage conditions, freezes and restarts. (The most reliable way to power servos is indeed with a separate power supply.)

However for many users, especially with limited resources, the convenience and simplicity of powering and driving the servos directly from the Pi is huge.

What motors can typically be driven in this way before running into problems?

  • You can not power any servo from a GPIO (pin). The GPIO can not supply anywhere near enough current. You can probably power a couple of 9g servos from most Pis 5V power rail. However even that depends on the servo load and the power supply to the Pi. This question has too many unknowns. – joan Oct 16 at 20:35
  • @joan By GPIO pins I mean the 40-pin header, generally referred to as the GPIO header even if not all the pins on it are strictly speaking GPIO pins. As my answer below indicates, it's possible to power a least three servo motors reliably from the 5V rail. – Daniele Procida Oct 16 at 22:07
  • 1
    @Daniele Procida, Ah, let me see. (1) The Rpi 40 pin header has two kinds of pins: (a) Power pins: 3V3 and 5V0, (b) GPIO pins: input/output pins of 3V3 logic. You seem to ask about the power pins and NOT the logic GIPO pins. (2) So to answer you question, we need two pieces of data: (i) What is the maximum current of the 5V power pin (call it "Rpi5Vmax/current"), (ii) What is the maximum current of Sg90 ("Sg90maxICurrent). Example, max number of SG90 servos = Rpi5VmaxCurrent / Sg90maxCurrent. If my guess is correct, I can find the max number of servos (or combination) for you. – tlfong01 Oct 17 at 2:57
  • 1
    @Daniele Procida, Now let me take the very popular, more powerful TowerPro MG995 as an example. First, the current spec summary: (1) Idle = 10mA, Operation = 170 mA, Stall = 1.2A - (1) towerpro.com.tw/product/mg995. And Rpi3 5V rail max current is about 1A (see Update 1 of the following post: (2) raspberrypi.org/forums/viewtopic.php?f=37&t=77158#p1323061, so it "safe" to load 3 to 5 MG995s. – tlfong01 Oct 17 at 5:31
  • @Daniele Procida, from time to time I read newbies trying to get power from the GIPO signal pins. Some might even connect the GPIO pins to to 3V or 5V power pins to "strength" the power. And BTW, when I said the 5V power pin can handle 3 to 5 mg995s, I assume they are not carrying a heavy load, or in the worse case, "stalled" because the load is too heavy. Two bad things might happen when more than one servo are stalled, sinking 1.2A stall current each from the 5V power rail. If all 5 servos stall the same time, total stall current is over 5A, and might trip the Rpi3B+ polyfuse, ... :( – tlfong01 Oct 19 at 1:57
1

Where multiple motors are indicated as working reliably, this means that all motors were in operation at the same time, over an extended period of time.

Numbers indicate the largest number of motors that were tested simultaneously.

Reliable under all tested conditions

Power source: official Raspberry Pi PSU

  • TowerPro SG90 * 3
  • TowerPro SG92R * 3
  • Futaba S3001 * 2, TowerPro SG90 * 1
  • Etronix GS045 * 2, TowerPro SG90 * 1

Power source: OTG power supplied over USB

  • TowerPro SG90 * 3
  • TowerPro SG92R * 3
  • Etronix GS045 * 1

Not reliable

Power source: OTG power supplied over USB

Load causes restarts or freezes:

  • Etronix GS045 * 2
  • Etronix GS045 * 1, TowerPro SG90 * 1

(Please feel free to add data based on experience to this answer.)

  • 1
    this cannot possibly be the answer to the question ... the question asks about supplying power to servos from RPi GPIO pins ... this list may be related to controlling servos, but not to supplying power – jsotola Oct 16 at 21:41
  • 1
    "all motors were in operation at the same time" -> You make no mention of load here, which is pretty fundamental with servos. I can attach a few SG90s and make them wave around endlessly, but when they actually have to move something besides themselves the picture starts to change... – goldilocks Oct 17 at 10:12
  • 1
    @goldilocks I don't have a good way to quantify it unfortunately. My use case is brachiograph.readthedocs.io, which is not a very high load, but at least gives a starting point. In practice, with the combinations that I found that work reliably, I haven't found that applying higher loads made any difference. – Daniele Procida Oct 17 at 10:43
  • You're almost certainly the only person that will claim applying higher loads did not make any difference to servo operation... – goldilocks Oct 17 at 11:02
  • @goldilocks "with the combinations that I found that work reliably, I haven't found that applying higher loads made any difference". All I can describe is the experience I have had so far. – Daniele Procida Oct 17 at 11:19
0

You can not power any servos from the Pis GPIO.

To attempt to do so will endanger and possibly destroy your Pi.

The Pi's GPIO can only supply about 20mA in current (far too little to power a servo) and should NEVER be directly connected to an inductive load like a motor.

You can't power a servo with a GPIO but you can supply the control signal from a GPIO (the control signal is the 50 Hz stream of pulses used to position the servo).

The Pi's expansion header has two 5V pins. These may be used to power a few servos depending on the following circumstances.

  1. The amount of spare power (current) available from the 5V pins. This might be nothing to a couple of amps depending on the Pi model and the power supply.
  2. The power requirement of the servos under no-load. See the servo datasheet.
  3. The power requirement of the servos under heavy load to stall conditions. See the servo datasheet but be aware this can easily be several amps.

If the 5V pins are overloaded the Pi will crash. This in itself is unlikely to damage the Pi but may corrupt the SD card.

  • I think there is a misunderstanding here. I am speaking of the 40-pin header, commonly referred to as the GPIO pins raspberrypi.org/documentation/usage/gpio, even though not all of these are strictly speaking GPIO, but ground, 5V and 3.3V. Obviously, it's the Pi's power pins on the header that the question is about; it wouldn't make any sense to attempt to power a servo via one of the signalling pins. I've updated the question to make this clearer. – Daniele Procida Oct 17 at 9:47

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.