I have already searched the web, there are posts and articles showing how to control a servo motor or dc motor using raspberry pi.

my question is what is maximum number of motors i can control using only raspberry pi, breadboard and wire not using any external motor controlling board like Ryanteck or ... which would cost me extra money.

or the only way to control more motors are to buy one of those ???

any help please?

  • 1
    Ask yourself what you need to run the motors. I'm guessing for RC you need 5V and a PWM. 5V you'll want to supply separately, so you basically need a PWM for each motor. Now look at your datasheet and see how many motor PWMs you can supply with the board. – I. Wolfe Jun 4 '15 at 13:30
  • @I.Wolfe: It depends on what exactly he means by "RC" motor. All the RC motors I know run on anywhere from 7V to 25V. RC motors aren't typically connected to the "regulated" side of the power supply. They're connected directly to the battery via a speed controller. That way, the meager 2A or so of regulated power only needs to drive the servo signal to control motor speed and the motor itself can suck up as much amps as it needs which is typically anywhere between 20A to 100A. – slebetman Jun 5 '15 at 3:05

Simple. The maximum number is 0 (zero). You will need at least a transistor or a relay to drive the DC motor, as the GPIO pins on the rPi do not provide enough power to drive the motor. You will also want to put a flyback diode in place, plus a current limiting resistor. Since you said you only want to use a breadboard, rPi and motor, those components do not qualify.

Now, if you allow extra components/ICs, the limit is the number of PWM pins on the rPi of which there is just 1 (hardware), maximum all 27 if you use software-driven PWM like that enabled by libraries such as WiringPi, RPi.GPIO or PiGPIO.

  • There are two hardware PWM channels on the Pis with the 40 pin expansion header (and the compute module). Sometimes it is useful to draw the distinction between hardware timed PWM (e.g. pigpio) and software timed PWM (e.g. wiringPi, RPi.GPIO). Hardware timed PWM is pretty much immune to the jitter seen in software timed PWM. – joan Jun 7 '15 at 8:58

It depends on the type of motor.

  • Stepper motor: can rotate continuously, precise in-built position
    control, needs motor driver board, 2-4 gpios for control (usually 4).
  • DC motor: can rotate continuously, no in-built position control, needs motor driver board, 2-3 gpios for control.
  • Normal servo motor (and ESC): can only rotate half a revolution, in-built reasonably precise position control, in-built motor driver board, 1 gpio for control.
  • Continuous servo motor: can rotate continuously, no in-built position control, in-built motor driver board, 1 gpio for control.

Of course you can build your own motor driver board from discrete components or buy a chip such as an L293D.

My pigpio library provides hardware timed PWM on all the gpios on the expansion header. Servoblaster and RPIO.GPIO also provide hardware timed PWM.

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.