Custom Motor Mixing for Multirotors: What is it and How to Calculate

by Oscar

Custom motor mixing is a technique used to adjust motor output power, optimizing the performance of your FPV drone.

Some of the links on this page are affiliate links. I receive a commission (at no extra cost to you) if you make a purchase after clicking on one of these affiliate links. This helps support the free content for the community on this website. Please read our Affiliate Link Policy for more information.

Understanding Custom Motor Mixing

Motor mixing, or the output mixer, is essentially a table that dictates the force magnitude applied to each motor of a multirotor. This setup is crucial, particularly for X4 quadcopters, which typically exhibit 100% output force across all three axes due to their symmetrical design.

Flight controller firmware like MultiWii, BaseFlight, CleanFlight and Betaflight offer several default mixes for various configurations such as tricopters, hexacopters, and octocopters. However, if your multirotor frame is asymmetrical or uniquely designed, it might still fly adequately with a default output mixer, but there’s a chance the motors could be providing inappropriate thrust levels. Ideally, with custom motor mixing, we aim to minimize the need for corrections and thus enhance your drone’s performance.

Note: Altering your motor mixer settings can disrupt motor outputs and cause significant issues if done incorrectly. Do not directly copy and paste the cmix table from this post into your CLI; instead, input it manually. Use custom mixer settings at your own risk.

Is Custom Motor Mixing Necessary?

The necessity of custom motor mixing depends on several factors. Motors positioned further from the center of gravity require more thrust to achieve the same movement as those nearer to the center, due to their longer travel distance.

Additionally, the layout of the motors and mass distribution significantly impacts quadcopter performance. For instance, an FPV drone often has a more centralized mass along the roll axis than the pitch axis, influenced by the placement of cameras and batteries. This setup allows for higher P and I gains on the pitch than on the roll, simplifying the tuning process.

For frames with standard rectangular motor layouts, adjusting your P and I gains appropriately may suffice without altering your motor mix. However, for non-rectangular layouts—such as dead-cat or T-copter configurations—and more complex designs like A-tail or V-tail, custom motor mixing becomes more essential.

Custom motor mixing also facilitates the remapping of motor output pins, enhancing configuration flexibility. Here’s a tutorial on how to accomplish this: http://intofpv.com/t-remap-motor-outputs-use-spare-motor-output-pins

Implementing Custom Motor Mix in Cleanflight

For this guide, I’m using a Naze32 flight controller with Cleanflight, and I’ll explain how to set up custom motor mixing specifically for this system. Each motor’s output is defined using a custom mixing table, formatted as follows:

mmix [motor number] [throttle] [roll] [pitch] [yaw]

For a standard X configuration quadcopter, the layout typically looks like this:

  4CW      2CCW
         /
     Naze32
     /    
  3CCW     1CW

Here’s the predefined motor mix for this motor layout:

mmix 1 1.000 -1.000 1.000 -1.000 (Rear Right motor)
mmix 2 1.000 -1.000 -1.000  1.000 (Front Right motor)
mmix 3 1.000 1.000 1.000 1.000 (Rear Left motor)
mmix 4 1.000 1.000 -1.000 -1.000 (Front Left motor)

Note: In Baseflight, the command is cmix, while in Cleanflight, it’s mmix.

The values are mostly set to 1, indicating that 100% force should be applied. This standard setup works well due to the symmetrical geometry of an X configuration quadcopter. For controllers like KK2, which use percentage-based values, they would use 100 instead of 1 in their custom mixer table.

However, many popular quadcopter frames, such as the Deadcat450, Blackout 250 mini quad with extended 6′ arms, and the QAV250, deviate from the perfect X configuration. This deviation is where custom motor mixing proves beneficial in optimizing flight performance.

To illustrate, I’ll use my ZMR250 mini quad frame as an example. After measuring, I found that the frame’s width is longer than its length, prompting adjustments in the motor mixing to better suit its unique dimensions. While this guide focuses on simpler quadcopter configurations, the principles apply to more complex layouts like hexacopters and octocopters, although those are beyond the scope of this discussion.

Remember, while it’s advisable to start with calculated values for custom motor mixing, feel free to tweak these settings based on your personal preferences and flight style.

Calculating Custom Motor Mix: The ZMR250 Example

When customizing motor mix settings, we’re essentially looking at four key values: throttle, pitch, roll, and yaw. Throttle is typically set to 1 for all active motors in this configuration, with unused set to 0. The yaw value, which indicates the direction of motor rotation, is straightforward—CCW motors are set to 1 and CW motors to -1. Since all four motors on a symmetrical frame like the ZMR250 are oriented similarly, their force magnitude defaults to 100%.

The real customization, however, comes into play with the pitch and roll values, which range from 1.0 to -1.0. To find these values, we calculate the ratio of each motor’s distance to the pitch and roll axes compared to the longest distance across these axes on the frame.

Confused yet? Let’s break it down with a hands-on example.

First, get a 3D CAD drawing of your frame or sketch it out on paper to measure the distances from each motor to the roll and pitch axes.

