I'm currently working on a drone which is controlled by a Raspberry Pi. I try to control 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 cycle. 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()
I then found the manual where two different procedures for setting up the ESCs are described (https://www.tme.eu/Document/959503479e9fa7b0e61049c62875b2e2/BLHeli%20Instruction.pdf):
C1.Normal startup procedures:
Move throttle stick to the bottom position and then switch on transmitter→Connect battery pack to ESC→The long “beep” sound should be emitted , means the bottom point of throttle range has been detected→Several “beep” tones should be emitted to present the amount of battery cells→When self-test is finished, a “♪1 2 3” tune should be emitted→Move throttle stick upwards to go flying.
C2.Throttle range setting procedures: (when users change a transmitter, throttle range setting is recommended.)
Switch on the transmitter, move throttle stick to the top position→Connect battery pack to ESC→Two “beep” sounds should be emitted, means the top point of throttle range has been confirmed and saved→Move throttle stick to the bottom position (within 2s), a long “beep” sound should be emitted , means the bottom point of throttle range has been detected→Several “beep” tones should be emitted to present the amount of battery cells→When self-test is finished, a “♪1 2 3” tune should be emitted, Move throttle stick upwards to go flying. If the throttle stick is neither at the bottom position nor the top position after powered on, it will constantly make “beep” sounds.
Following this I tried the first method with no success and then the second one with a little more:
# import and setup as before... t1.start() t1.ChangeDutyCycle(10) input('Connect battery and press Enter within 2 seconds') # => multiple beeps after connecting battery t1.ChangeDutyCycle(5) # => motor does a very short spin at the end of his beeping-phase input('Wait until beeping ends then press enter to start spinning at 50%') t1.ChangeDutyCycle(7.5) # => motor does another short spin and then stops and beeps input('Press Enter to stop') # => it beeped one last time t1.ChangeDutyCycle(5) t1.stop() GPIO.cleanup()