Archive for the ‘Featured’ Category

How much power is needed to hover ?

by Sergiu Baluta, Starlino Electronics, revised 10/30/2015

This article is a theoretical venture that aims to answer a series of practical questions, such as:

– given a certain electrical setup that can generate a certain power, what is the maximum thrust that we can achieve ?

– can a human-powered aircraft be built ?

– can I tell the expected thrust generated by a copter simply by knowing the power it consumes and vice-versa ?

– are larger propellers really more “efficient” ?

– which multicopter configuration is more efficient:  tricopter ,  quadcopter ,  hexacopter or octacopter  ?

– I heard that for every gram of mass I add to my multicopter, the flight time will decrease by 1 second, can you put any sense in this ?

– and many more…

When selecting motors for an RC model you will often come across the thrust tables that tell you how much thrust (or “pull”) a specific motor can generate. This usually depends on few factors: the propeller used and the voltage applied. Next to these two parameters you will usually see the current and power consumed and the resulting thrust generated, usually expressed in grams. If you want your model to hover, you must ensure that your motors can generate a thrust equal to or greater than the mass of the model.

The power that your motor consumes is calculated based on the simple formula:

P = V * I , where V  is the voltage and I is the current.

Power represents the amount of energy we’re consuming per second, which is expressed as follows:

P = E / t, where E is the energy.

The efficiency of a specific setup consisting of a propeller and a motor is often calculated as:

Eff = Thr / P , where Thr is the thrust force generated expressed in grams and P is the power consumed expressed in Watts.

However this efficiency is not expressed in percentage as you would usually expect so it does not tell us if our motor-propeller setup is consuming  energy exclusively to generate lift or wasting it somewhere else. To compute an efficiency value in percentage we would need to know the minimum or “ideal” power necessary to generate a specific thrust given our setup and environment.

We have to mention from the start that such an “ideal” model, taking into account all the possible factors would probably be too complex to use for practical purposes. So instead our goal is to first deduct and then define a “theoretical” or “reference” power formula. Finally this formula will be applied to a series of practical experiments and the resulting “theoretical” power will be compared to the real-world observed power. To avoid confusion with the other efficiency let’s call this ratio “Theoretical Thrust Ratio” or TTR:

TTR =  P(real) / P(theoretical)

So let’s  dive into our calculations. But before we do that, for the impatient reader,  here are the formulas that we’ll be deducting and using for computing our “theoretical” power (or thrust – if we flip the formula around):

clip_image002[55]            (Formula 1.1)


clip_image002[57]            (Formula 1.2)


clip_image002[59]      (Formula 1.3)



Here P is the power expressed in Watts., F is the thrust expressed in Newtons,  r is the radius of the propeller expressed in meters and  K is a air density dependent coefficient, with a nominal value of 0.3636 assuming air pressure of 1atm and air temperature of 20C.

The formulas above are expressed in international physical units, however for those doing RC I am also providing the following convenient formula for computing thrust in grams Tgram, based on a propeller diameter expressed in inches Dinch:

clip_image002[61]              (Formula 2.1)


clip_image002[67]      (Formula 2.2)

clip_image002[65]          (Formula 2.3)

Here C is an air density dependent coefficient with a nominal value of 0.0278 assuming air pressure of 1atm and air temperature of 20C.

Below is a lookup table for K and C coefficients at various temperatures and air pressure of 1atm.

(degrees C)
Air Density (kg/m^3) @ 1atm K C
35 1.1455 0.372745594 0.02850295
30 1.1644 0.369708101 0.02827068
25 1.1839 0.366650731 0.028036891
20 1.2041 0.363562254 0.027800722
15 1.225 0.360447503 0.027562545
10 1.2466 0.357311097 0.027322712
5 1.269 0.354143483 0.027080492
0 1.2922 0.35094996 0.026836291
−5 1.3163 0.347722365 0.026589484
−10 1.3413 0.344466588 0.026340523
−15 1.3673 0.341175753 0.026088881
−20 1.3943 0.337856246 0.025835046
−25 1.4224 0.334502366 0.025578583


The Deduction

Let’s get back to the main question of this article – “how much power is needed to hover an object ?” , or in other words how much energy we need to consume per second to maintain this object “in the air”. Well, as it turns out “it all depends…”. For example we do not need to consume any energy to keep a book on a shelf or a tire suspended on a rope. Clearly we did not formulated our question correctly! So let’s try again and this time be more specific. “How much power  does a craft powered by a spinning propeller needs in order to hover in the air ?” Here you go – much better ! Let’s see if we can answer this question.

You might recall from school physics a rule called “preservation of energy”, it simply states that the energy does not like to go away or disappear, all it does – it transforms from one form to another. We certainly know that our craft consumes energy in the form of electricity or burned fuel, but where does it go ? Didn’t we say that we don’t need energy to hover an object such as a book on a shelf or a tire hanging on a rope ? The reality is that not every object is as lucky as a book on a shelf or a tire suspended on a rope. In both these cases – the book and the tire have the benefit of a “reaction force” of the shelf and rope respectively. The book pushes on the shelf with its weight and the shelf will always push back with an equal force in the opposite direction. If you’re confused it’s probably because of a common misconception that an existence of a “force” implies that energy is consumed. The later is not true – a  “force” can exist simply because of the setup of the nature, for example the gravitational force, the magnetic force and the reactive force they all simply exists without consuming energy. It’s  their action that might or might not lead to the transfer of energy.

Back to our model of a propeller-powered craft, since our craft is suspended in the air, there must clearly exist an opposing force F that is directed in a opposite direction:

F = m * g , where m is the mass of our craft and g is the acceleration of gravity ( approximately 9.8 m / s^2 ).

In fact this force is not much different from the “reaction force” that a shelf exerts on the book, except our medium “the air” is less dense than the shelf and as a result of this force,  as we push “against” it with the propeller, the air starts moving. Here you go! We found were our energy goes. The electrical or fuel energy consumed by an aircraft is transferred to the kinetic energy of the moving air.

Let’s imagine a spinning rotor that generates a thrust F (in case of hover it is equal to mg) and a cylinder of air of infinite height with the rotor placed in the middle. The rotor is sucking air from the top and then pushing it down from the bottom. The rotor will have very little influence on the air on the top (since it’s very-very far away) so we can assume the speed of the air starts at 0, then slowly increases as it passes the rotor to w/2 (due to symmetry of our model from top and bottom) and finally as it reaches the bottom of the cylinder it stabilizes at a speed w, again rotor has very small influence on the air from the bottom of cylinder since it’s far-far away.



Let’s examine our model for a period of time t that it takes for a particle of air to travel from the top to bottom of cylinder . Let’s note the area of the cross-section of our cylinder as A and since it’s defined by the radius of our rotor we have:


The volume of air Vol that passes through the rotor during the time t, can be calculated by monitoring how much “height” of air passes through the rotor at the speed v, h=v*t and multiplying by the cross section area A.


Given the air density Qair we can calculate the mass of air that passes through the rotor in the time period t:


Let’s note that since the air starts at zero speed so its starting momentum is zero, thus it’s momentum change will be equal to final momentum Mair * w, where w is the final speed. From momentum conservation theory we can recall that the force that we apply on a mass is equal to the rate of change of momentum:


Finally combining the last two formulas we get:


From here we can get the speed v at the rotor:


Next let’s note that the power is equal to the  rate at which work is done or in other words rate at which energy is consumed. Work is given by the formula W=F*d (where d is the distance), thus power is P  = W /t = F*d/t = F*v:




Note that we substituted the circle area A = PI*r^2 formula. Finally, by extracting some coefficients we get:



and the inverse formula for thrust is:


The formulas above work with international physics units, thrust F is measured in Newtons, and radius r is measured in meters. For practical purposes in RC we work with propeller diameter in inches and thrust is calculated in grams (which is equivalent to mass this thrust force can hover from  F = mg formula, where g is standard gravity ~ 9.8m/s^2). So let’s define another equivalent set of formulas:







and the inverse formula is





Experimental Results

To verify these theoretical results I conducted a series of thrust tests using different motors and propellers commonly used in RC. Also I verified thrust tables randomly found on the internet (forums or motor specs):

Motor: DYS 1306 3100KV BX    Source:

Prop Diam " Prop Ptich V A Thrust(g) W Eff (g/W) Theoretical Thrust (g) TTR=Thrust /Theoretical Thrust
5 3 7.4 1.4 70 10.36 6.8 151 46.2%
5 3 7.4 3.3 140 24.42 5.7 268 52.2%
5 3 7.4 5.7 220 42.18 5.2 386 57.0%
5 3 11.1 2.1 100 23.31 4.3 260 38.5%
5 3 11.1 5.5 210 61.05 3.4 494 42.5%
5 3 11.1 9.4 350 104.34 3.4 706 49.6%
6 2 7.4 1.3 70 9.62 7.3 163 43.0%
6 2 7.4 3.7 150 27.38 5.5 327 45.9%
6 2 7.4 7.9 230 58.46 3.9 542 42.4%

Motor: EMAX MT1804 2480KV Source:

Prop Diam " Prop Ptich V A Thrust(g) W Eff (g/W) Theoretical Thrust (g) TTR=Thrust /Theoretical Thrust
5 3 12.1 7.3 345 88.33 3.9 632 54.6%
5 3 12.2 6.2 330 75.64 4.4 570 57.9%
5 4 12.1 9 370 108.9 3.4 727 50.9%
6 3 12.2 8.6 410 104.92 3.9 800 51.2%

DYS BE1806 2300KV Source: 

Prop Diam " Prop Ptich V A Thrust(g) W Eff (g/W) Theoretical Thrust (g) TTR=Thrust /Theoretical Thrust
5 3 12 9 415 108 3.8 723 57.4%
5 3 12.2 3.6 230 43.92 5.2 397 58.0%
5 3 12.1 7.5 360 90.75 4.0 643 55.9%
5 3 12.2 3.3 205 40.26 5.1 374 54.8%
5 4 12 10.6 440 127.2 3.5 806 54.6%
5 4 12.1 4.2 225 50.82 4.4 437 51.5%
6 3 12 10.2 485 122.4 4.0 887 54.7%
6 3 12.1 4 240 48.4 5.0 478 50.2%
6 4.5 11.8 16.1 580 189.98 3.1 1189 48.8%
6 4.5 12 5.1 235 61.2 3.8 559 42.1%
5 3 16.3 11.5 570 187.45 3.0 1044 54.6%
5 3 16.4 5.1 280 83.64 3.3 609 45.9%


A more extensive list of test can be downloaded here, the Excel Spreadsheet contains a _TEMPLATE_ sheet that you can use to fill in and verify your own data:


Example Uses


Q: Can I build a human powered helicopter ?

A: A trained cyclist can generate 500W peak power (or even 1500W according to some reports), let’s a assume the cyclist weights 70Kg and the weight of the copter is 30Kg, thus the thrust needed for lift off is 100Kg. From this formula:


we can compute the radius of the propeller that this human-powered helicopter will need to have :

r = K * (mg) ^ (3/2) / P = 0.3636 * (100*9.8) ^ (3/2) / 500 = 22.3 (meters)

In fact human powered machines have been built. Let’s analyze for example the Gamera II built by University of Maryland:

Weight:  ~ 37kg + Pilot ~ 90kg
Rotors Radius:  ~ 7.2m  ( x 4)

Since this craft has 4 rotors , each rotor would need to produce at least 1/4 of the thrust or  90Kg / 4 = 22.5Kg . Using our formula we can calculate power needed for each rotor:


P =  K * (mg) ^ (3/2)  / r = 0.3636 * (22.5*9.8) ^ (3/2) / 7.2 = 165.35


Thus the total power required is estimated at 165.35W*4 = 661.4 W , which is quite manageable for a trained cyclist. In reality no motor is 100% efficient. Still,  an advantageous effect for take-off is the “ground effect”. As air is pushed into the ground its density increases, as a result our K coefficient will decrease, meaning there’s less power required to generate same thrust compared to less dense air.


Q: I am buying a motor that is rated at  200W, assuming I will use a battery  that has a voltage high enough to result in all 200W being drawn from the motor and  a 10” prop,  how much thrust can I expect from this motor and what will be  the gram/Watt efficiency ?

A:  Simply apply this formula to get the thrust in grams:



Tgrams =  ( P * Dinch / C) ^ (2/3) = ( 200 * 10 / 0.0278) ^ (2/3) =~ 1730 gram,  gram/Watt efficiency immediately follows: Eff = 1730 / 200 = 8.65. From practice, knowing that most brushless motors setup used in RC will deliver  50-60% of theoretical thrust and efficiency you can divide the above theoretical values by 2 to get a real-life estimate , so  P ~ 865g,  Eff ~ 4.3 g/ W.



revised 10/30/2015

by Sergiu Baluta,  Starlino Electronics

Build a really fast pulse generator (50ps rise time) using an ultra fast SiGe comparator.


If you purchase a new or used scope you will probably need a way to test its advertised bandwidth. One way to test the bandwidth of the scope is to feed a really fast pulse into the oscilloscope and measure its rise time.  The reason why this makes sense is because a square wave contains many higher frequency harmonics. The frequency of its highest harmonic will determine the steepness of its falling or rising edge. If you look at a sinusoid wave of 1Ghz and one of 1Khz – the 1Ghz wave will have a steeper slope than the 1Khz sinusoid. A square wave or a pulse consists of the sum of many sinusoids, your scope bandwidth limitation will discard or attenuate the higher frequencies components and thus will alter the steepness of the wave that you see on your screen.

The bandwidth of the scope will be then given by the formula:

Bw = 0.35 / Tr      (Note: 0.4 / Tr  is sometimes used for modern digital scopes)

where Tr is the measured rise time of the pulse on the oscilloscope. This formula only stands when Tr >> Tra (Tr is much larger, usually at least 10 times than Tra)  , where Tra is the actual rise time of the pulse. I will describe a quick circuit for building a fast pulse generator with a Tra of 50ps. 50ps corresponds to a  bandwidth of  0.35/50ps  = 7Ghz, so you should be safe to evaluate bandwidth of scopes up to 700Mhz. For scopes with larger bandwidths you can still use same method but you need to take into account Tra, the formula becomes then:

Bw = 0.35/SQRT(Tr^2 – Tra^2)


The Circuit

The circuit uses a single chip, ultra fast comparator ADCMP580 available from Analog Devices.




For this circuit you will need a dual rail power supply (+5/-5V) , if you don’t have one you can use an ATX power supply from a computer case – it has both +5V and –5V rails. You will also need a way to generate a (slow rising) input pulse that the circuit above will convert to a fast rising (50ps) pulse.

