 Open Access
 Total Downloads : 467
 Authors : Myunggon Yoon , JinSeon Hong , JungHo Moon
 Paper ID : IJERTV5IS090288
 Volume & Issue : Volume 05, Issue 09 (September 2016)
 Published (First Online): 13092016
 ISSN (Online) : 22780181
 Publisher Name : IJERT
 License: This work is licensed under a Creative Commons Attribution 4.0 International License
A Magnetometerbased Complementary Filter for Small MultiRotor Helicopters
Myunggon Yoon , JinSeon Hong Department of Precision Mechanical Engineering GangneungWonju National University,
South Korea
AbstractIn this paper we propose a magnetometerbased complementary filter for an attitude estimation of a small multi rotor helicopter employing a lowcost IMU (inertial measurement unit). A key idea is to combine a magnetometer with a gyroscope, instead of the usual accelerometergyroscope combination. From experiments, it is suggested that when an accelerometer noise is significant, our magnetometerbased complimentary filter can outperform the conventional complementary filter.
KeywordsComplementary Filter, MultiRotor Helicopter, IMU

INTRODUCTION
Lowcost IMUs are widely used for small multirotor helicopters. Those IMUs include a 3axis accelerometer and a 3axis gyroscope at least, called as 6DOF (degree of freedom) IMUs. Some IMUs, called as 9DOF IMUs, have a 3axis magnetometer additionally.
For an estimation of an attitude of a helicopter, one needs to combine information from multiple sensors in an IMU. This procedure is called as a sensor fusion or a filter. The Kalman filter and the complimentary filter are widely known sensor fusion techniques. An elementary introduction to the Kalman filter and interesting examples in the context of aircraft navigation can be found in [1,2,3]. Moreover, in [4], it was shown that of complementary and Kalman filters are equivalent in a onedimensional case .
The performance of sensors in a lowcost IMU used for multirotor helicopters is relatively poor compared to those of commercial or military counterparts. For an instance, a gyroscope in a typical lowcost IMU has a significant drift. Furthermore, the computation capability of a typical lowcost MCU (microcontrol unit) used for multirotor helicopters is limited and therefore a desirable attitude estimation algorithm should not be computationally demanding. Those technical difficulties motivated several sensor fusion approaches specifically for lowcost IMUs [5,6].
The aim of this paper is twofold: firstly, we present a summary of a standard complementary filter with a realworld example for educational purposes and, secondly, we propose a modified complementary filter in which a magnetometer is used instead of an accelerometer.

BACKGROUNDS
Various sensor fusion techniques are based on different characteristics of sensors. The differences can be described in terms of stochastic properties such as a noise covariance or a
JungHo Moon Department of Electrical Engineering GangneungWonju National University,
South Korea
frequencydependent noise distribution. We shortly explain this point in this section.
Consider a schematic in Fig. 1. The XYZ coordinate frame is an (fixed) inertia frame attached to the earth and the xyzframe is a moving frame attached to a helicopter with an IMU. We assume that the positive Zdirection is upward (height) from the ground where the XYZ frame is placed.
A rotational motion of the body that is the xyzframe, with respect to the earth frame, needs to be estimated from outputs of multiple sensors.
Figure 1 Coordinate Frames

Accelerometer
Accelerometer can measure an instant acceleration of the body frame relative to the earth frame. We assume that the translational acceleration is small compared to the magnitude of the gravitational acceleration. This is the case when a multi rotor is hovering, for an example.
Under this assumption, the measured acceleration is merely the gravitational acceleration vector represented with respect to the body frame as follows;
= []. (1)
When the body frame has no rotations with respect to the earth frame, as is the case shown in Fig. 1, one simply has
0
= [ 0 ] , = 9.81 (/2) (2)
A significant disadvantage of an accelerometer is that the sensor output is accompanied by high frequency noises. As a result, it is practically difficult to use a raw accelerometer data
only, for a stabilization of a multirotor. An employment of a lowpass filter can be helpful but the resulting performance is usually limited. An example can be found in the work [7].

