Hello, I did this because I noticed that the altitude of GPS is not stable. GPS coordinates are correct however.

They remain well within a radius of ten meters around the real point. But the altitude is completely crazy, it depends on the day, and even the moment of day. This is related to the position of satellites, I am in Europe, Is this the problem?.But, it's may be a problem for the stabilization of our plane in altitude. And increasingly it is not very accurate.

And with two I2C devices it works, cool.

What do you think of this approach?

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • P030410_22.050001.JPG
  • Developer
    Yves thanks for sharing that. The picture shows the Magnetometer but where is the barometric pressure sensor ?
  • And of course here is the code.
  • I used the code provided by Christopher Barnes. Source code est available from:
    And then it is merged with the code Arduimu.

    The idea of putting a filter is interesting, there are still small variation of the order of 10 to 20 centimeters. The test is done indoors and rest on the outside it might be otherwise.There is there a model to do?
  • By the way Yves, I wasn't meaning to hijack your thread, since I think you've arrived at the best practical solution to height control, but rather to try to clear up some confusion about the source of the height "noise" from GPS's in particular.
  • or is it SA error?

    No Darren, SA has been off for a number of years now. (it was > +/- 50 metres in X and Y when it was on).

    Height is the most sensitive parameter from the triangulation process, simply because of the geometry of the sats.
    The low elevation sats are particularly troublesome because they are most distorted by the longer path through the atmosphere/ionosphere and most susceptible to multipath reflections.
    So if you can chop them out by increasing the min horizon mask, those sats will not corrupt the solution.
  • Developer
    Yves - what formula are you using for conversion of pressure to altitude?
  • 3D Robotics
    That's a really neat installation. Well done!
  • It's not so much that the GPS signal is noisy, but rather that the visible satellites keep changing particularly when the aircraft is banking and the antenna loses sight of lower elevation satellites.
    These low elevation satellites bias the solution most greatly in the Z component (height) so when one drops out, there is a corresponding "step" in the computed height.
    This can be up to > 5m. Of course when the aircraft resumes staright and level, the sat is re-acquired and another step occurs.
    The barometric aiding is a good solution that overcomes this problem, but most baro signals need to be heavily filtered to be usable for height control.
    Another solution is to raise the horizon mask in the GPS setup to 15 deg which prevents usage of the lower (most innacurate) satellites.
  • Sounds very reasonable to me. GPS's altitude is off by 60 +- ft over the course of a minute or two, because the signal it gets from the satellites is a bit noisy. Barometric pressure is a good way of determining altitude, as long as you reset the sensors to a known correct value before you start flight
This reply was deleted.