zmr250-cad-top zmr250-drawing-outline-shape-dimension zmr250-drawing-outline-shape-dimension-arm

For my ZMR250, which is longer in width than in length, the measurements were:

  • Motor to Pitch axis = 7.75 cm
  • Motor to Roll axis = 10.125 cm

zmr250-drawing-outline-shape-dimension-graph

Using the longest distance (10.125 cm) as the denominator, we can calculate the custom motor mix:

Motor1:

  • Roll: 10.125/10.125 = 1
  • Pitch: (-) 7.75/10.125 = -0.765

Motor2:

  • Roll: (-) 10.125/10.125 = -1
  • Pitch: (-) 7.75/10.125 = -0.765

Motor3:

  • Roll: 10.125/10.125 = 1
  • Pitch: 7.75/10.125 = 0.765

Motor4:

  • Roll: (-) 10.125/10.125 = -1
  • Pitch: 7.75/10.125 = 0.765

Here’s how you’d input these into Cleanflight for a ZMR250:

mmix 1 1.000 -1.000 0.765 -1.000
mmix 2 1.000 -1.000 -0.765 1.000
mmix 3 1.000 1.000  0.765 1.000
mmix 4 1.000 1.000 -0.765 -1.000

This method, while seemingly simple, is crucial for optimizing the performance of asymmetrical frames by accurately distributing motor force according to physical layout.

A Trigonometric Approach to Motor Mixing

An alternative method inspired by the KK2 board uses trigonometry to determine custom motor mix settings, eliminating the need to measure distances directly. This method relies solely on the angles between each motor and the flight controller (FC) relative to the roll and pitch axes.

Here’s how to calculate it for motor 2 of the ZMR250 frame:

  1. Measure all angles between the motor-FC to the roll axis and the pitch axis using a protractor. Assume the maximum angle as your denominator.
  2. For motor 2:
    • Angle A = 51.6°
    • Angle B = 38.2°

Calculating pitch and roll values:

  • Roll: sin(A) / sin(A) = 1
  • Pitch: sin(B) / sin(A) = 0.6184 / 0.7837 = 0.789

These values closely resemble those calculated through direct measurement, showcasing the consistency and reliability of trigonometric calculations in custom motor mixing.

zmr250-angle-cmix-custom-mixer-mixing-calculation

So how do we know if this actually works? If we look deeper, you will realize this second method can be transformed into the first method.

sin(A) = a / c
sin(B) = b / c

so when calculating Pitch, we have sin(B) / sin(A) = (b / c) / (a / c) = b / a.

With Roll, we have sin(A) / sin(A) = (a / c) / (a / c) = a / a.

In essence, whether you prefer direct measurement or trigonometric calculations, both methods ultimately serve to enhance your drone’s responsiveness and flight stability, particularly in custom or non-standard frame designs.

How to Set Custom Motor Mix in Cleanflight

Steps to configure custom mixer in the CLI:

  1. Enter mixer custom to enable the custom mixing.
  2. Type mmix reset to erase the any existing custom mixing.
  3. Use mmix statement for each motor in this syntax: mmix NUMBER THROTTLE ROLL PITCH YAW

Other use of Custom Motor Mixing

While the primary function of custom motor mixing is to enhance your drone’s flight performance, it’s versatile enough for other practical applications. For instance:

  • reverse motor rotations
  • if you have damaged motor output pin/solder pad, you can use a spare motor output pin
  • change motor order

Edit History

  • Mar 2015 – article created.
  • Apr 2024 – fixed grammar.

Leave a Comment

By using this form, you agree with the storage and handling of your data by this website. Note that all comments are held for moderation before appearing.

78 comments

Chabaz 25th February 2020 - 2:38 pm

What if you cant place the fc at the center if the quad, ie. It is offset significantly aft of the cg.

Reply
Tavis 3rd March 2018 - 8:04 am

I tried this with no luck, until I changed it from motors 1,2,3,4 to motors 0,1,2,3

Reply
Patrik Bergdahl 6th March 2017 - 10:37 am

have´t used this but looks good to me iforce2d.net/mixercalc/

Reply
Michael Whiting 12th January 2017 - 9:18 pm

i know this is a old article but I am having trouble getting this to work properly. I have a ZMR 250 quad frame just like the one you used in your example and I am also running clean flight. the problem is after I change the quad type to “Custom” and enter in the new mmix values in the cli the quad will not arm. I have tried it several time and havfe reread this article probably 4 time now and I still done know why it wont work. any help would be greatly appreaciated.

Best regards,

Michael

Reply
Oscar 21st January 2017 - 6:05 pm

simply change it back to quadx in the mixer settings tab. If still no joy, trying resetting all settings, or even re-flash firmware. I reckon you probably changed some parameters by mistake.

Reply
Derrick Mitchell 27th November 2016 - 2:28 pm

In your opinion which is best Cleanflight or Baseflight to do a custum mix on for a Vtail 500? It is a Lyxmotion Vtail. In addition can you give me the mmix or cmix for it, right now it flies like crap.

Reply
Oscar 28th November 2016 - 4:03 pm