Gyroscope
Gyroscope measures the angular velocity of the body frame with respect to the earth frame. An integration of gyroscope data can provide a rotational attitude (angle) of a multirotor. However, a low frequency sensor offset, called as gyroscope draft, causes an accumulated error in the
A gyroscope can also indirectly measure the rotation angle
() = () (5)
0
where () denotes the angular velocity in the Ydirection that the gyroscope can directly measure.
Furthermore, from a magnetometer, one can measure the rotation angle as
integration process and thus angle data from a gyroscope can be less and less accurate as time goes on. Hence, on the contrary to the accelerometer, a gyroscope has a low
() +
= tan1 [()] (6)
()
frequency noise.
Note that the angle

Magnetometer
Magnetometer can measure the earth magnetic field in space. At a particular location on the earth, the direction and
tan1 [(0)] (7)
(0)
magnitude of the earth magnetic field is nearly fixed in the earth frame, since the flight range of a multirotor helicopter is negligible in the scale of the earth. Represented in the body frame, the magnetic field is given as
= [] (3)
corresponds to an initial state (0) = 0 when the body
frame is aligned with the earth frame with no rotations.

Complementary Filter
Standard complementary filters make use of the outputs of an accelerometer and a gyroscope. A philosophy of the co st
mplementary filter can be under ood in the frequency
domain with ease.
Note that the direction of the earth magnetic field, the
vector in Fig. 1, has XYcomponents unlike the earth gravitational acceleration vector that is directed to the ground (negative Zdirection). Because of this difference, the magnetometer can be used to measure a rotation of the body in the Zcoordinate, which is impossible with an accelerometer.


COMPLEMENTARY FILTER
In this paper, we will consider a onedimensional rotation
Recall that the angle in Eq. (5) measured by an accelerometer usually has high frequency noises, whereas the rotation angle by a gyroscope in Eq. (6) is subject to low frequency noise (drift). In other words, both the low frequency component of the accelerometer signal and the high frequency component of the integration of the gyroscope are robust to noises and thus more reliable. From this observation, the standard complimentary filter combines those two sensors in the next form
of a multirotor helicopter. Let us assume that the body frame
will rotate in the Ydirection of the earth frame. Then the attitude of a body is completely determined by a single angle
() in Fig. 2;
() =
= 1
1
1 +
() +
() +
1 +
() ()
(8)
1 +
1 +
where 1/(1 + ) and /(1 + ) are a firstorder low and high pass filter, respectively. The design parameter should be properly chosen based on the cutoff frequency of the two filters in(8).
From a standard continuousdiscrete conversion, the above filter (8) can be implemented as
+1 =
( + )
+
+
+
(9)
Figure 2 Onedimensional Case
The rotation angle () of the body can be measured by an accelerometer as
where denotes a sampling time and the subscripts {, + 1 } denote the timeindices of discrete signals.

Magnetometerbased Complementary Filter
If an accelerometer noise is too strong or the noise has a wideband spectrum, then one has to choose a large in the filter (8), for a given sampling time, in order to have a small weighting on the accelerometer signal, that is, a small value
() = tan1[ ()/
] (4)
/( + ). This choice makes the complementary filter
()
rely solely on the gyroscope, ignoring accelerometer signal
and thus the complementary filter suffers from a sensor drift, like a gyroscope.
In this circumstance, it can be more appropriate to use a magnetometer, instead of an accelerometer. This is because a magnetometer can measure the attitude angle with small noises.
Motivated by this fact, as a modification the filter (8), we propose a magnetometerbased complementary filter of the next form
a stepper driver. By changing the driving frequency, a constant angular velocity in the Y direction could be obtained.
B. Sensor Signals
The IMU module used in our experiment is composed of three sensors on a board: a 3axis gyroscope (L3GD20H), a 3 axis compass and 3axis accelerometer (LSM303) and a barometric pressure/temperature sensor (BMP180).
A reference motion was generated with a stepper in the test jig and we obtained the signals of the gyroscope,
1
accelerometer and magnetometer shown in Fig. 4 with a
= 1 + () + 1 + () (10)
More generally, one may combine the two filters (9) and
(10) to have
sampling frequency 100 Hz.
The gyroscope signal in Fig.4 explains the one dimensional motion of the IMU body in the Yaxis with a constant angular velocity. The accelerometer signal shows a
= 1
[()+(1 )
()]
severe noise which is a usual result with an accelerometer
,
1 +
(11)
sensor but, in our case the noise was especially strong from
+
1 +
()
the structure vibration of the jig caused by a stepper vibration.
with a weighting (design) parameter 0 1. However in this paper we will focus on only two special cases = 0 and
= 1, that is, the filters in (8) and (10).
Note that the direction of the magnetic field, the direction of the vector in (3) has nonzero components in the X and Y directions (recall Fig. 1) in general, and thus the angle
in (7) depends on the angle of Zrotation. As a result, the filter (9) or (10) in its present form cannot be used for filtering general threedimensional motions.
A. Test Jig
Figure 3 Test Jig