The input pulse must not exceed +3V/-2V according to ADCMP580 datasheet. Keep this in mind If you’re using your Arduino  or a 555 timer circuit to feed in the input pulse , you will probably want to feed the pulse through a voltage divider if it exceeds these levels. Take into consideration that the ADCMP580 already has an internal 50Ohm resistor that you might use for your voltage divider.  Also please note that if you signal goes only from 0V to 5V , Vn will need to be somewhere in-between, again you can form a voltage divider to set it at about 2.5V. The outputs Q/Qb will toggle when your signal crosses the threshold set by Vn. In my case since I have a pulse generator that feeds a pulse from –1.25V to 1.25V (2.5Vpp) I am setting my Vn  threshold to ground. I am also using the internal 50Ohm termination just to place some “weight” on the circuit and filter out any noise pickup.

Rh is the hysteresis resistors this can be  anywhere between 0 to 10Kohm. I found that a value of 100Ohm worked great for me . Let’s say your signal is going up but then because of the noise it decides to go a little down, hysteresis feature of ADCMP580 protects against the output reacting to that noise, the output signal will only go back down when the voltage will fall Vhys below the point that made it go up. Below is a chart that describes the relationship between Vhys and Rh. You can see that in my case since I am using a 100Ohm resistor I have about 55mV of a buffer zone, so my output will not fluctuate if the noise level is less than roughly 55mV, in other words it will always take more than 55mV change in signal to toggle the comparator back in opposite state.



The Build and Results

Luckily Analog Devices offers an inexpensive ADCMP580 demo board, I picked mine from Mouser for around 50 dollars. The board is basically a breakout of the ADCMP580 chip with some decoupling capacitors and 2.9mm connectors for signals and standard 4mm banana sockets for the power supplies. Fear not the 2.9mm connectors , they are generally compatible with SMA connectors so I used some SMA-M to BNC-M cables to connect the signals to my scope and signal generator. (Some people will warn you that if you have some very expensive equipment do not use SMA connectors with 2.9mm connectors – the tolerances might be different and you might break the connectors on your expensive equipment). I also used some 50Ohm SMA terminators, on the QB, LE and VN connectors. The schematic above calls for LE and VN to be connected to ground via wire, however I found that a 50Ohm cap did the job. In case of QB connector it must be terminated with 50Ohm to ground, even if you’re not using its output so the 50Ohm terminator is required. LEB is connected to VEE (-5V) via a 1Kohm resistor and you might notice in the picture I have a 100 ohm resistor in the HYS slot (see between the black Q and red VEE cable).  You can see that the VTF_F, VTP_F, VTT, VCC0, CGND are left unconnected (the necessary connections are made by the blue jumpers on the board). Please note that although VCC1 may appear unconnected on the picture there’s an alligator clip under the board that connects it to the +5V rail of the power supply.




Once I completed the setup above I fed in a 2.5Vpp(@50Ohm load)  1Khz square wave into  VP,  my Q output was connected to my 500Mhz bandwidth oscilloscope, below is the result of this experiment:




The rise time of my input signal (Ch4) is 16.57ns while the rise time of the output (Ch1)  is 536ps (average) with a dispersion of 36ps, the momentary reading when the screenshot was taken was 590ps. So let’s calculate the bandwidth of the scope, I am taking a conservative approach using the worst number of 590ps:

Bw = 0.35 / 590ps =  0.35 / (590* 10^-12) = 0.000593 * 10^12 Hz = 593 * 10^6 Hz = 593 Mhz

So my scope has a bandwidth of no less than 593Mhz on Channel 1.  This is above it’s rated bandwidth of 500Mhz.


Conclusion and some notes

For around $50 I created a very fast pulse generator setup that allowed me to evaluate the bandwidth of my scope. 

Please note that if you read the ADCMP580 datasheet you will find a Rise/Fall Time of 37ps, however this is the rise time from 20% to 80%, the scope measures the rise time from 10% to 90%. I simply prorated this number  37ps * (90-10) / (80-20)  = 49.3ps ~ 50ps to get the rise time from 10% to 90%.

You will also see in datasheet the advertised equivalent rise time bandwidth of 8Ghz , I believe this comes from the formula 0.4/50ps = 8Ghz that applies to many modern digital scope. In my calculations I used the “old” conservative formula of  0.35/Tr instead of 0.4/Tr.

Finally please note that the output of ADCMP580 uses CML levels of  0V(High) and –0.4V(Low) according to datasheet. I found these levels to be actually lower in my setup (-0.472V High and -0.868V low), but with same difference of about 400mV as you can see in the scope screenshot below. If you have an explanation for this please leave a note in the comments section.





ADCMP580/ADCMP581/ADCMP582 Datasheet:

EVAL-ADCMP580BCPZ Evaluation Board

Evaluating Oscilloscope Bandwidths for Your Application

Digital Oscilloscope Bandwidth Measurement – direct and using risetime

Basics of Analog Oscilloscope Bandwidth

Analog Oscilloscope bandwidth considerations

EEVblog #306 – Jim Williams Pulse Generator

EEVblog #311 – Jim Williams Pulser Followup

EEVblog #316 – More PFANG, More 13GHz Scope, & More Pulser


Parts List


SMA-M Bnc Cable

SMA Terminator 50Ohm

Triple Power Supply

Function Generator




Introducing the QuadHybrid – a stable, maneuverable and cheap flying robotic platform

Introduction & Demo of the QuadHybrid Design

I’ve been experimenting for quite a while with different configurations of Multi-Copters and RC Helicopters, basically looking for a stable robotic platform that can be used for my machine vision or other sensor-enabled flying robotic projects. RC helicopters have been around for quite a while, however (with the exception of some 3-Channel helicopters) they are not easy to fly, not very stable and not too precise in maneuverability – in other words not exactly good match for a flying robot. Then came the quadcopters and everyone loved them, talked about them , and eventually wanted to or actually built one.  I built a few – and what I learned is that  they have a great lifting power, great maneuverability (basically equivalent to a 4ch or 6ch heli), however   they rely entirely and heavily on relatively expensive IMU sensors  to achieve this stability.  I a QuadCopter you basically have four “monster” motors on each beam than must be synchronized precisely. Because you’re controlling so much power with your IMU sensors – any small deviation or lack of callibration and your platform is no longer stable. That’s why the sensors are crucial in a quadcopter  – without them the quadcopter will not fly at all ! 

After many trial designs – my conclusion was that a suitable flying robotic platform must not rely too much (or at all) on its sensors to be stable while hovering. It must be mechanically symmetric, preferably with it’s center of mass in the center.  At the same time it must have the maneuverability  capabilities of a quadcopter –  and namely I wanted it to fly sideways, forward & back  and rotate around its axis. Although the solution I came up with might seem to some (including myself) a little strange  and out of the ordinary –  as turned out it flew surprisingly well , was very stable and maneuverable, and best of all – had a very low price tag due to the fact that it was easy to built from the off-the-shelf toy helicopter replacement parts.

Without further adieu – below is the picture of the machine that I called “QuadHybrid”:


My very first QuadHybrid prototype.

Below you can see some flying test video:


So What Exactly is a QuadHybrid ?

Let’s have a closer look at QuadHybrid’s pictures. A simple way to look at it is:  a co-axial helicopter on top of a quadcopter – it’s actually as simple as that.

In total QuadHybrid has 6 motors and 6 propellers (2 large one center from the helicopter + 4 small on each arm from the quadcopter).

The two large center propellers in the center consist of 2 heli-type blades – they provide all the lifting power needed. They spin in opposite directions to compensate for the yaw rotation introduced by any rotating propeller and are stabilized by an optional vertically mounted MEMS gyroscope  (the only sensor used in this design). The slight difference in speed of the top and bottom blades is used to control the desired yaw rotation.  Thus the center motors provide the throttle and yaw control of the QuadHybrid – in other words ability to fly up/down or rotate about its center vertical axis.

