4
$\begingroup$

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()
$\endgroup$
2
  • 3
    $\begingroup$ It appears you're doing everything right. From experience - you get three "boot" tones, then a low, then [number of cells] high tone. From there, you have a climbing tone that's played on repeat until you lower the throttle, then a set of descending tones, then the arming beeps. Consider increasing the PWM frequency. Look into oneshot 125 or multishot as these ESCs might not like such a slow signal (though I've done it before) $\endgroup$ Commented Nov 29, 2021 at 14:48
  • $\begingroup$ Are any of those commands for zero throttle? ESCs have a failsafe that prevents them running if the throttle is open when they boot. $\endgroup$ Commented Jan 26, 2022 at 9:09

2 Answers 2

0
$\begingroup$

It's possible your ESC is not calibrated to the PI's output.

Most ESCs are calibrated by this procedure (using a controller, you can translate this to your code):

  • Move throttle stick to Max position.
  • Power on model. You will here the battery cell count beeps, and a periodic single beep.
  • Move throttle to Min position. You will hear a beep confirmation.

Doing this configures the ESC for the

$\endgroup$
0
$\begingroup$

I think the problem is that you're not setting the throttle to zero at the start, so it's not arming.

The three beeps are the boot sequence. It sees 12v and assumes it's connected to a 3 cell lipo, and sets the low-voltage cut off accordingly. After that there should be an arming beep when it detects a zero-throttle signal.

If it doesn't see a zero, it may go into a programming sequence, where it continues beeping.

$\endgroup$

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.