Hexa - bad PosHold when Sonar is in use

Hi Guys,

I’ve built Hexa with Pixhavk 2.4.8 (fw3.4.6) and all is good. After some time I wanted to try “terrain follow” so I’ve added LV-Maxsonar-EZ4 (MB1040) proper shielded wire and capacitor/resistor (as recommended) connected on ADC3.3. The sonar looks like it’s working fine but in PosHold, Loiter or AltHold the Hexa doesn’t keep the altitude and is going up/down about a meter or so. When on-board baro is used, the copter is very stable in all modes.

I would like to know

  • Is there any more settings that I need to adjust
  • Can I use LV-Maxsonar-EZ4 (MB1040) for “avoidance”
  • Can I use LV-Maxsonar-EZ4 (MB1040) as a I2C (according the specs I can but it didn’t work)
    I will appreciate any help/idea about this,


Kirk, have you tried to look at desired vs actual altitude in the logs? This could tell you if the Sonar is returning excessively high variable values, or spikes, or if the issue is somewhere else, perhaps tuning.

In terms of settings, gain (mission planner, full parameter list) is definitely a parameter that should be adjusted. Also sonars are prone to noise (electrical, acoustic, vibration, EMF) so the source of your issue could also come from that.


Hi Oliver,

Thank you for the link, it was very helpful (for some reason I didn’t find it during my research).
The funny thing is that everything (almost everything) looks as should be (or in the limits) but still getting the same result. Without Sonar my hexa is very stable (in wind 15-35km/h, in PosHold mode position range is between 10-40cm), but with the sonar the position is good but altitude fluctuating ±1m.
next time when I will testing I’ll get the log so if you want you can have a look in it. Maybe I not looking at the right things.


Hi Oliver,

I think that I found the reason for the problem. Basically the sonar is too sensitive on the propellers noise. When I replaced existing CF with regular PLA propellers the drone was responding as expected but soon as the wind speed is more then 15km then again it’s not stable. I repeat the
experiment with smaller CF propellers (10x38) and it was a little bit more unstable.
My conclusion is the MB1040 is not suitable for me and I’ve ordered PixFlow.
Thanks again for Your help.