Differential Thrust Setup
Intro
Differential thrust with two motors is a fun, simple and versatile way to make use of just two ESC channels to drive a land or water vehicle (or potentially a simple aircraft, but we’re not tackling that here). The combined thrust from both motors is used to push the vehicle forwards (or backwards) while the difference between the two is used for steering. It is an awesome use of an FC with one damaged ESC channel.
There are a few ways to tackle this, but the neatest imho is via a custom motor mix on Betaflight. The following explains how I achieved this on the BeeBrainBL FCs with BetaFlight 4.2.2 for my airboat project, but should be easily adaptable to any other firmware or FC.
Motor Numbering, what is connected where?
Before you can do anything you need to map the motors to the correct resource, and before you can do that you need to determine which motor is which (assuming you have soldered two motors to the FC)
Connect to your FC in to Betaflight and go to the “Motors” tab
Click on the “I Understand The Risks” button (assuming you do) and spin each motor up individually using the sliders
Record which motor number corresponds the left-hand motor, and which to the right. Assuming there are only two motors connected there will be two channels that do nothing.
Got to the CLI tab and type “resource” and press enter to display the resource mapping. Look for the lines that show “resource MOTOR X YYY”, which define which motor (X) is mapped to which FC resource (YYY).
You now know which motor/esc numbers your left and right motors are on, and can record which resource/pin those are
We can go ahead and define a custom mix and map the right motors to the right pins.
ASSIGN RESOURCES
Resource Mapping
The motor mix makes reference to motor/esc numbers, but your flight controller needs to know which pins talk to which motor, we do this with "resource mapping" in the Betaflight CLI.
The following is the example of the commands used on a v1 BBL with the motors on the two rear ESCs.
resource MOTOR 1 B06
resource MOTOR 2 B09
save
Motor Mixing Intro
Through the magic of gyroscopes, accelerometers and PID loops a quadcopter is able to fly by subtly controlling pitch, roll, yaw and thrust.
The motor mix tells the FC how much an relative effect, and in which direction, each motor has on each degree of freedom (roll, pitch, yaw and throttle). You can read all about it on the Betaflight GitHub page.
For example, on a common Quad X config:
To roll right: Both left-hand motors ramp up
To pitch forward: Both rear motors ramp up
To yaw: Both clockwise or both counterclockwise motors ramp up (i.e. motors on opposite corners)
On top of these (which are defined by their relative speed), is throttle, which can be considered a scaling factor applied to all motors.
The differential thrust car or boat, with two rear-mounted forward-facing motors, one on the left and one on the right, is a much simpler beast.
Roll and Pitch are irrelevant and not controlled.
To yaw left: The right-hand motor ramps up
To yaw right: The left-hand motor ramps up
To speed up: Both motors ramp up
Custom Motor Mixing
The custom mix is set up via the CLI in betaflight, using the “mmix” command, which is of the form:
mmix n THROTTLE ROLL PITCH YAW
n defines the motor number, indexed from zero
THROTTLE (from 0.0 to 1.0)
ROLL (-1.0 to 1.0)
PITCH (-1.0 to 1.0)
YAW (1.0 = Counter-clockwise / -1.0 = Clockwise)
The following series of commands is therefore used to set up a simple differential thrust mix on two motors, which both respond to throttle and yaw only.
mixer custom #enable custom mix mmix reset #clear existing custom mix mmix 0 1.0, 0, 0, -1.0 #left-hand motor mmix 1 1.0, 0, 0, 1.0 #right-hand motor save
Custom Mix Configuration and Testing
Now return to the “Configuration” tab and select “custom” under mixing, to enable our mix, as well as enabling "3D" so that the motors can be reversed. Remember that you will need to do this on the ESCs too, in the case of the BeeBrain this is done with JESC configurator.