Baseflight is dead, use Cleanflight.
sorry I’ve never built a VTail so can’t advice on that…

Reply
Gabriel Morales 21st April 2016 - 1:54 am

Hi Oscar,

Very nice post. Please help with one simple question regarding a large, custom hexacopter my dad and I are building from scratch ? We’d greatly appreciate it !

The Hexacopter is about 42″ in diameter…some key points…
1.) All 6 motors are equidistant to the center, essentially arranged in a perfect circle
2.) There is an equal arc distance between every single motor, everything is accurately and evenly spaced out down to the mm.
3.) The center of gravity will lie exactly within the geometric center of the motors. It will be perfectly balanced, regardless of its long nose.

THE QUESTION: can we use a standard Naza V2 flight controller with the “V” config hexacopter layout as it comes from the factory without having to do custom motor mixes? ….and I ask this because even though our motors are arranged symmetrically the arms do not attach the same way to the body of the hexacopter. Will the gyro within the Naza be able to disregard arm attachment points and just focus on where the motors are oriented in space?

Thanks in advance !!

Reply
Sal 29th June 2016 - 1:58 pm

Hi Gabriel;

Hope you are doing well.

Have you managed to control your Hexacopter ? i working on the same project ! any recommendation ?

Thanks

Reply
Mohammad 28th September 2022 - 6:45 pm

Hi guys, I have created my custom Hexacopter with custom flight controller and it flies well

Reply
David 13th April 2016 - 9:35 am

Hi Oscar,
Here is a link to a very useful online calculator. Even creates the CLI command for you (for those who don’t like the math) :)

Reply
billyd 11th March 2016 - 4:45 am

Hi Oscar

What if the FC is not on the CG of the aircraft? Do we measure to the CG of the FC or the CG of the aircraft?
It seems odd that we would measure to the FC, but that is what the docs are saying. The cg of the FC.

I guess it makes sense if the FC is regulating accelerations and not thrust. Then it wouldn’t care about the CG of the aircraft directly.

Although I think using the cg of the aircraft might be a better choice since knowing which motors are most effective at changing accelerations would be valuable. If we took a case where the FC was extremely far from the CG, I think if you entered a CMIX with distances to the CG of the FC, instead of the CG of the aircraft, it could cause a lot of problems in stability.

I’ve really managed to confuse myself.

ps With respect to the directions of the motors. In a coaxial arrangement, if all motors spinned CCW, would you enter CW as the rotations for the bottom motors? Since their apparent rotations would be opposite that of the top motors.

Thanks for any comments,

Billy D.

Reply
Vytautas Valaitis 8th March 2016 - 7:43 pm

Nice tutorial!
But, I think, gyro should be considered as a center point, not the actual center of the frame.
Naze32 rev5 has gyro way of center, e. g..

Reply
Oscar 9th March 2016 - 12:00 pm

you are right, but the difference, is so small (less than 1 cm), you can hardly tell the difference anyway
unless you are doing it on a much smaller frame… then it becomes more important.

Reply
Mark Duncan 7th March 2016 - 10:18 pm

Hi Oscar

Nice post, have you see the guy on you-tube who has a calc tool for this purpose. fancy testing it and giving a verdict on it ? youtube.com/watch?v=9FvpT9jH0NA

Reply
Vasic 9th February 2016 - 10:28 pm

You write:
Motor1:
Roll: 10.125/10.125 = 1
Pitch: (-) 7.75/10.125 = -0.765

But command is:
mmix 1 1.000 -1.000 0.765 -1.000

Is sighn wrong or i miss something?

Reply
mzahana 8th December 2016 - 2:08 pm

I believe yes. There is a sign error. It should be:
mmix 1 1 1 -0.765 -1

Reply
Capsurfer 10th December 2015 - 11:56 am

Hi Oscar,
I am currently working on an OCTOX8 ZMR250 with a Naze32 board, because why not. I am still in the planning phase.

Motors 1-6 will be mapped to the standard motor pins. Motors 7 and 8 will be mapped to the PIN_OUT 5 & 6. Additionally I want to add a LED Strip. My problem is the LED STRIP feature maps PIN_OUT 5 to the signal cable. However this is already used by Motor 7.

I am not planning to use the PIN_OUT 2,3,4,7 & 8, so I was thinking about 2 possible solutions.

This is my initially planned motor mix:

mixer custom
mmix reset
mmix 1 1 -1 0.772 -1
mmix 2 1 -1 -0.772 1
mmix 3 1 1 0.772 1
mmix 4 1 1 -0.772 -1
mmix 5 1 -1 0.772 1
mmix 6 1 -1 -0.772 -1
mmix 7 1 1 0.772 -1
mmix 8 1 1 -0.772 1

Easiest solution could be to replace mmix 7 & 8 with 9 & 10.

mixer custom
mmix reset
mmix 1 1 -1 0.772 -1
mmix 2 1 -1 -0.772 1
mmix 3 1 1 0.772 1
mmix 4 1 1 -0.772 -1
mmix 5 1 -1 0.772 1
mmix 6 1 -1 -0.772 -1
mmix 9 1 1 0.772 -1 ->should map to pin 7 on the naze?
mmix 10 1 1 -0.772 1 -> should map to pin 8 on the naze?

