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.