Close

Get your flight controller ready - with betaflight!

A project log for The Ball-Drone Project MK II

Single rotor, "singlecopter", selfmade drone with air vanes for position control as a full remake of the Ball-Drone Project

Benjamin PrescherBenjamin Prescher 11/01/2020 at 16:450 Comments

Contrary to the previous ball drone, I now wanted to use a flight controller and software that is virtually freely accessible to everyone. There are a lot of open source projects, but Betaflight is currently the standard for racing drones, there are many tutorials and resources on the internet what makes me not to explain betaflight again. But how do you get from a racing quad to a single-rotor drone? Here's how:

Resource mapping:

Basically you need a motor and four servos to control your single-rotor copter. Most flight controls have four motors and some of them have some servo outputs as well. What I did is remapping the Betaflight servo controls to the "standard" four motor outputs. Now a connection for the motor is needed. Via the configuration of the flight controller I used, I was able to see at which connections timers are available. You often read about using the LED_strip port for a motor, but I wanted to use the LED_strip port and decided to remap the PPM input as a motor output. What resource remapping is and how to is shown for e.g. in this video.

The CLI commands I used:

resource MOTOR 1 NONE
resource MOTOR 2 NONE
resource MOTOR 3 NONE
resource MOTOR 4 NONE
resource PPM1 NONE
resource SERVO 1 A03
resource SERVO 2 B01
resource SERVO 3 B00
resource SERVO 4 A02
resource MOTOR 1 C09
save

Mixer configuration, mmix, smix:

Next, the flight controller must be made to send the correct signals to the servos and the motor ... For this, adjustments must be made in the so-called mixer. Select "Custom Airplane" under the configuration tab.

Handle this via the command line:

# smix script for singlecopter on MambaF405_MK2 (by Benjamin Prescher)
mixer CUSTOMAIRPLANE

# load a standard motor mix
mmix reset
mmix load airplane    # Motor1 as ESC output
#mmix 0  1.000  0.000  0.000  0.000

# smix
smix reset
smix 0 3 0  100 0 0 100 0
smix 1 2 0 -100 0 0 100 0
smix 2 4 1  100 0 0 100 0
smix 3 5 1 -100 0 0 100 0
smix 4 3 2 50 0 0 100 0
smix 5 2 2 50 0 0 100 0
smix 6 4 2 50 0 0 100 0
smix 7 5 2 50 0 0 100 0
save

If you want to find out more about what is actually happening here, take a look at these links:
https://github.com/martinbudden/betaflight/blob/master/docs/Mixer.md

Configs on the servos:

As you can see in the picture of mixer config, I have set a relatively low PID loop rate. The servos that control the copter can usually be operated with a servo_pwm_rate of max. ~ 333Hz (there are also servos that can certainly handle more). I have set my servo_pwm_rate to 250Hz, which corresponds to a quarter of the PID loop rate. As far as I understand the algorithms in betaflight, there is no point in setting the PID rate artificially high if the command for the actuators can only be updated a fraction of it anyway. For the PIDs (more on this later in another log) I use strong P values. The servos with the vanes then tend to jitter. Betaflight has a great feature to solve the problem, this is called a servo low pass filter:

Handle this via the command line:

set servo_lowpass_hz = 20
set servo_pwm_rate = 250
save

Time for testing:

If you have already set up the drone, connected everything and also implemented the configuration, then your drone should behave as follows:

A personal note on Betaflight:

Betaflight is just one option I used to get your drone in the air. All of the above steps can be done (not tested) using iNav as well, and I heard Ardupilot should do the job too!

Discussions