Could this work? Is it allowed to skip mmix 7 & 8?

My other ‘solution’ would be to compile my own .hex file which maps the LED_STRIP feature to either PIN_OUT 2, 3, 4, 7 or 8. Tricky thing is, I can’t find the mapping in the source code. Could somebody point me to the correct file:line_number?

Any other obvious solutions I might have overlooked here?

Reply
Henk 12th September 2015 - 10:50 pm

Look at : Motor mixing calculator
iforce2d.net/mixercalc/

Reply
Scott 27th October 2015 - 6:13 pm

Thank you for this post it really has helped. Also big thanks to Henk for the motor mixing calculator which has saved me a lot of math:)

Reply
Ed 21st November 2015 - 2:55 pm

Hi Henk,

Tried your calculator with Quanum XJ470 frame.
Motors 1&3 are 144mm from the pitch axis,
Motors 2&4 are 161mm from the pitch axis.
Calc giving same pitch ratio. Don’t think this is right.

Uploaded my workings here blindtuna.com/wp/index.php/2015/11/21/quanum-xj470-calculating-cmix/

Reply
Kim 1st September 2015 - 1:57 pm

Hi Oscar
Still seems wrong in the motor orientation? Im trying to figure out what set in cli for my zmr 250.
Very confusing

Reply
Oscar 3rd September 2015 - 3:55 pm

don’t know what’s wrong with me Kim… i think i need more sleep! corrected it now.

Reply
Bob 22nd August 2015 - 12:03 pm

Hi Oscar,
Another thing to consider is the weight distribution of your quad. With my square x mini quad, the battery runs down the centerline – this means the pitch axis has a much higher moment of inertia. So even though it’s square, I still run a custom mix that cuts back the roll column by 40% because the weight distribution rolls easier than it pitches.

Reply
Oscar 24th August 2015 - 10:56 am

HI Bob,
yes that’s a very good point!!
That’s why on a lot of ZMR250 people didn’t use any cmix they still fly well, because it’s wide, and weight on pitch is heavier, so extra forces required on each axis just cancel out!
thanks
Oscar

Reply
Pakal 8th August 2015 - 3:56 pm

You should correct your article : the motor diagram shows the naze32 configuration but then you define Motor 1 as the front left one. It generates some confusions, as other readers have pointed out.

Reply
Blaine 28th August 2015 - 7:38 am

Hi Oscar,
Great description, but PLEASE fix the motor layout description.. it’s all in the wrong order and very confusing.

Reply
Oscar 28th August 2015 - 12:10 pm

sorry Blaine, it’s fixed now, could you check if it’s correct now?

Reply
Cedric 31st July 2015 - 10:12 am

I’m using the latest firmware by Boris B, that has the new LuxFloat v2.

When I try to enter “cmix reset”, in CLI, I get a unknown command error.
Also in the “help” listing, cmix is no longer present as a command.

Is there a work around for this? Possibly using mmix? I’m unsure of the difference between cmix and mmix.

Is cmix being phased out?

Thanks.

Reply
Cedric 1st August 2015 - 5:49 am

cmix is now mmix.
And motor numbering is now 0,1,2,3. Instead of the old 1,2,3,4.

Reply
Oscar 6th August 2015 - 12:26 am

sorry i am not sure about Boris B firmware, maybe he’s changed the naming? better check with him :)

Reply
Ale 10th August 2015 - 4:52 pm

I try this, so what you say is correct:
# mmix load quadx
Loaded QUADX
Motor Thr Roll Pitch Yaw
#0: 1.000 -1.000 1.000 -1.000
#1: 1.000 -1.000 -1.000 1.000
#2: 1.000 1.000 1.000 1.000
#3: 1.000 1.000 -1.000 -1.000

Reply
Rick Trimble 24th July 2015 - 9:01 pm

I’ve got a Armattan cf258 vtail. I don’t know how to get the measurements without disassemble. I also don’t know how to implement it. Bought it built, and looks like it is a custom mix, as baseflight vtail is actually for Atail, if I understand correctly. I think I use ‘0’ in the cleanflight, but am not sure. I am unhappy with its performance in baseflight, and PID’s are not the only problem their, I am thinking. Is there someone who has used cleanflight for a 258 vtail with success? If so, I would really appreciate knowing what I must do in cleanflight to be able to use my vtail. My standard x quad is in cleanflight now, and it is under page ‘3’, and it is so much nicer to fly.

Respectfully
Rick

Reply
moosestang 13th July 2015 - 11:26 pm

what if your front motors are closer to the roll axis than your rear motors and your rear motors are closer to the roll axis than your front motors? I get 27mm to pitch axis for fronts and 47mm for rear, i get 57.5mm for the front motors to the roll axis and 40mm for the rear.

Reply
moosestang 13th July 2015 - 11:27 pm

Sorry, i meant front motors are closer to the pitch axle than rear and rear are closer to roll than front.

