I'm trying to power my servo from an external power source and control it with my Pi and I've found following circuit: http://razzpisampler.oreilly.com/images/rpck_1001.png

Why is there a resistance of 1k Ohm? Is it to limit the Pi's amperage to 3mA?

Ohm's law: V = I * R
3.3v = I * 1000ohm | / 1000ohm
3.3v / 1000ohm = 3mA

If yes, why 3mA?

  • I have never used a resistor with a servo. Perhaps the article assumes the worse case in that you'll accidentally connect the control wire to ground or servo power. That being said the resistor won't help on the Pi as the GPIO are 3.3V and won't be happy with 5V servo power. – joan Jan 20 '16 at 20:58
  • @joan, I am assuming this to be OUT at the pi and IN at the servo. That being said it should not kill the Pi. Without knowing the internals of the servo it is however difficult to tell whether it will work or not. – Ghanima Jan 20 '16 at 21:00
  • @Ghanima If you connect 5V to a GPIO it doesn't matter if it's an input or an output, it will potentially fry the Pi. That said I do connect 5V myself to a GPIO on occasion but in that case I use a 20k series resistor, and hope the internal protection deals with the 85 microamps ((5-3.3)/20000) – joan Jan 20 '16 at 21:06
  • I can't follow, if it is an INPUT at the servo side it should not be 5V... Put differently: I assume this is connected to the base of a transistor that's doing the switching inside the servo. In which case it does not matter what voltage the servo operates at. – Ghanima Jan 20 '16 at 21:08

Without knowing the interal circuit of this servo it is hard to tell. But let's assume this does not want to drive the servo directly from GPIO pin ;)

The series resistor is a measure of precaution to limit the current the GPIO pin will sink/source depending on its setting (in/out) and the load (in this case - whatever input circuit there is in the servo). GPIO current should be below 16 mA per pin (50 mA in total, all GPIO pins), so 3 mA is a reasonable value. Electrical engineers just pick a standard value, in this case 1 kOhm and that is that.

See also:

  • I don't know what is inside a servo, but doubt it would be the base of a transistor - any designer who did so should be shot!. What 99% of the discussion on this site misses is that bipolar transistors are controlled by current. The voltage is irrelevant (provided it exceeds VBE). The resistor is there to provide an approximation to a current source. Engineers don't just pick a value (although it may look like that - after designing 1000's you know the answer). What you should do is pick a resistor which provides the desired base current to turn the transistor on - dependent on load and HFE. – Milliways Jan 20 '16 at 22:29
  • I understand that it is moot to discuss this issue without knowing the internals of that servo. If it is an output at the servo it might fry the Pi, yes. But what use would an output have? If it is an input we have to assume it is reasonably "high-impedance" whether FET-like or a bipolar transistor (I do know that the latter is controlled by current). But if a bipolar transistor is used to just switch, you'd pick a current (and therefore a resistor at a given VBE) to safely saturate and be done. But you're right the answer is both over-simplifying things and implying facts we do not know. – Ghanima Jan 20 '16 at 22:36

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.