The four small rotors on the four arms are actually small tail motors from a 3ch helicopter, they provide the remaining maneuverability  functions – pitch/roll or – or in other words the ability to fly  forward & backwards or shift sideways  (right / left) . 

The resemblance to a quadcopter and a helicopter can be seen in the picture below where they are put side by side.



How Does a QuadHybrid Work and How to Build One

QuadHybrid has all the maneuverability of a 4 channel helicopter or a quadcopter (throttle, yaw, pitch and roll). A 3 channel helicopter as we know it – only has 3 controls (throttle, yaw and pitch). The problem with a co-axial 4CH helicopter for instance is that it relies on a swash plate and servos to achieve the pitch/roll control. Basically it is a servo mechanism for tilting the axis of rotation of the bottom rotor – it is not easy to fine tune and it needs frequent maintenance. A 3CH toy helicopters on the other hand relies on a tail rotor to achieve the pitch control – and this is one of the ideas I used for QuadHybrid – basically I multiplied the tail boom and rotor on a 3CH helicopter by four.


This is how a typical 4CH helicopter is build. Please note that the bottom blade can be tilted by using 2 servos that tilt the swashplate. In the QuadHybrid design we are going to eliminate the servos and the swashplate and replace them with 4 small motors mounted on 4 arms (beams), just like on a quadcopter.

I built my QuadHybrid, from spare RC or “toy” heli  parts. They are widely available and thanks to the fact that manufactures copy each other in some cases bluntly, these parts are compatible in many cases  so I was able to mix-and-match. I took the electronics from a E-Sky Lama V3 helicopter  – that is a 4 channel heli so it has a swashplate and 2 servos to control the pitch and roll. Because I didn’t wanted the swashplate (the roll/pitch on QuadHybrid is controlled by the 4 small quadcopter style rotors), I used the frame and blades from another toy helicompter  – Syma S001 and I was able to fit the Esky motors into that frame which are bigger and more powerful than the S001 stock motors. 

To clarify the design let’s look at the guts of the E-Sky Lama V3 helicopter . I actually used all electronics in this 4CH helicopter, except the servos (as will become clearer in the next diagram):