Reply
moosestang 14th July 2015 - 1:15 am

Ok, i’m assuming the units of measure don’t matter here, so using my mm numbers this is what i get, if i’m doing this right

cmix 1 = 1/-.851/1/-1
cmix 2 = 1/-1/-.452/1
cmix 3 = 1/.851/1/1
cmix 4 = 1/1/-.452/-1

??????

Reply
moosestang 15th July 2015 - 12:51 am

So do you use the largest pitch/roll distance as the constant for calculating all motors? Or would i use the largest roll/pitch for the front motor calculations and the largest roll/pitch for the rear motor calculations?

Reply
Oscar 15th July 2015 - 12:47 pm

use largest pitch or roll distance for both.

Reply
moosestang 17th July 2015 - 2:44 am

Hi Oscar. I have another question. I’m starting to second guess myself on what motors should have how much power authority. In the dead cat configuration, the rear motors are closer to each other and closer to the yaw axis. Would the rear motors then require more power to yaw the quad than the front motor or less? It seems like they would need more power to turn it equal distance as the fronts. Also if i think about the front and rear arms as levers, would not the front motors reqire less power to roll the quad than the rears since the motors are further from the roll axis? a longer lever reqires less force to turn than a shorter one. This stuff is making my head hurt.

Reply
Oscar 19th July 2015 - 7:41 pm

don’t think about power, think about the time it would take for it to rotate the same distance… under the same force, longer arms will take longer to rotate the same degree than shorter arms, so you want to apply larger force on them…

Reply
Rob2160 4th August 2015 - 5:13 am

Hi Moosetang,

In a quad that is symmetrical left to right the Centre of Thrust (CoT) is located mid point between the front and rear motors.

I understand your rear motors are closer together than your front motors. This does not affect the fore and aft CoT position.

Imagine all motors are producing equal thrust – the resultant of the front motors acts on the centre line of the frame and so does that of the rear motors – the Centre of thrust is midpoint between these two resultants. i.e. mid way between front and rear motor pairs.

This is where you should locate your CG and ideally the FC also. This position is where any custom mix calculations should be derived otherwise one pair of motors will always be working much harder than the other.

Also there seems to be some confusion about what the CMIX, MMIX values are doing. They are telling the FC how much authority each motor has over the FC. IE, looking at Roll, a value of 1.0 means it has maximum roll authority, a value of 0.5 means it has 50% roll authority (compared to 1.0)

See the explanation here. (and quoted)

github.com/cleanflight/cleanflight/blob/master/docs/Mixer.md

Roll – indicates how much roll authority this motor imparts to the roll of the flight controller. Accepts values nominally from 1.0 to -1.0.

Pitch – indicates the pitch authority this motor has over the flight controller. Also accepts values nominally from 1.0 to -1.0.

I have developed a custom mix calculator for Quads and Hexacopters – you can download it here. It assumes CG of your quad will be at the CoT (mid point between front and rear motor pairs) and for a Hex it will auto calculate the CoT (which is the optimum location for CG to ensure all 6 motors work evenly in a hover)

dl.dropboxusercontent.com/u/62849459/NAZE%20MIX%20EDITOR%20V3.xlsx

Reply
Tony Perr 21st May 2015 - 12:51 am

I ended up with this mix for my Spedix S250 Agility Version Frame. The rear two motors are closer to the roll axis than the front two. Seems like its flying pretty locked in. It feels very neutral.

cmix 1 1.0 -0.81 1 -1
cmix 2 1.0 -1.0 -1 1
cmix 3 1.0 0.81 1 1
cmix 4 1.0 1.0 -1 -1

Reply
Clifton 18th November 2015 - 9:04 pm

Are you still using these settings? I have a Spedix S250 Agility and this would save me lots of time!

Reply
Sven 14th May 2015 - 8:52 pm

Maybe it’s a bit fussy but I was wondering if you should take the center of the FC for roll/pitch axis or better the center of the IMU?

Reply
Oscar 18th May 2015 - 2:56 pm

very good point, i think it should really be the center of the sensor… But the difference is only a 1 or 2 cm anyway i doubt it’s going to make a huge difference.

Reply
Luke 12th June 2015 - 11:56 am

I’m not so sure this is the case. The attitude and rate of change of attitude of a surface is equal at all points on that surface. I might be mistaken, but it shouldn’t matter where the imu is.

Reply
Michel 9th May 2015 - 10:41 am

Oscar,

hopefully you can help,

I am inputting my setting for an SK450 dead cat and am running into an issue with the custom mix.
Custom mixer:
Motor Thr Roll Pitch Yaw
#1: 1.000 -0.769 1.000 -0.800
#2: 1.000 -1.000 -0.800 0.769
#3: 1.000 0.769 1.000 0.800
#4: 1.000 1.000 -0.800 -0.769
Sanity check: OK NG OK

the pitch will not become OK, it will only be okee when they are all equal. either all 1 or all 0.8.
Custom mixer:
Motor Thr Roll Pitch Yaw
#1: 1.000 -0.769 0.800 -0.800
#2: 1.000 -1.000 -0.800 0.769
#3: 1.000 0.769 0.800 0.800
#4: 1.000 1.000 -0.800 -0.769
Sanity check: OK OK OK