EXPERIMENTS
Figure 4 Sensor Signals
Making use of (4), (5) and (6), we could obtain the rotation angle of the IMU board with each of three sensors, which is shown in Fig. 5, respectively.
A severe drift of the estimated angle of the gyroscope clearly appears in the upper picture of Fig. 5. In the middle picture, one sees very noisy angle measurement of the accelerometer. In the lower picture, the angle measurement by the magnetometer has a very small noise and a slight drift. This small drift was found to be caused by an actual drift in the mechanism of the test jig and therefore it is not a drift but a physically correct data.
In order to generate a pure onedimensional rotational
motion, we developed a simple test jig in Fig. 3. A stepper motor is combined with a microcontroller (Arduino Nano) and
However, we have found the magnetometer has a small bandwidth and thus its output has a steplike discontinuity of a period 0.06 second roughly, as the inset in the lower picture of
Fig. 5 shows. This steplike discontinuity can be regarded as a noise of a frequency 1/0.06= 16.7 Hz and thus a sort of sensor fusion is still desirable.
Figure 5 Independent Angle Estimations
Both the complementary filter (8) and the magnetometer based complementary filter (10) were implemented with design parameters
= 0.09, = 0.01.
Then the cutoff frequency of the firstorder lowpass/high pass filter of the complementary filter becomes
In the upper part of Fig. 6, we see that the conventional complementary filter composed of an accelerometer and a gyroscope results in a small drift but still suffer from a high frequency noise. The noise could be further suppressed by changing filter parameters but this change recalls a larger drift, as addressed before. This performance limitation is a consequence of the significant accelerometer noises.
In contrast, in the lower part of Fig. 6, the magnetometer based complementary filter gives a much cleaner angle with a negligible noise. Furthermore, as the inset shows, the steplike noise of the magnetometer was smoothened by a sensor fusion.
At this stage, it should be emphasized that the superior performance of our magnetometerbased complementary filter is not a general fact. Indeed, it comes from the significant accelerometer noises. Another important point is that, as discussed before, the magnetometerbased complementary filter in (10) is limited to onedimensional rotation only.

CONCLUSION
We have proposed a magnetometerbased complementary filter for an attitude estimation of a small multirotor helicopter. It was confirmed from experiments that a magnetometerbased complementary filter could outperform the conventional one when an accelerometer noise was severe. Our magnetometerbased complimentary filter proposed in this paper works for onedimensional motion only. An extension for a general 3dimensional motion is left as a further work.
REFERENCES
2
2
= 1
= 1.77 Hz,

Maybeck, Peter S., Stochastic Models, Estimation and Control (vol 1), Academic Press, 1979.
which is by design much smaller than the steplike noise frequency 16.7 Hz of the magnetometer.
Two complementary filters gave angle estimations shown in Fig. 6.
Figure 6 Filtered Angles

G. Welch and G. Bishop, An introduction to the Kalman filter, Technical Report, University of North Carolina at Chapel Hill, NC, USA, 1995.

R. Faragher, Understanding the basics of the Kalman filter via a simple and intuitive derivation, IEEE Signal Processing Magazine,
Vol 29, Issue 5, 2012

Walter T. Higgins, JR., A comparison of complementary and kalman filtering, IEEE Trans. On Aerospace and Electronic System 11(3), pp. 321325, 1975

S. Madgwick, A. Harrison and A. Vaidyanathan, Estimation of IMU and MARG orientation using a gradient descent algorithm, IEEE Int Conference on Rehabilitation Robotics, Switzerland, June 29 July 1, 2011

R. Mahony, T. Hamel and J. Pflimlin, Nonlinear Complementary Filters on the Special Orthogonal Group, IEEE Transactions on Automatic Control 53(5), pp. 1203 1218, 2008

M. Yoon and J. Moon, Onedimensional Stabilization of a Multirotor Helicopter, International Journal of Engineering Research and Technology, 5 (4), pp. 124127, 2016