The main idea of the QuadHybrid design is: to achieve a better Pitch/Roll  control I replaced the servos with a custom control board called “QuadHybrid Controller V1”. This board basically takes the servo RC signals (Pitch and Yaw) as inputs and controls the 4 arm motors using a set of 4 transistors. This allows QuadHybrid to fly just like a quadcopter in “+”  or “X”  configurations (for explanation of “+” or “X”  flying configurations  see for example




On the mechanical part – the swashplate on the bottom blade was replaced with a fixed blade mount from a 3CH helicopter. This made the bottom blade of the 4CH fixed. Normally on a 4CH heli it is being tilted by servos that are connected to the swashplate using 2 links.

Main Rotor Head

This is a swashplate assembly on a 4Ch helicopter it is the black disk under the blades mount. It is connected to the blade mount with two links. Two servos that are controlled by the RC receiver are able to tilt the swashplate and thus alter the axis of rotation of the bottom blade. This is how the roll and pitch is controlled in a 4 channel helicopter. It is far from perfect and requires frequent tune-ups.


A gyro-stabilized co-axial 3 channel toy helicopter is fairly stable, as opposed to a 4CH helicopter- it uses the tail rotor to control the pitch (flying forward or backward). Note the bottom blade is fixed , just like on the QuadHybrid.

QuadHybrid Controller Board and Software

Below is the schematic of the QuadHybrid V1 controller (the blue board on the diagram above that controls the 4 motors). This is the only custom component that is not available from RC toys parts.


At the heart of the QuadHybrid V1 controller board is a PIC16F1825 microcontroller – it’s main task is to capture the servo signals received on ports RA5(ROLL) and RA4(PITCH) and convert them  to 4 PWM signals that control the 4 rotors mounted on arms. The motors are driven using 4 NPN transistors – these can be any NPN transistors as long as they have a current rating of at least 1A (or the maximum current of your arm-mounted motors) and a low Collector-Emitter resistance (< 0.3Ohm or so).  MOSFET could be used instead of NPN transistors, with slight schematic change – however I found hard to source them in an easy to solder and light-weight TO-92 package so I used NPNs instead.

QuadHybrid V1 controller board operates by default in “+” configuration. If you want to operate it in “X” configuration then connect the X_CONF jumper – this will give you better control with smaller motors , since for example flying forward will activate two motors at once (3 & 2). The only thing to keep in mind when flying in “X” configuration is that the “Front” is a imaginary line between arm #0 and #1 .

QuadHybrid V1 PCB was created as a all through-hole design so that anyone can assemble it and covert a toy RC helicopter into a QuadHybrid:

For anyone wishing to spend time on creating their own QuadHybrid V1 controller board – source code and Eagle files are available on the SVN repository, otherwise easy to solder kits will be available in my Store.

If you would like just to peak over the source code here is a direct link:

As you can see it is a fairly simple project a(for anyone familiar with C  and microcontrollers) and a good placeholder for further improvements and add-ons.


Mechanical Construction

On top of QuadHybrid prototype is basically a stripped down frame of a 3ch helicopter and namely it comes from Syma S001:



Under the frame are 2 aluminum tubing pieces that form the 4 arms. At the end of each arm I attached a tail rotor from the same Syma S001 helicopter model:



Then, to house all the electronics and battery I just sandwiched two perforated  boards with nylon spacers (Tip: most bolts,nuts and spacers used in this design are nylon-made to lower the weight) :


For landing gear I just used a RC helicopter training kit that consist of a round bracket attached to the bottom deck, four carbon fiber rods and four (orange) ping-pong balls:


Please note that: although all the mechanical parts are from a 3Channel helicopter (Syma S001), you will need electronics from a 4Ch helicopter! The main reason for using a 3CH helicopter for mechanical part is because the bottom blade bracket was already fixed (3Ch helicopters have no swashplate):



It might be more economical to get a 4Ch helicopter (mainly for its electronics that support pitch & roll not just pitch as a 3Ch helicopter) and then just remove the servos and the swashplate and then fix the bottom blade bracket using screws and/or glue.  As I did in the photo below (E-Sky Big Lama parts shown):



As an alternative to fixing the bottom blade bracket, you can also get a fixed blade bracket from a 3CH helicopter – it must be same inner diameter as the one from your 4CH helicopter. The diameter of the outer drive shafts are typically 4mm ( and 5mm , 6mm and even 8mm for larger helicopters).

Esky helicopters are best to use in terms of electronics because they have standard signal RC protocols in their transmitter / receiver boards that you can tap-into to get the Pitch/Roll signals needed for the QuadHybrid controller board. Syma helicopters integrated boards are harder to hack into – however some people have managed to hack into them and reverse engineer the signals.


Conclusion: What are The Advantages and Disadvantages of the QuadHybrid Design over a traditional QuadCopter or a RC Helicopter

While building the QuadHybrid  I selected the best features of a quadcopter and a helicopter and put them together, this resulted in a machine that took the best of the two worlds:

– QuadHybrid is mechanically symmetrical and stable. As opposed to a QuadCopter it does not rely on sensor to achieve this, the main hovering stability comes from the co-axial design and the centrifugal momentum of the fly-bar (the black bar on top of the blades with two weights on each side) – this is basically the same principle at work as in a mechanical gyroscope.

– QuadHybrid only requires two lifting “powerful” motors, the other 4 small motors are used for steering and are not crucial for device stability. There’s no need for motors to be brushless, and no need for brushless ESC controllers, they can be cheap RC-type brushed motors that can be driven by MOSFETs or transistors, there’s no need to reverse rotation of any motors, however it will be a feature in V2 of the controller board. Also there’s no need for CW and CCW propellers for the motors mounted on arms. All this vastly reduces the complexity and cost of the design.

– Partial or complete failure of any motor will still keep device in the air and give the operator/program a good chance to land it safely. In the worst case scenario – if a driving motor fails , the device will loose lifting power and will spin in the air, but will still at least stay on it’s vertical axis. In case of a quadcopter – failure of any motor is fatal – it will basically flip the quadcopter, or make it fly sideways with great chance to hit something. This is of course debatable, but in any case statistics tells us that the probability of one of the 4 motors to fail is twice of that of one of the two motors to fail (and economics tells us it’s also cheaper to get two motors than four).  Failure of any arm-mounted motor on a QuadHybrid is not critical, the device will still hover in the air and can be landed safely.

– Safety (we all know it should be first). A QuadCopter without  shielded high-powered rotors is a pretty dangerous device,  its propellers are spinning with an incredible force and are ready to cut into anything that falls in their way – they can do a lot of damage to humans, pets or property. QuadHybrid only has four low-powered motors on its arms since they are only used for steering, not lifting. The center driving propellers on a QuadHybrid are shielded away by its arms, also they have a folding design, so if they hit something it will somewhat make the impact less destructive.  Overall QuadHybrid is more suitable for indoor applications such as schools , universities or research facilities. Make no mistake though – QuadHybrid  can  still do damage and safety procedures must he observed at all times !

Few advantages of Quadcopters over QuadHybrid worth mentioning may be:

– because they have four powerful motors, Quadcopters  have greater lifting power. However this is more of a “brute-force” advantage – one could always get more powerful motors and battery for a QuadHybrid to achieve the desired lift power.

– Quadcopters can do some serious aerobatics (if you’re a good pilot)  including fly upside down or do 3D stunts. This is not really an advantage for some people, specifically when you are actually trying to build a nice and stable robotic platform – on the contrary it’s more something you try to avoid. 

In conclusion: although this first version of QuadHybrid was not designed to do 3D stunts or fly with high speeds –  it has a great hovering and maneuvering stability. I think it will find most of its use as a highly stable and controllable indoor flying robotic platform. However similar spin-offs could be expected to be developed for flying outdoors and/or with higher speeds.



This article is dedicated to all my math and science teachers !

DCM Tutorial – An Introduction to Orientation Kinematics


This article is a continuation of my IMU Guide, covering additional orientation kinematics topics. I will go through some theory first and then I will present a practical example with code build around an Arduino and a 6DOF IMU sensor (acc_gyro_6dof). The scope of this experiment is to create an algorithm for fusing gyroscope and accelerometer data in order to create an estimation of the device orientation in space. Such an algorithm was already presented in part 3 of my “IMU Guide” and a practical Arduino experiment with code was presented in the “Using a 5DOF IMU” article and was nicknamed “Simplified Kalman Filter”, providing a simple alternative to the well known Kalman Filter algorithm. In this article we’ll use another approach utilizing the DCM (Direction Cosine Matrix). For the reader that is unfamiliar with MEMS sensors it is recommended to read Part 1 and 2 of the IMU Guide article. Also for following the experiments presented in this text it is recommended to acquire an Arduino board and an acc_gyro_6dof sensor.


No really advanced math is necessary. Find a good book on matrix operations, that’s all you might need above school math course. If you would like to refresh your knowledge below are some quick articles:
Cartesian Coordinate System –
Rotation –
Vector scalar product –
Vector cross product –
Matrix Multiplication –
Block Matrix –
Transpose Matrix –
Triple Product –


Vectors are marked in bold text so for example “v is a vector and “v” is a scalar (if you can’t distinguish the two there’s problem with the text formatting wherever you’re reading this).

Part 1. The DCM Matrix

Generally speaking orientation kinematics deals with calculating the relative orientation of a body relative to a global coordinate system. It is useful to attach a coordinate system to our body frame and call it Oxyz, and another one to our global frame and call it OXYZ. Both the global and the body frames have the same fixed origin O (see Fig. 1). Let’s also define i, j, k to be unity vectors co-directional with the body frame’s x, y, and z axes – in other words they are versors of Oxyz and let I, J, K be the versors of global frame OXYZ.


Figure 1

Thus, by definition, expressed in terms of global coordinates vectors I, J, K can be written as:

IG = {1,0,0} T, JG={0,1,0} T , KG = {0,0,1} T

Note: we use {…} T notation to denote a column vector, in other words a column vector is a translated row vector. The orientation of vectors (row/column) will become relevant once we start multiplying them by a matrix later on in this text.

And similarly, in terms of body coordinates vectors i, j, k can be written as:

iB = {1,0,0} T, jB={0,1,0} T , kB = {0,0,1} T

Now let’s see if we can write vectors i, j, k in terms of global coordinates. Let’s take vector i as an example and write its global coordinates:

iG = {ixG , iyG , izG} T

Again, by example let’s analyze the X coordinate ixG, it’s calculated as the length of projection of the i vector onto the global X axis.

ixG = |i| cos(X,i) = cos(I,i)

Where |i| is the norm (length) of the i unity vector and cos(I,i) is the cosine of the angle formed by the vectors I and i. Using the fact that |I| = 1 and |i| = 1 (they are unit vectors by definition). We can write:

ixG = cos(I,i) = |I||i| cos(I,i) = I.i

Where I.i. is the scalar (dot) product of vectors I and i. For the purpose of calculating scalar product I.i it doesn’t matter in which coordinate system these vectors are measured as long as they are both expressed in the same system, since a rotation does not modify the angle between vectors so: I.i = IB.iB = IG.iG = cos(IB.iB) = cos(IG.iG) , so for simplicity we’ll skip the superscript in scalar products I.i , J.j , K.k and in cosines cos(I,i), cos(J,j), cos(K,k).

Similarly we can show that:

iyG = J.i , izG=K.i , so now we can write vector i in terms of global coordinate system as:

iG= { I.i, J.i, K.i}T

Furthermore, similarly it can be shown that jG= { I.j, J.j, K.j} T , kG= { I.k, J.k, K.k} T.

We now have a complete set of global coordinates for our body’s versors i, j, k and we can organize these values in a convenient matrix form:

clip_image004[4] (Eq. 1.1)

This matrix is called Direction Cosine Matrix for now obvious reasons – it consists of cosines of angles of all possible combinations of body and global versors.

The task of expressing the global frame versors IG, JG, KG in body frame coordinates is symmetrical in nature and can be achieved by simply swapping the notations I, J, K with i, j, k, the results being:

IB= { I.i, I.j, I.k}T , JB= { J.i, J.j, J.k}T , KB= { K.i, K.j, K.k}T

and organized in a matrix form:

clip_image006[4] (Eq. 1.2)

It is now easy to notice that DCMB = (DCMG)T or DCMG = (DCMB)T , in other words the two matrices are translates of each other, we’ll use this important property later on.

Also notice that DCMB. DCMG = (DCMG)T .DCMG = DCMB. (DCMB)T = I3 , where I3 is the 3×3 identity matrix. In other words the DCM matrices are orthogonal.

This can be proven by simply expanding the matrix multiplication in block matrix form:

clip_image008[4] (Eq. 1.3)

To prove this we use such properties as for example: iGT. iG = | iG|| iG|cos(0) = 1 and iGT. jG = 0 because (i and j are orthogonal) and so forth.

The DCM matrix (also often called the rotation matrix) has a great importance in orientation kinematics since it defines the rotation of one frame relative to another. It can also be used to determine the global coordinates of an arbitrary vector if we know its coordinates in the body frame (and vice versa).

Let’s consider such a vector with body coordinates:

rB= { rxB, ryB, rzB} T and let’s try to determine its coordinates in the global frame, by using a known rotation matrix DCMG.

We start by doing following notation:

rG = { rxG , ryG , rzG } T.

Now let’s tackle the first coordinate rxG:

rxG = | rG| cos(IG,rG) , because rxG is the projection of rG onto X axis that is co-directional with IG.

Next let’s note that by definition a rotation is such a transformation that does not change the scale of a vector and does not change the angle between two vectors that are subject to the same rotation, so if we express some vectors in a different rotated coordinate system the norm and angle between vectors will not change:

| rG| = | rB| , | IG| = | IB| = 1 and cos(IG,rG) = cos(IB,rB), so we can use this property to write

rxG = | rG| cos(IG,rG) = | IB || rB| cos(IB,rB) = IB. rB = IB. { rxB, ryB, rzB} T , by using one the two definition of the scalar product.

Now recall that IB= { I.i, I.j, I.k}T and by using the other definition of scalar product:

rxG = IB. rB = { I.i, I.j, I.k}T . { rxB, ryB, rzB} T = rxB I.i + ryB I.j + rzB I.k

In same fashion it can be shown that:

ryG = rxB J.i + ryB J.j + rzB J.k
rzG = rxB K.i + ryB K.j + rzB K.k

Finally let’s write this in a more compact matrix form:

clip_image010[4] (Eq. 1.4)


Thus the DCM matrix can be used to covert an arbitrary vector rB expressed in one coordinate system B, to a rotated coordinate system G.

We can use similar logic to prove the reverse process:

clip_image012[4] (Eq. 1.5)

Or we can arrive at the same conclusion by multiplying both parts in (Eq. 1.4) by DCMB which equals to DCMGT, and using the property that DCMGT.DCMG = I3 , see (Eq. 1.3):



Part 2. Angular Velocity

So far we have a way to characterize the orientation of one frame relative to another rotated frame, it is the DCM matrix and it allows us to easily convert the global and body coordinates back and forth using (Eq. 1.4) and (Eq. 1.5). In this section we’ll analyze the rotation as a function of time that will help us establish the rules of updating the DCM matrix based on a characteristic called angular velocity. Let’s consider an arbitrary rotating vector r and define it’s coordinates at time t to be r(t). Now let’s consider a small time interval dt and make the following notations: r = r (t) , r’= r (t+dt) and dr = r’ – r:


Figure 2

Let’s say that during a very small time interval dt → 0 the vector r has rotated about an axis co-directional with a unity vector u by an angle dθ and ended up in the position r’. Since u is our axis of rotation it is perpendicular to the plane in which the rotation took place (the plane formed by r and r’) so u is orthogonal to both r and r’. There are two unity vectors that are orthogonal to the plane formed by r and r’, they are shown on the picture as u and u’ since we’re still defining things we’ll choose the one that is co-directional with the cross product r x r’, following the rule of right-handed coordinate system. Thus because u is a unity vector |u| = 1 and is co-directional with r x r’ we can deduct it as follows:

u = (r x r’) / |r x r’| = (r x r’) / (|r|| r’|sin(dθ)) = (r x r’) / (|r|2 sin(dθ)) (Eq. 2.1)

Since a rotation does not alter the length of a vector we used the property that| r’| = |r|.

The linear velocity of the vector r can be defined as the vector:

v = dr / dt = ( r’ – r) / dt (Eq. 2.2)

Please note that since our dt approaches 0 so does dθ → 0, hence the angle between vectors r and dr (let’s call it α) can be found from the isosceles triangle contoured by r , r’ and dr:

α = (π – dθ) / 2 and because dθ → 0 , then α → π/2

What this tells us is that r is perpendicular to dr when dt → 0 and hence r is perpendicular to v since v and dr are co-directional from (Eq. 2.2):

v ⊥ r (Eq. 2.21)

We are now ready to define the angular velocity vector. Ideally such a vector should define the rate of change of the angle θ and the axis of the rotation, so we define it as follows:

w = (dθ/dt ) u (Eq. 2.3)

Indeed the norm of the w is |w| = dθ/dt and the direction of w coincides with the axis of rotation u. Let’s expand (Eq. 2.3) and try to establish a relationship with the linear velocity v:

Using (Eq. 2.3) and (Eq. 2.1):

w = (dθ/dt ) u = (dθ/dt ) (r x r’) / (|r|2 sin(dθ))

Now note that when dt → 0, so does dθ → 0 and hence for small dθ, sin(dθ) ≈ dθ , we end up with:

w = (r x r’) / (|r|2 dt) (Eq. 2.4)

Now because r’ = r + dr , dr/dt = v , r x r = 0 and using the distributive property of cross product over addition:

w = (r x (r + dr)) / (|r|2 dt) = (r x r + r x dr)) / (|r|2 dt) = r x (dr/dt) / |r|2