do you have any idea why this is happening?

kind regards Michel

Reply
michel 9th May 2015 - 3:07 pm

Okee,

after going through the source code of cleanflight I think I found why it is not validating. the sanity check wants the sum of the values to be 0, however for pitch this does not need to be true. with an asymmetrical frame this is actually never true. I think this is a bug in cleanflight as the sum of the pitch is validated the same as for roll and yaw where the opposing engine will be negative and therefor the sum of these will amount to a 0. for Pitch there is no equal opposing engine as the rear engines will be both positive and the rear negative.

now for the important question, when the values are not validated will they stil work in the mixer? my deadcat was very uncontrollable with these setting.

gr

Reply
Chris Leech 10th May 2015 - 3:41 pm

You know that you can bring up this point at Cleanflight firmware for STM32F3 based FCBs, rcgroups.com/forums/showthread.php?t=2249574, But read some first, it might be covered.
The multiWii thread (Cleanflight aka Multiwii port to STM32 F10x and F30x) is not very active at all!!!
I am impressed that you have been able to make this dissertation through plying through the source code of Cleanflight.Recent releases are getting pretty darned big, in the area of 300k+ before compiling to hex. So kudos to you
But hey if you found the Clean-code :-) as it were on GitHub, then you would know that there is possibly a way of getting word back to the Dev’s there right?
I just used Oscars cmix for my ZMR and adjusted the throttles as well.
I found it a lot easier to write out the whole thing check syntax and then cut and paste.
I got the three Sanity Check Ok Ok Ok.
And I am about to go test it.
Whew. I still have so much to learn about the Cleanflight Configurator Port settings :-o

Reply
Chris Leech 8th May 2015 - 7:33 pm

Dear Oscar,
yes I agree with Charles, the motor position (description) per number is incorrect.
I am running a ZMR250 as well and would like to use the custom mix but once I try to proof the calculations I start seeing some small edits you might help us with.

Also, in the section with your calculations both Mot1 and Mot2 have negative pitch values, yet where you post next, the actual values that you have used for your custom mix Mot2 is a positive pitch value.
Do you see what I am getting at?
So it is very confusing for those that are trying to wrap their poor heads around custom CLI entries in Cleanflight :-). Could you please edit a bit to solve this Oscar thank you.
I will try your custom mix as it is and hope for the best.
Best Regards
Chris

Reply
Chris Leech 8th May 2015 - 7:58 pm

EDIT: sorry I mean’t: in your final cmix, Mot1 has a positive Pitch value, contradicting your calcs that show a neg value

Reply
Chris 6th May 2015 - 10:52 pm

I’ve somehow lost output on pin #4 and i am trying to run the #4 output on an x-quad on the #5 motor pin. i can’t get this to set in CLI…Can you pleaes illustrate how to do this? I ahve tried the following:

cmix 1 1.0, -1.0, 1.0, -1.0
cmix 2 1.0, -1.0, -1.0, 1.0
cmix 3 1.0, 1.0, 1.0, 1.0
cmix 5 1.0, 1.0, -1.0, -1.0

Then CF ignores the #5 motor and still only has a setting for 3 motors. Then i tried:
cmix 1 1.0, -1.0, 1.0, -1.0
cmix 2 1.0, -1.0, -1.0, 1.0
cmix 3 1.0, 1.0, 1.0, 1.0
cmix 4 1.0, 1.0, -1.0, -1.0
cmix 5 1.0, 1.0, -1.0, -1.0

This doesn’t ignore the #4 or #5 motor, but this still tell the flight controller that there are two motors at the exact same location, right? I’m reluctant to try this with props on, unless you think it will work.

I then tried:
cmix 1 1.0, -1.0, 1.0, -1.0
cmix 2 1.0, -1.0, -1.0, 1.0
cmix 3 1.0, 1.0, 1.0, 1.0
cmix 4 0, 1.0, -1.0, -1.0
cmix 5 1.0, 1.0, -1.0, -1.0

But it again ignored the #4 and #5 motor mixes and output the following:

cmix 1 1.0, -1.0, 1.0, -1.0
Custom mixer:
Motor Thr Roll Pitch Yaw
#1: 1.000 -1.000 1.000 -1.000
Sanity check: NG NG NG

# cmix 2 1.0, -1.0, -1.0, 1.0
Custom mixer:
Motor Thr Roll Pitch Yaw
#1: 1.000 -1.000 1.000 -1.000
#2: 1.000 -1.000 -1.000 1.000
Sanity check: NG OK OK

# cmix 3 1.0, 1.0, 1.0, 1.0
Custom mixer:
Motor Thr Roll Pitch Yaw
#1: 1.000 -1.000 1.000 -1.000
#2: 1.000 -1.000 -1.000 1.000
#3: 1.000 1.000 1.000 1.000
Sanity check: NG NG NG

