Im currently looking into building a quadcopter from scratch. The Raspberry Pi only has two PWM pins though, which isn't enough. And software PWM isn't great either, because you can't control a motor as precise as you could with hardware PWM. (And also it's unreliable.)

However, I found a servo driver using the PCA9685 I2C-to-PWM converter chip, which is basically a board that has 16 slots for servos that are controlled by hardware PWM. You communicate with the board over I2C and can set the frequency duty-cycle with a much greater resolution than you could with software PWM.

I was wondering whether or not I could use such a board for driving four ESC modules. It shouldn't make much of a difference, right? Are there any reasons why this wouldn't work? If so, is there any other way how I can control four ESC modules on the Raspberry Pi?

  • 1
    do you realize that you are asking a technical question about an unknown device?
    – jsotola
    Apr 13, 2020 at 18:12
  • Yes, a cheapy 16 channel PWM driver can control 16 servos at the same time.
    – tlfong01
    Apr 14, 2020 at 1:29
  • 1
    @jsotola Its just one of those common servo driver boards. I didnt add a link, cause I thought youre not allowed to do so on these sites. Just google "PCA9685" and youll find what I meant.
    – Gereon99
    Apr 14, 2020 at 15:55
  • 1
    Who told you that "you're not allowed to do that on these sites"? Can you point to a rule that states so? The link is materially relevant to the question. You should by all means include it. Heck, the question could be considered deficient without any examples of what you're talking about. PCA9685 is a chip, so any driver using that chip can be programmed the same way and will work largely the same. Apr 14, 2020 at 23:02

3 Answers 3


pigpio will let you control ESCs from the Pi.

It uses hardware timed PWM.

Python: use set_servo_pulsewidth

C: use gpioServo

Command line: use pigs s


Theoretically it will work.

In practice, you need your flight control loop to run in 5-20 milliseconds (that is, if the copter starts tipping to the side, you need to adjust the motor speed within 5-20 ms, otherwise it will crash). The actual value depends on how stable the copter is and how precise your measurements and computations are. Let's say it's 10 ms.

That is already a very tight loop for a Linux computer, and adding the i2c driver in it will make it worse. Let's say it takes a couple of milliseconds just to update the PWM for the four channels. For a LED display the delay is hardly noticeable. For a flight controller, that's 20% of your time budget!


Well, your Pi might heat-up very quickly, you can do that, if you use a voltage divider, and put 5V directly from that to Pi, and another divided 5V to the servo motors in a trail, with ground shorted. Because the total current drawn from all the gpio pins in Pi is 100mA for newer models of Pi and 50mA for older models, with a individual gpio limit of 16mA. But the 5V power pin of Pi can provide consistent 300mA. But it heats up the Pi-baby. And you don't wanna do that, are you?

I used 2 servos in one my projects and used voltage-divider for this purpose and it worked all fine.


  • 1
    I think you missunderstood something (or I didn't explain it well): I don't want to drive servos from the servo driver board but rather drive 4 ESC modules. For those I just need the PWM pin on the board and I wont use the power pins. The power for the ESC modules will actually come from a LiPo battery.
    – Gereon99
    Apr 14, 2020 at 16:17
  • 1
    No, understand this, the servo and an ElectronicSpeedController works exactly in the same way from a programming perspective, i used the servo example, because i experimented this on my own. They both use the PWM signal, for controlling. That's it my friend. Apr 15, 2020 at 8:06

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.