Skip to content

Programming ESCs

Zachary Taylor edited this page Oct 8, 2018 · 2 revisions

Our platforms use standard hobbyist ESCs. We most commonly use BHeli_s or BHeli32 ESCs as they are cheap and easily available.

PWM types

There has been a bit of an arms race in ESCs with manufacturers trying to provide the lowest latency interface possible. This has resulted in many different standards (PWM, One-shot, Multishot, D-shot, etc).

A feature of the PX4 is that the PWM generation is performed via a separate co-processor that is on the same board. This has the advantage of allowing the PX4 to have 14 I/O ports and manual passthrough. However, it has the disadvantage that it prevents the ports easily using direct memory access which is needed to efficiently use some of the newer standards. This means the PX4 only supports PWM and One-shot (it also supports UAVCAN, an arguably better option that never took off). Luckily these are the two lowest rate options so any ESC that supports a newer format (D-shot is the current favorite) will automatically detect and switch to using these options.

Programming ESCs

ESCs can be programmed to set a large number of parameters. The most common one to change is what timing corresponds to a 0% throttle and 100% throttle. The default values for BHeli_s is a minimum of 1148 and a maximum of 1832. These values don't matter too much as long as roughly the same range is set in the PX4 PWM settings. Note that ESCs have difficulty driving motors very slowly and this can result in them twitching instead of spinning. Because of this we usually set the minimum PWM value that the PX4 sends slightly higher (around 1160) so that all motors spin smoothly on arming.

The programming can be done in two ways.

  1. Via the remote control, see the ESC manual for how to give the right series of throttle commands to put the ESC into the programming mode.
  2. Via a uart interface. Many ESCs can turn their PWM line into a half duplex uart interface to allow them to be programmed using a PC. A feature on most hobbyist flight controllers is the ability to pass data from a computer connected via USB to the ESCs for programming. Unfortunately (probably due to the co-processor I/O separation) PX4 does not provide this feature. Because of this we use a small separate flight controller flashed with Beta-flight to perform ESC programming.

Programming BLHeli via a Beta flight controller

Connect you ESCs to the flight controller as shown below: esc_programming

Download and install BLHeli- Configurator and follow the instructions to get up and running with it. If you need to flash BLHeli32 escs, as of the time of writing this the chrome app doesn't work and you will need to install the windows only BLHeli32 Suite.

Typically we only change two settings on the ESC

  1. Disable programming by TX. We do this as if you accidentally activate the ESC programming mode via the remote and change an ESCs range it can be difficult to debug why your system is suddenly flying poorly.
  2. Turn beacon delay to infinite. After a set period of time (usually 10 minutes) of being powered but disarmed the ESCs will start beeping. This is great for hobbyists who lose their systems in tall grass, and terrible for researchers trying to debug code.

ASL Specific

There is a MATEKF722 autopilot labeled 'esc flasher' that is kept in the PX4 box. It is running betaflight 3.5.1.