I’m currently working on a drone which is controlled by a Raspberry Pi. I try to controll the motors by using PWM on the connected ESCs, which is described in many guides and forums. For that I use the code below with little success. The ESC makes 3 beeps when connected to the power and then 3 beeps for the first to changes of the duty cicle. Those first two changes are for arming the ESC (at least that’s what I read). It seems that the arming kinda works, as it makes those beeping sounds. But the motor is not spinning after the last change to 7.5 (which should make it run at 50% power).
I do not see the problem here, from what I read it should work just fine that way.
Hopefully someone with more experience can explain to me what I’m doing wrong.
Those are the ESCs I’m using: https://emaxmodel.com/products/emax-formula-series-45a-esc-support-blheli_32-2-5s#
from time import sleep import RPi.GPIO as GPIO esc_gpio = 11 GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(esc_gpio, GPIO.OUT) t1 = GPIO.PWM(esc_gpio, 50) t1.start(0) t1.ChangeDutyCycle(10) sleep(2) # => during this the esc makes 3 beeps t1.ChangeDutyCycle(5) sleep(2) # => during this the esc again makes 3 beeps t1.ChangeDutyCycle(7.5) sleep(5) # => no beeps here t1.stop() GPIO.cleanup()
Source: Python Questions