# cmix 4 0, 1.0, -1.0, -1.0
Custom mixer:
Motor Thr Roll Pitch Yaw
#1: 1.000 -1.000 1.000 -1.000
#2: 1.000 -1.000 -1.000 1.000
#3: 1.000 1.000 1.000 1.000
Sanity check: NG NG NG

# cmix 5 1.0, 1.0, -1.0, -1.0
Custom mixer:
Motor Thr Roll Pitch Yaw
#1: 1.000 -1.000 1.000 -1.000
#2: 1.000 -1.000 -1.000 1.000
#3: 1.000 1.000 1.000 1.000
Sanity check: NG NG NG

What would to get x-quad configuration like i had before, just with #4 motor output coming out of the #5 pin?

Reply
ali 19th June 2015 - 4:56 pm

make sure you change your quad configuration to custom instead of quad x in the first page. Didn’t work for me until i did that. I have now got motor 4 coming out of motor 5 output

Reply
lorenz 23rd October 2015 - 9:25 am

did you manage to get it to work ?
I have nearly the same problem, my motor out 1 is broken so i wanted to switch it to 5.

what i tried was this:

cmix 1 0, 0, 0, 0
cmix 2 1.0, -1.0, -1.0, 1.0
cmix 3 1.0, 1.0, 1.0, 1.0
cmix 4 1.0, 1.0, -1.0, -1.0
cmix 5 1.0, -1.0, 1.0, -1.0

so i used the values from motor 1 and applied them to 5 which should tell port 5 to do the same as 1 did before and shut down motor 1 right ?

but for some reason it diddnt work.

would be great if somebody could help me out :)

Reply
Tedenz 14th November 2015 - 5:52 pm

My motor 4 had no power so this is my mix to shift motor 4 to motor 5 layout

mixer custom
mmix reset
mmix 0 1 -1 1 -1
mmix 1 1 -1 -1 1
mmix 2 1 1 1 1
mmix 3 1 1 -1 -1
mmix 4 1 1 -1 -1

save

Works great

Reply
Certacito 18th May 2017 - 10:46 pm

The throttle setting on motor 1 that you want to change out, needs to be 1 instead of 0 I think.

Reply
Nicolas 2nd May 2015 - 11:03 pm

Hey Oscar

I tried this today and it works wonders on my spider/deatcat quad. Had all sorts of issues before, most of which vanished with the correct cmix. Great stuff!

Reply
Oscar 6th May 2015 - 11:56 am

that’s great to hear :)
thanks for reporting back Nicolas!

Reply
michel 9th May 2015 - 11:59 am

Could you post your mix settings? I am running into issues with my mix settings as they will not pass the sanity check

my settings for my sk450 deadcat are

Custom mixer:
Motor Thr Roll Pitch Yaw
#1: 1.000 -0.767 0.837 -0.800
#2: 1.000 -1.000 -0.428 0.769
#3: 1.000 0.767 0.837 0.800
#4: 1.000 1.000 -0.428 -0.769
Sanity check: OK NG OK

Reply
Turbini 28th April 2015 - 9:26 am

I don’t get it. If the third value is pitch and pitch has less momentum due to less distance from motor to motor, why should its force be reduced to 0.765? Shouldn’t be greater than roll? I tried both combinations and my pitch/roll P are closer when using more force for pitch, which makes sense to me but I’m just confused about this. Did you try it on pid controller 0?

thanks!

Reply
Chief 7th April 2015 - 9:14 pm

Am I missing something here?? 10.125mm is tiny when talking about a ZMR

Reply
Oscar 8th April 2015 - 12:39 am

good spotted, i meant cm not mm

Reply
Chief 8th April 2015 - 2:15 pm

Ok, I figure as much but wanted to make sure I wasn’t losing it :)

Reply
smitty 7th April 2015 - 4:32 pm

Correct me if I’m wrong, but I would think the longer axis arm should get the reduced value for force required. The shortest axis arm would be defined as 1.0. Imagine a very wide H quad. Torque = force x distance so it’s much easier for the motor to roll the craft than it is to pitch it. To end up with the same torque on each axis, the roll should be the factor that’s reduced.

Also, if you can determine where your cg is, like if you have a big fat 2200mah on the back, you can calculate from that axis as well. In your case, if the cg was offset 1cm backward, the pitch axes are 6.75 from the back and 8.75 to the front. The pitch factor for motors 1 and 3 would be +/-1.0 since they are the closest to any axis and will work the hardest. Pitch on 2 and 4 would be +/-0.771 and roll for all motors would be +/- 0.667

Reply
DeeHawk 9th April 2015 - 9:55 am

I don’t think the force has much to do with it, since it doesn’t take any to tilt it. It’s about speed and the circle traveled by the motor in a full roll/flip. Shorter circumference, shorter travel time for the given motor speed and pitch of your props.

Reply
Rob2160 4th August 2015 - 7:39 am

Hi Oscar & Smitty.

The custom mix tells the FC how much authority each motor has. That is why the longest arms have 1.0 and shorter arms have a lower value. A lower value means the motor has less authority in this axis.