And finally:

w = r x v / |r|2­ (Eq. 2.5)

This equation establishes a way to calculate angular velocity from a known linear velocity v.

We can easily prove the reverse equation that lets us deduct linear velocity from angular velocity:

v = w x r ­ (Eq. 2.6)

This can be proven simply by expanding w from (Eq. 2.5) and using vector triple product rule (a x b) x c = (a.c)b – (b.c)a. Also we’ll use the fact that v and r are perpendicular (Eq. 2.21) and thus v.r = 0

w x r = (r x v / |r|2­) x r = (r x v) x r / |r|2­ = ((r.r) v + (v.r)r) / |r|2­ = ( |r|2­ v + 0) |r|2 = v

So we just proved that (Eq. 2.6) is true. Just to check (Eq. 2.6) intuitively – from Figure 2 indeed v has the direction of w x r using the right hand rule and indeed vr and vw because it is in the same plane with r and r’.


Part 3. Gyroscopes and angular velocity vector

A 3-axis MEMS gyroscope is a device that senses rotation about 3 axes attached to the device itself (body frame). If we adopt the device’s coordinate system (body’s frame), and analyze some vectors attached to the earth (global frame), for example vector K pointing to the zenith or vector I pointing North – then it would appear to an observer inside the device that these vector rotate about the device center. Let wx , wy , wz be the outputs of a gyroscope expressed in rad/s – the measured rotation about axes x, y , z respectively. Converting from the raw output of the gyroscope to physical values is discussed for example here: . If we query the gyroscope at regular, small time intervals dt, then what gyroscope output tells us is that during this time interval the earth rotated about gyroscope’s x axis by an angle of dθx = wxdt, about y axis by an angle of dθy = wydt and about z axis by an angle of dθz = wzdt. These rotations can be characterized by the angular velocity vectors: wx = wx i = {wx , 0 , 0 }T , wy = wy j = { 0 , wy , 0 }T , wz = wz k = { 0 , 0, wz }T , where i,j,k are versors of the local coordinate frame (they are co-directional with body’s axes x,y,z respectively). Each of these three rotations will cause a linear displacement which can be expressed by using (Eq. 2.6):

dr1 = dt v1 = dt (wx x r) ; dr2 = dt v2 = dt (wy x r) ; dr3 = dt v3 = dt (wz x r) .

