Altitude Hold

I have two ArduCopters... One with the 850kv motors, 10x45 props and a MB1260 XL-MaxSonar-EZL0 sonar. The second one is a 880kv motors, 12x45 props and LV-MaxSonar-EZ4 sonar. Both on the latest firmware compiled in arduino-0022, 2.0.35 and uploaded to both from arduino-0022.


Something changed in 2.0.35 which causes the motors to gun instead of slowly ramp up to adjust altitude while in alt-hold/loiter. This of course happens on both of my quads.


The larger quad (880kv ez4 sonar) seems to alt-hold and loiter OK but there is an issue with altitude considering the engine gunning.


The 850 kv quad with the ezl0 sonar has worse problems. Alt hold may hold (considering the engine gunning) for a few moments but eventually rises and does not stop or it descends to the ground. Sometimes it will descend to the ground and then fly back up either to a random height OR it will just keep climbing until i recover manually.


The one issue is a code issue, the gunning, this was something chris had done to test some sensors and was going to move the alt-hold code back to where it belonged, this has not happened yet.


So my question is.. Is the ezl0 sensor different in some way that may be causing this behavior? (climbing and not stopping, i was having random problems with this one before).


Im going to disable sonar and give it another go. Attached is the log from the flight with all the alt-hold issues.

16-07-11 04-00 1.log

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

Join diydrones

Email me when people reply –


  • I flew a total of about 30-40 minutes today and allot of it in alt-hold and loiter and must say that alt-hold is pretty solid now.


    The new position/mounting suggestion for the sonar in the wiki is probably the best position for it but i did not have anything handy to mount the sonar out away from the ESC. Instead it is mounted directly under one of the front arms on two of the longer plastic standoff's included with the kit (as pictured below).


    I tested it also with one long and one half standoff included with the kit but i got noise on the sonar.


    In another thread it is also suggested to use a shielded cable (which will be my next mod). Eventually i will get the sonar mounted on an arm but for now this works very well for me and is noise free. I just do not like how low it is to the ground.




  • Just out of curiosity i decided to fly two test flights today and grab their logs. Both flights were stabilize only and only consisted of a few minutes. Both flights altitude was varied at least once slowly as well as a few sudden changes in altitude. I wanted to see the difference between the graphs with the moded code (to adjust for the 1260 scaling, graph 1/log 1:01) and the stock code (no scaling adjustment for 1260 scaling, graph 2/log 1:13).


    Green on the graph is barometer and red is the sonar. What i expect to see is both be equal or close up and until the sonars height limit which is around 700cm (the 1260 is actually good up to 10 meters).


    Looking at the graph it seems that the average filter on the sonar is a bit to aggressive, even on a slow climb out the sonar value can not keep up with the changing altitude. What i expect to see is the sonar to follow the baro (witch some lag due to filtering) up and until its max height.


    This IMO is one of the causes of the constant climb out....


    BTW i do have on order a MB1200 but what my log shows you will have the exact same problem with this and other sonars as well.


    The other thing to note and it has me miffed is at the end of flight 1, beginning and end of flight 2 the sonar ramps up to 700 when on the ground. I did not see this on the bench last night and it does not appear to do it all the time.



    18-07-11 01-01 5.log

    18-07-11 01-13 1.log
  • Per this thread



    The sonar I am using is the MB1260 XL-MaxSonar-EZL0, it IS different than the sonar MB1200 EZ0.


    Per the datasheet for the 1200 the scaling factor for the EZ0 is (Vcc/1024) per cm.


    The 1260 EZL0 has a scaling factor of (Vcc/1024) / 2 cm.


    The datasheets for the sonars can be found here



    I do not see anywhere in code where the difference between these two sonars are handled. A mod was suggested which i will try tomorrow but i am certain this is the reason why i am seeing this strange behavior.


    I suggest that the diydrones store update their product listing to point to the proper datasheet as well as maybe the developers add a switch in the config for this or other sonars (if one does not yet exist).


    I will report back tomorrow.


  • The attached log is from my second flight i just completed. This flight the EZL0 sonar was disabled and it performed much better. The motors to not gun as much (or maybe not at all when sonar is disabled) and it keeps an OK alt-hold and loiter.


    So it must be something with the EZL0 sonar. I am unable to fly the EZ4 sonar equipped quad at the moment but my last test on 2.0.35 it performed OK except for the motor gunning.


    Any ideas with the EZL0 sonar? Should i chuck this $55 sonar for the cheaper but working ones?

    16-07-11 06-19 1.log

  • 100KM

    I have the EZ0 sonar and saw the exact same behaviour yesterday with my hexa when testing 2.0.35 : alt hold either climbs constantly or in 1 of my 6 attempts descended rather fast.  It starts to climb immediately after engaging alt hold and at constant speed.  I hear the motors throttle up a certain amount and they stay at that throttle setting.  Even when I set hoovering throttle by briefly (<1s) setting channel 7 high.  This is for engaging althold at more then 10m altitude.

    At lower altitude I also get the aggressive motor corrections, as if someone is showing off a motorcycle : vroem, vroem, vroem.

    Loiter holds altitude a little longer, but also starts climbing.


This reply was deleted.