Ok so, I’m going to be using a pi zero and an esc to control a brushless motor based on a Bluetooth controller input. Basically, I want to know how via python I can control the esc. I heard using gpio works, however some people say it isn’t precise enough or something along those lines and I would need to use something like the adafruit pca9685. This is because apparently there needs to be a wave that is exactly 1ms long for the esc to accept a reading or something along those lines. Is this true? Or Can I just hook the esc directly up to the pi gpio pin? If not, how would I wire things and hook up the adafruit? The esc basically has one signal wire that you can wire in that receives the pwm signal, and 2 other ground/positive wires for those who aren’t familiar.


Servos/ESCs need accurately timed pulses. Software timed PWM will sort of work but will introduce jitter (which will shorten the life of an attached servo).

You could use hardware PWM signals which may be generated on GPIO 12/13/18/19. There are only two channels so GPIO 12/18 will have the same settings as will GPIO 13/19.

Alternatively there are libraries to provide hardware timed PWM on all accessible GPIO. (My) pigpio, servoblaster, and RPIO.GPIO (not RPi.GPIO) are probably the most popular.

As a test connect your ESC control wire to a GPIO. If you use an external power supply for the ESC make sure you also connect the ESC and Pi grounds.

sudo pigpiod  # start the pigpio daemon

pigs s 4 1000 # send servo pulses to GPIO 4 - 1000us
pigs s 4 2000 # send servo pulses to GPIO 4 - 2000us

pigs s 4 1500 # send servo pulses to GPIO 4 - 1500us

Some ESCs need to be "armed" by minimum and maximum pulse lengths (the 1000/2000). Your ESC may be different. Change 4 to the GPIO you use.

  • Let’s say I’m using this esc also: rover.ebay.com/rover/0/0/… how would I differentiate between the power/ground/pwm wire and the sensor wires and also would it be possible to use the electric braking system via the pi that it talks about in the description? This would program how you said it would also right? It just confused me because it talks about some led programmer board in the description and I wanted to know if the pi would be applicable still! – sjfklsdafjks Dec 6 '17 at 13:06

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.