Sonar ALT_Hold Issue


Hello there,

Yesterday, i added a new senor onto my quad, MaxSonar MB1260 XL for better altitude hold. Before attaching and re-uploading the ArduCopter 2.7.3 onto the APM 2. I erased and reset the board. And then attached sonar as described in the wiki manual. And uploaded the code and followed all initial steps (Of course i enabled the sonar). Everything went smooth. 

Next step, time for test fly. It flew great in Stable mode. However, as soon as i toggled the ALT_Hold switch ON. Quad started acting strange. It kept climbing higher n higher and suddenly dropped out of nowhere. Luckily i managed to control by toggling the switch back to stable mode.

I have checked everything couple of times now. All connection looks good. Mission Planner looks ok. I don't know what the problem. Your help would be so much helpful. I have attached couple of videos below. Please take a look at them. If you need any other information let me know. Thank you.

Quad Setup:

  • DJI F450 Frame
  • HackerStyle 20-22L Motors
  • Turnigy TY-P1 25Amps ESC (Flashed with SimonK firmware)
  • ArduCopter 2.7.3
  • MB1260 XL - Sonar 
  • 4000mah 20C 3Cell Battery
  • DX7 with AR7000 
  • Using one of four ESCs to provide power to the APM 2. 








E-mail me when people leave their comments –

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

Join diydrones


  • Any point marked GND , but if you check out the MaxBotix web site they have a particular wiring diagram for the cable.

  • Just to clarify, where exactly is earth on the APM2 board? Just any negative pin or is there a particular place to earth it?

  • Same everything here. Tried the homemade cable, found a real shielded cable and tried that, did the power supply filter, and I even used plastic bar between my front two arms same as you, and I got the exact same results. In the log visualizer it's noise noise noise. And I'm not willing to fly a separate battery just for sonar. While you can see the copter struggling to make sense out of the data, it essentially does not work. 

    I gave up. 

  • That behaviour looks very much like mine, Alt hold was all over the place and no amount of tuning helped.

    Jason looked at the logs and pointed out the noise in the sonar trace and suggested I disconnect it. I was then able to tune Alt Hold (at higher levels using only Baro).

    I eventually used the heavy shielded cable that came with the Sonar kit, making sure to join the shield and earth at the APM side only, and all the misbehaviour went away.

    I had previously tried the noise filter without effect, on a less than ideal cable.

    So is your shield connected to earth at the APM end?

  • Here are couple of pictures of my home-made shielded cable and Power Filter (10Ohm Resistor and 100uF Capacitor 10V).

    Let me know, if you spot something fishy. Or suggest me your ideas. Thanks. Enjoy. :)










  • I have done the power filter as well as used homemade shielded cable (Wrap alu foil around the servo cable and used shrink tube). I don't see any difference in the ALT_Hold. Sad to say but It even got worst. :( 

    I have tried everything now and almost ready to give up on this.

    Here is a short test: VIDEO (or Below)


  • Hi guys, so here's a look at the difference between before and after power filtering of my MB1200.


    It looks cleaner, but I'm still getting these very sharp downwards spikes which I think are causing my quad to twitch while in Alt Hold mode. I am beginning to suspect that it is partially due to the fact that I am flying over a grass field (short grass) rather than a harder surface.

    I did manage to fly around for several minutes in Alt Hold mode with the quad holding its altitude automatically but there were some instances whereby after some faster turning maneuvers the quad would dip down and touch the ground. I also noticed that the quad tends to slowly decrease its altitude by itself, not sure why is this so either.

    Is this as good as it gets? I've already exhausted every trick in the book that I can think of...

  • Developer


        Yes, hiding it all inside a cable would be nice.  I was actually going to get the cable attached to the little pcb as well so it would be a complete solution.  People would still need to solder one side of the pcb onto the sonar itself but the holes are in just the right place so it's pretty straight forward.

  • i didnt find the name of "sonar" status meter reading or graphic this?  anyone can advise me, thank you.

  • Kur: I bought them from my local hardware shop. Where I come from it makes no sense to order a resistor and cap online.. :)

    Randy: Large cap and resistor installed, initial bench testing show sonar works fine. Will need to fly to know if I can get a smooth sonar curve like yours. Will report back soon once the rain goes away.

    Also, interesting that you need a heating element, if anything I need a cooling element for everything (myself included) to prevent overheating from the tropical sun!

    Bill: Yes, would be good to have an all in one solution you can just plug or solder onto the sonar. I feel very uneasy with my rather flimsy soldering skills.

This reply was deleted.