e.g. 0.5 roll means that motor has 50% roll authority compared to a motor with a value of 1.0

github.com/cleanflight/cleanflight/blob/master/docs/Mixer.md

Quoting from above..

Roll – indicates how much roll authority this motor imparts to the roll of the flight controller. Accepts values nominally from 1.0 to -1.0.

Pitch – indicates the pitch authority this motor has over the flight controller. Also accepts values nominally from 1.0 to -1.0.

Reply
Jon 6th April 2015 - 5:29 am

Thanks for the informative post! I have a problem where only 2 of my motors are not spinning the correct direction. Motor 1 CCW (rear right), Motor 2 CW (front right) which is incorrect for the default quadx configuration.

I had a couple of questions:

I run the following:

mixer custom
cmix reset
cmix load quadx
cmix

This dumps out the quadx default mixer values, so in this case I need to change 1 & 2

#1: 1.000 -1.000 1.000 -1.000
#2: 1.000 -1.000 -1.000 1.000

Which values should I be switching to reverse the motor direction? I have tried all combinations and the motor still spins the incorrect direction.

I even:

save
Click Motors tab, test, no success
Click CLI tab
cmix

displays my changed values
save
disconnect comm
reconnect

values still show updated to my new values, but the motor did not change direction.

Which values should I be changing to reverse the motor? Any reason this is not updating?

Reply
Harris 1st April 2015 - 11:22 pm

I’m glad to see this implemented in cleanflight, but I’m not a big math person. I’m running a tricopter that – although the motor locations sit in a perfect triangle at 200mm in any direction – the FC and CG sits forward of the centerline from front to back. how would I come up with the differential between the 2 front motors and the rear with the CG moved up from center?

Reply
Marek 31st March 2015 - 1:39 am

Hey Oscar,
Great blog. Very helpful on many topics getting into the hobby. Do you think it would be possible to create an excel spreadsheet that would calculate the CMIX parameters by inputting the frame dimensions? I want to play around an build a frame of my own with different sized arms but I am afraid that without a proper CMIX it will not fly well. Thanks in advance

Reply
Oscar 1st April 2015 - 2:56 pm

Hi Marek
yes, someone in our FB group has created a Excel sparesheet for this. Join the group and you can find it in the file tab.
thanks
Oscar

Reply
Prebster 29th June 2015 - 8:34 am

Hey!
I love your posts, and I’ve “liked” your facebook site, but I don’t see a “files tab”… What is the “group” called that I need to join to find this Excel-sheet?

I’m flying a Warthox Fquad from Flyduino, and it’s everything but symmetrical. Flew OK with KK2.1, upgraded to NAZE32, but never got it to fly well with this yet. Hope that editing the motor-mixing will fix it, and want to have that settled before I start spending lots of time with PID-tuning…

Here’s a pic of my bird: drive.google.com/open?id=0B0uGESM4uEIdSkFseTJtdWpqMVk&authuser=0

Thanx a lot again!

Reply
Oscar 1st July 2015 - 1:37 am Reply
Hammerhead 28th March 2015 - 10:39 pm

Hi i am little bit confuse, because you motor layout and Cmix layout not are the same.
so is this right:
Cmix1 = Motor 4 CW
Cmix2 = Motor 2 CCW
Cmix3 = Motor 1 CW
Cmix4 = Motor 3 CCW

And how i know which are negative and positive values?
Here you example pitch/roll/yaw:

Pitch – – Roll + – Yaw – +
+ + – + – +

This not look right for me? what i don´t understand right…

I think they they should have something like this????
Pitch – – Roll + – Yaw – +
+ + + – + –

Btw thank you very much for the excellent blog. it´s really good and helpful for quad copter beginner like me :)

Reply
Hammerhead 28th March 2015 - 11:37 pm

Also you have there 2 different cmix formula..
cmix [motor number] [throttle] [pitch] [roll] [yaw]
and
cmix NUMBER THROTTLE ROLL PITCH YAW
I think last one is right?

Reply
Oscar 29th March 2015 - 12:26 pm

Hi, no the numbering should follow the motor order e.g.
cmix1 = motor 1
cmix2 = motor 2
..
..
you find the positive/negative from the default quadcopter cmix table (the one with all one’s the beginning of the post)
And yes, I mistakenly written roll/pitch in the wrong order, i have corrected it now, thanks for pointing out! I have corrected it now.

Reply
Charles 7th May 2015 - 11:34 pm

you also have the motor description wrong, should it not say…
cmix 1 1.0, -1.0, 1.0, -1.0 (Rear right motor)
cmix 2 1.0, -1.0, -1.0, 1.0 (Front Right motor)
cmix 3 1.0, 1.0, 1.0, 1.0 (Rear left motor)
cmix 4 1.0, 1.0, -1.0, -1.0 (front Left motor)

Reply
Jason 19th March 2015 - 8:01 am

Should we be worried about these values not passing the sanity checks? I get OK NG NG

Reply
Oscar 20th March 2015 - 4:01 pm

it’s fine, you can always dump the cli values and check.
make sure there is only 1 space between values as well…

Reply