The combined effect of these three displacements will be:

dr = dr1 + dr2 + dr3 = dt (wx x r + wy x r + wz x r) = dt (wx + wy + wz) x r (cross product is distributive over addition)

Thus the equivalent linear velocity resulting from these 3 transformations can be expressed as:

v = dr/dt = (wx + wy + wz) x r = w x r , where we introduce w = wx + wy + wz = {wx , wy , wz }

Which looks exactly like (Eq. 2.6) and suggests that the combination of three small rotations about axes x,y,z characterized by angular rotation vectors wx , wy , wz is equivalent to one small rotation characterized by angular rotation vector w = wx + wy + wz = {wx , wy , wz }. Please note that we’re stressing out that these are small rotations, since in general when you combine large rotations the order in which rotations are performed become important and you cannot simply sum them up. Our main assumption that let us go from a linear displacement to a rotation by using (Eq. 2.6) was that dt is really small, and thus the rotations dθ and linear displacement dr are small as well. In practice this means that the larger the dt interval between gyro queries the larger will be our accumulated error, we’ll deal with this error later on. Now, since wx , wy , wz are the output of the gyroscope, then we arrive at the conclusion that in fact a 3 axis gyroscope measures the instantaneous angular velocity of the world rotating about the device’s center.

Part 4. DCM complimentary filter algorithm using 6DOF or 9DOF IMU sensors

In the context of this text a 6DOF device is an IMU device consisting of a 3 axis gyroscope and a 3 axis accelerometer. A 9DOF device is an IMU device of a 3 axis gyroscope, a 3 axis accelerometer and a 3 axis magnetometer. Let’s attach a global right-handed coordinate system to the Earth’s frame such that the I versor points North, K versor points to the Zenith and thus, with these two versors fixed, the J versor will be constrained to point West.


Figure 3

Also let’s consider the body coordinate system to be attached to our IMU device (acc_gyro used as an example),


Figure 4

We already established the fact that gyroscopes can measure the angular velocity vector. Let’s see how accelerometer and magnetometer measurements will fall into our model.

