A Magnetometer-based Complementary Filter for Small Multi-Rotor Helicopters

DOI : 10.17577/IJERTV5IS090288

Download Full-Text PDF Cite this Publication

Text Only Version

A Magnetometer-based Complementary Filter for Small Multi-Rotor Helicopters

Myunggon Yoon , Jin-Seon Hong Department of Precision Mechanical Engineering Gangneung-Wonju National University,

South Korea

AbstractIn this paper we propose a magnetometer-based complementary filter for an attitude estimation of a small multi- rotor helicopter employing a low-cost IMU (inertial measurement unit). A key idea is to combine a magnetometer with a gyroscope, instead of the usual accelerometer-gyroscope combination. From experiments, it is suggested that when an accelerometer noise is significant, our magnetometer-based complimentary filter can outperform the conventional complementary filter.

KeywordsComplementary Filter, Multi-Rotor Helicopter, IMU

  1. INTRODUCTION

    Low-cost IMUs are widely used for small multi-rotor helicopters. Those IMUs include a 3-axis accelerometer and a 3-axis gyroscope at least, called as 6-DOF (degree of freedom) IMUs. Some IMUs, called as 9-DOF IMUs, have a 3-axis 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 one-dimensional case .

    The performance of sensors in a low-cost IMU used for multi-rotor helicopters is relatively poor compared to those of commercial or military counterparts. For an instance, a gyroscope in a typical low-cost IMU has a significant drift. Furthermore, the computation capability of a typical low-cost MCU (micro-control 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 low-cost IMUs [5,6].

    The aim of this paper is twofold: firstly, we present a summary of a standard complementary filter with a real-world example for educational purposes and, secondly, we propose a modified complementary filter in which a magnetometer is used instead of an accelerometer.

  2. 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

    Jung-Ho Moon Department of Electrical Engineering Gangneung-Wonju National University,

    South Korea

    frequency-dependent 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 xyz-frame is a moving frame attached to a helicopter with an IMU. We assume that the positive Z-direction is upward (height) from the ground where the XYZ frame is placed.

    A rotational motion of the body that is the xyz-frame, with respect to the earth frame, needs to be estimated from outputs of multiple sensors.

    Figure 1 Coordinate Frames

    1. 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 multi-rotor. An employment of a low-pass filter can be helpful but the resulting performance is usually limited. An example can be found in the work [7].

    2. 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 multi-rotor. 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 Y-direction 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

    3. 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 multi-rotor 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.

    1. 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 XY-components unlike the earth gravitational acceleration vector that is directed to the ground (negative Z-direction). Because of this difference, the magnetometer can be used to measure a rotation of the body in the Z-coordinate, which is impossible with an accelerometer.

  3. COMPLEMENTARY FILTER

    In this paper, we will consider a one-dimensional 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 multi-rotor helicopter. Let us assume that the body frame

    will rotate in the Y-direction 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 first-order low and high pass filter, respectively. The design parameter should be properly chosen based on the cut-off frequency of the two filters in(8).

    From a standard continuous-discrete conversion, the above filter (8) can be implemented as

    +1 =

    ( + )

    +

    +

    +

    (9)

    Figure 2 One-dimensional 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 time-indices of discrete signals.

    1. Magnetometer-based Complementary Filter

    If an accelerometer noise is too strong or the noise has a wide-band 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 magnetometer-based 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 3-axis gyroscope (L3GD20H), a 3- axis compass and 3-axis 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 Y-axis 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 non-zero components in the X and Y directions (recall Fig. 1) in general, and thus the angle

    in (7) depends on the angle of Z-rotation. As a result, the filter (9) or (10) in its present form cannot be used for filtering general three-dimensional motions.

    A. Test Jig

    Figure 3 Test Jig

  4. 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 one-dimensional 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 step-like discontinuity of a period 0.06 second roughly, as the inset in the lower picture of

    Fig. 5 shows. This step-like 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 first-order low-pass/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 step-like noise of the magnetometer was smoothened by a sensor fusion.

    At this stage, it should be emphasized that the superior performance of our magnetometer-based complementary filter is not a general fact. Indeed, it comes from the significant accelerometer noises. Another important point is that, as discussed before, the magnetometer-based complementary filter in (10) is limited to one-dimensional rotation only.

  5. CONCLUSION

We have proposed a magnetometer-based complementary filter for an attitude estimation of a small multi-rotor helicopter. It was confirmed from experiments that a magnetometer-based complementary filter could outperform the conventional one when an accelerometer noise was severe. Our magnetometer-based complimentary filter proposed in this paper works for one-dimensional motion only. An extension for a general 3-dimensional motion is left as a further work.

REFERENCES

2

2

= 1

= 1.77 Hz,

  1. Maybeck, Peter S., Stochastic Models, Estimation and Control (vol 1), Academic Press, 1979.

    which is by design much smaller than the step-like noise frequency 16.7 Hz of the magnetometer.

    Two complementary filters gave angle estimations shown in Fig. 6.

    Figure 6 Filtered Angles

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

  3. R. Faragher, Understanding the basics of the Kalman filter via a simple and intuitive derivation, IEEE Signal Processing Magazine,

    Vol 29, Issue 5, 2012

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

  5. 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

  6. 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

  7. M. Yoon and J. Moon, One-dimensional Stabilization of a Multi-rotor Helicopter, International Journal of Engineering Research and Technology, 5 (4), pp. 124-127, 2016

Leave a Reply