Accelerometers are devices that can sense gravitation. Gravitation vector is pointing towards the center of the earth and is opposite to the vector pointing to Zenith KB. If the 3 axis accelerometer output is A = {Ax , Ay , Az } and we assume that there are no external accelerations or we have corrected them then we can estimate that KB = –A. (See this IMU Guide for more clarifications

Magnetometers are devices that are really similar to accelerometers, except that instead of gravitation they can sense the Earth’s magnetic North. Just like accelerometers they are not perfect and often need corrections and initial calibration. If the corrected 3-axis magnetometer output is M = {Mx , My , Mz }, then according to our model IB is pointing North , thus IB = M.

Knowing IB and KB allows us calculate JB = KB x IB.

Thus an accelerometer and a magnetometer alone can give us the DCM matrix , expressed either as DCMB or DCMG


The DCM matrix can be used to convert any vector from body’s(devices) coordinate system to the global coordinate system. Thus for example if we know that the nose of the plane has some fixed coordinates expressed in body’s coordinate system as rB = {1,0,0}, the we can find where the device is heading in other words the coordinates of the nose in global coordinate systems using (Eq. 1.4):

rG = DCMG rB

So far you’re asking yourself if an accelerometer and a magnetometer gives us the DCM matrix at any point in time, why do we need the gyroscope ? The gyroscope is actually a more precise device than the accelerometer and magnetomer are , it is used to “fine-tune” the DCM matrix returned by the accelerometer and magnetometer.

Gyroscopes have no sense of absolute orientation of the device , i.e. they don’t know where north is and where zenith is (things that we can find out using the accelerometer and magnetometer), instead if we know the orientation of the device at time t, expressed as a DCM matrix DCM(t) , we can find a more precise orientation DCM(t+dt) using the gyroscope , then the one estimated directly from the accelerometer and magnetometer direct readings which are subject to a lot of noise in form of external (non-gravitational) inertial forces (i.e. acceleration) or magnetically forces that are not caused by the earth’s magnetic field.

These facts call for an algorithm that would combine the readings from all three devices (accelerometer, magnetometer and gyroscope) in order to create our best guess or estimate regarding the device orientation in space (or space’s orientation in device’s coordinate systems), the two orientations are related since they are simply expressed using two DCM matrices that are transpose of one another (DCMG = DCMBT ).

We’ll now go ahead and introduce such an algorithm.

We’ll work with the DCM matrix that consists of the versors of the global (earth’s) coordinate system aligned on each row:


If we read the rows of DCMG we get the vectors IB, JB, KB. We’ll work mostly with vectors KB (that can be directly estimated by accelerometer) and vector IB (that can be directly estimated by the magnetometer). The vector JB is simply calculated as JB = KB x IB , since it’s orthogonal to the other two vectors (remember versors are unity vectors with same direction as coordinate axes).

Let’s say we know the zenith vector expressed in body frame coordinates at time t0 and we note it as KB0. Also let’s say we measured our gyro output and we have determined that our angular velocity is w = {wx , wy , wz }. Using our gyro we want to know the position of our zenith vector after a small period of time dt has passed we’ll note it as KB1G . And we find it using (Eq. 2.6):

KB1GKB0 + dt v = KB0 + dt (wg x KB0) = KB0 + ( dθg x KB0)

Where we noted dθg = dt wg. Because wg is angular velocity as measured by the gyroscope. We’ll call dθg angular displacement. In other words it tells us by what small angle (given for all 3 axis in form of a vector) has the orientation of a vector KB changed during this small period of time dt.

Obviously, another way to estimate KB is by making another reading from accelerometer so we can get a reading that we note as KB1A .

In practice the values KB1G will be different from from KB1A. One was estimated using our gyroscope and the other was estimated using our accelerometer.

Now it turns out we can go the reverse way and estimate the angular velocity wa or angular displacement dθa ­= dt wa , from the new accelerometer reading KB1A­ , we’ll use (Eq. 2.5):

w­a = KB0 x va / | KB0|2­

Now va = (KB1A­ KB0) / dt , and is basically the linear velocity of the vector KB0. And | KB0|2­­ = 1 , since KB0 is a unity vector. So we can calculate:

dθa ­= dt wa = KB0 x (KB1A­ KB0)

The idea of calculating a new estimate KB1 ­ that combines both KB1A and KB1G is to first estimate dθ as a weighted average of dθa and dθg :

dθ = (sa dθa + sg dθg) / (sa + s), we’ll discuss about the weights later on , but shortly they are determined and tuned experimentally in order to achieve a desired response rate and noise rejection.

Note for advanced readers: To improve algorithm we could divide dϴg into two components: one orthogonal to KB0 and one parallel to it. We’d then only apply averaging formula on the component orthogonal to KB0 , the idea being that the accelerometer cannot sense rotation  about KB0 (azimuth to zenith) axis, thus the equivalent parallel component  of dϴa will always be zero.

And then KB1 ­ is calculated similar to how we calculated KB1G:

KB1KB0 + ( dθ x KB0)

Why we went all the way to calculate dθ and did not apply the weighted average formula directly to KB1A and KB1G ? Because dθ can be used to calculate the other elements of our DCM matrix in the same way:

IB1IB0 + ( dθ x IB0)

JB1JB0 + ( dθ x JB0)

The idea is that all three versors IB, JB, KB are attached to each other and will follow the same angular displacement dθ during our small interval dt. So in a nutshell this is the algorithm that allows us to calculate the DCM1 matrix at time t1 from our previous estimated DCM0 matrix at time t­­0. It is applied recursively at regular small time intervals dt and gives us an updated DCM matrix at any point in time. The matrix will not drift too much because it is fixed to the absolute position dictated by the accelerometer and will not be too noisy from external accelerations because we also use the gyroscope data to update it.

So far we didn’t mention a word about our magnetometer. One reasons being that it is not available on all IMU units (6DOF) and we can go away without using it, but our resulting orientation will then have a drifting heading (i.e. it will not show if we’re heading north, south, west or east), or we can introduce a virtual magnetometer that is always pointing North, to introduce stability in our model. This situation is demonstrated in the accompanying source code that used a 6DOF IMU.

Now we’ll show how to integrate magnetometer readings into our algorithm. As it turns out it is really simple since magnetometer is really similar to accelerometer (they even use similar calibration algorithms), the only difference being that instead of estimating the Zenith vector KB vector it estimates the vector pointing North IB. Following the same logic as we did for our accelerometer we can determine the angular displacement according to the updated magnetometer reading as being:

dθm ­= dt wm = IB0 x (IB1M­ IB0)

Now let’s incorporate it into our weighted average:

dθ = (sa dθa + sg dθg + sm dθm) / (sa + sg +­ sm)

From here we go the same path to calculate the updated DCM

IB1IB0 + ( dθ x IB0) , KB1KB0 + ( dθ x KB0) and JB1 JB0 + ( dθ x JB0),

In practice we’ll calculate JB1 = KB1 x IB1, after correcting KB1 and IB1 to be perpendicular unity vectors again , note that all our logic is approximated and dependent on dt being small, the larger the dt the larger the error we’ll accumulate.

So if vectors IB0, JB0, KB0 form a valid DCM matrix , in other words they are orthogonal to each other and are unity vectors, then we can’t say the same about IB1, JB1, KB1 , the formulas used for calculating them does not guarantee the orthogonality or length of the vector to be preserved , however we will not get a big error if dt is small, all we need to do is to correct them after each iteration.

First let’s see how we can ensure that two vectors are orthogonal again. Let’s consider two unity vectors a and b that are “almost orthogonal” in other words the angle between these two vectors is close to 90°, but not exactly 90°. We’re looking to find a vector b’ that is orthogonal to a and that is in the same plane formed by the vectors a and b. Such a vector is easy to find as shown in Figure 5. First we find vector c = a x b that by the rules of cross product is orthogonal to both a and b and thus is perpendicular to the plane formed by a and b. Next the vector b’ = c x a is calculated as the cross product of c and a. From the definition of cross product b’ is orthogonal to a and because it is also orthogonal to c – it end up in the plane orthogonal to c , which is the plane formed by a and b. Thus b’ is the corrected vector we’re seeking that is orthogonal to a and belongs to the plane formed by a and b.

Figure 5

We can extend the equation using the triple product rule and the fact that a.a = |a| = 1:

b’ = c x a = (a x b) x a = –a (a.b) + b(a.a) = ba (a.b) = b + d , where d = – a (a.b) (Scenario 1, a is fixed b is corrected)

You can reflect a little bit on the results … So we obtain corrected vector b’ from vector b by adding a “correction” vector d = – a (a.b). Notice that d is parallel to a. Its direction is dependent upon the angle between a and b, for example in Figure 5 a.b = cos (a,b) > 0 , because angle between a and b is less than 90°thus d has opposite direction from a and a magnitutde of cos(a,b) = sin(b,b’).

In the scenario above we considered that vector a is fixed and we found a corrected vector b’ that is orthogonal to a. We can consider the symmetric problem – we fix b and find the corrected vector a’:

a’ = ab (b.a) = ab (a.b) = a + e, where e = b (a.b) (Scenario 2, b is fixed a is corrected)

Finally in the third scenario we want both vectors to move towards their corrected state, we consider them both “equally wrong”, so intuitively we apply half correction to both vectors from scenario 1 and 2:

a’ = ab (a.b) / 2 (Scenario 3, both a and b are corrected)
b’ = ba (a.b) / 2


Figure 6

This is an relatively easy formula to calculate on a microprocessor since we can pre-compute Err = (a.b)/2 and then use it to correct both vectors:

a’ = a – Err * b
b’ = b – Err * a

Please note that we’re not proving that a’ and b’ are orthogonal in Scenario 3, but we presented the intuitive reasoning why the angle between a’ and b’ will get closer to 90°if we apply the above corrective transformations.

Now going back to our updated DCM matrix that consists of three vectors IB1, JB1, we apply the following corrective actions before reintroducing the DCM matrix into the next loop:

Err = ( IB1 . JB1 ) / 2

IB1= IB1 – Err * JB1
JB1= JB1 – Err * IB1
IB1’’ = Normalize[IB1]
JB1’’ = Normalize[JB1]
KB1’’ = IB1’’ x JB1’’

Where Normalize[a] = a / |a| , is the formula calculating the unit vector co-directional with a.

So finally our corrected DCM1 matrix can be recomposed from vectors IB1’’, JB1’’, KB1’’ that have been ortho-normalized (each vector constitutes a row of the updated and corrected DCM matrix).

We repeat the loop to find DCM2 , DCM3 , or in general DCM n , at any time interval n.


1. Theory of Applied Robotics: Kinematics, Dynamics, and Control (Reza N. Jazar)

2. Linear Algebra and Its Applications (David C. Lay)

3. Fundamentals of Matrix Computations (David S. Watkins)

4. Direction Cosine Matrix IMU: Theory (W Premerlani)

Additional Notes

For the implementation of the algorithm for now see my quadcopter project in particular releases 6/7 have a nice Processing program for visual display of the DCM matrix and a model plane. The entire code is on SVN repository:

The code is in imu.h file:

A PDF Version of this article is available here

DCM Tutorial – An Introduction to Orientation Kinematics by Starlino (PDF, Rev 0.1 Draft)

Please mention and link to the source when using information in this article:

Starlino Electronics  // Spring , 2011

Play PC games the iPad style – Using a PIC with USB, accelerometer and optional Gyroscope

The iPad is finally out – one feature that might caught your attention is the built-in accelerometer and the ability to control a game by tilting the device. For more than a year I was working on a similar idea for the PC Notebook market based on my original  motion gamepad project that would  allow playing a game by tilting the laptop/netbook. Now that iPad is out I hope that the notebook/netbook manufactures will catch up by incorporating MEMS sensor into their devices. Here is the result of my prototype , it is a USB attached device, but ideally I think this should be embedded into the laptop.


Read More »

A Guide To using IMU (Accelerometer and Gyroscope Devices) in Embedded Applications.


There’s now a FRENCH translation of this article in PDF. Thanks to Daniel Le Guern!

This guide is intended to everyone interested in inertial MEMS (Micro-Electro-Mechanical Systems) sensors, in particular Accelerometers and Gyroscopes as well as combination IMU devices (Inertial Measurement Unit).

Acc_Gyro_6DOF  and UsbThumb MCU unit

Example IMU unit:  Acc_Gyro_6DOF on top of MCU processing unit UsbThumb providing USB/Serial connectivity

I'll try try to cover few basic but important topics in this article:

– what does an accelerometer measure
– what does a gyroscope (aka gyro) measure
– how to convert analog-to-digital (ADC) readings that you get from these sensor to physical units (those would be g for accelerometer, deg/s for gyroscope)
– how to combine accelerometer and gyroscope readings in order to obtain accurate information about the inclination of your device relative to the ground plane

Read More »

Stereo Vision with OpenCV and QT


Read More »