[SOLVED] Maxbotix EZ4 Sonar in quadcopters


UPDATE (18-05)

Thank you all for your support and your quick responses. I tried landing in asphalt and the results were so much better. Below you'll find the pictures and I have attached the flight log; the sonar started working from around 3 m and the performance was acceptable. I will still consider the option of the rangefinder, as was suggested here.







I've made a couple of flights using the EZ4 I2C sonar from Maxbotix. Since the beginning, I've experienced some difficulties to get the correct altitude using this sensor. I have always some kind of noise which, up to now, I haven't been able to identify. These are like the picture below (this shows a quadcopter landing).


The value at which the sonar saturates it's the maximum one (7.64 m). From the picture, you can see that the copter is descending, but it has this weird spikes where it measures correct values and then it saturates.

I've tried every method mentioned in this guide from Maxbotix, but it improves the performance of the sensor just a bit compared to my previous tests and I still get the spikes. Attached below you can find more pictures of my logs and the 3 logs I used to make these drawings.

I have tested this sensor on two drones, a small quad and a large one. In the large quadcopter, the spikes in the sensor have sometimes make the drone bounce when it touches the ground (which is exactly what we were trying to prevent when we bought the sonars). I've tried more than one sensor to discard that one of them may be faulty, so I'm really clueless right now as to how can I solve these problems.

One final note is that in my large quad, the barometer may be failing as well since I get negative altitude values when the copter is taking off, and then they come back when landing (it would be normal to have a couple of negative cms because of the GPS error, but I'm getting about -2 to -3 m, which is really high).

I hope you can shed some light on this matter since I think I've tried everything and it's still not working as expected.






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

Join diydrones

Email me when people reply –


  • Hi Javier,

    Many of us of DIYdrones and Ardupilot have already been through all of this with Maxbotics including lots of the same responses from them.

    If you really want to get it to work you have to put it in it's own little open on the bottom enclosure (aluminum works best because it also damps emf and RF)

    The whole thing needs to be antivibration mounted with silicone or soft rubber bushings to your air frame (away from downwash prop turbulence (really hard to find on a quad copter), but dead center can be OK in some cases.

    All power signal and power leads really need to be shielded with the shield tied to ground.

    ESCs can still produce excess RF and EMF noise, especially if they are in near proximity to the Sonar unit.

    A small aluminum cone actually attached to the sound inlet on the Sonar itself can also help in minimizing external sound and turbulence noise.

    Basically it is a losing proposition, not worth the effort and with entirely unsatisfactory results.

    I flew about 20 flights with my Sonar tweaked to the 9's with acceptable results to about 15 feet over hard ground and 10 feet over grass.

    Then I just took it off and stuck it in a box, way more trouble than it was worth.

    It sounded so good, but it was a total pain in the ass.

    Mine was a fairly large light slow quadcopter with a large area in the middle uncompromised by prop down wash.

    Problems are worse to insurmountable on copters with props that occlude the center area.

    The original Parrot used sonar somewhat successfully, but they designed their quadcopter from the ground up to incorporate it.

  • I copy here the answer from Maxbotix, in case it helps someone else:

    You state the following information: The value at which the sonar saturates it's the maximum one (7.64 m). From the picture, you can see that the copter is descending, but it has this weird spikes where it measures correct values and then it saturates.

    There are two main issues that it looks like you may be facing. A reading of maximum distance 765cm indicates the sensor could not successfully detect any target. The two main ways this could happen are that your sensor may not be sensitive enough, or that the air turbulence is scattering the acoustic wave in an erratic manner.

    What sort of terrain are you flying over? Grassy or softer terrain will be harder to detect than a more solid surface like stone or cement. The alignment of the sensor with the ground during landing is also an important factor. Testing a more sensitive sensor like the EZ3 or EZ2 version from the same line may help solve this if it truly is a sensitivity issue. As you don't see any spikes down to minimum reported distance (the sensor isn't falsely detecting a noise source on the UAV itself). It does seem that a more sensitive sensor would be a viable option.

    If this is an issue from air turbulence from powerful props, mounting the sensor as far from the prop wash would be your best bet. Turbulent air will scatter the sound waves making it harder to get a reliable detection. Using a more sensitive sensor may help with this issue as well, but it is a more difficult issue to manage.

  • Hi Javier, Laser rangefinders are not as cheap as SONARS, but the very best one for Drone use is $249.00.


    And I recommend it very highly.

    But there are cheaper ones.

    The Lidar Lite V3 which is now sold by Garmin is $150.00.


    And you can look on the Ardupilot optional hardware rangefinder page to see some more that are supported.


    I highly suggest the Lightware SF20 as it is tiny, very long range and has a high update rate.

    It has pretty phenomenal performance for a very reasonable price.

    Best Regards,


  • As a side note, which affordable rangefinder would you recommend that has been also tested with the arducopter firmware? The ones I found where around $400 - $600,which is much more expensive than all the sensors I currently have on my quads
  • Hi, I was actually one of the few who got SONAR to work - sort of.

    It is extremely subject to every kind of noise and vibration.

    Electromagnetic noise from the motors and ESCs, RFI from the radio, the physical noise of the copter itself and the vibration of the copter.

    I got it to work by isolating everything,.

    Basically at this point in time, it is simply a non-starter.

    It's range is also very limited and changes drastically depending on what kind of a surface you are over.

    I think there is still some information on Sonar (most of which I wrote) in the Arducopter wiki main index.

    Basically, ignore it and throw out the Sonar - really total garbage on a multicopter in comparison with what can be done for altitude with a laser rangefinder or even navigation with RaspPi camera systems.

    There might be some use for ground based vehicles, but even there you are so much better off with a laser rangefinder based system.

    My thoughts any way, but from a lot of hours of experience.

    Time spent learning what doesn't work.

    Best regards,


  • These tests were done landing in grass, but I'm not sure if that's the issue because some time ago I made similar attempts in concrete. Just in case, I'll do some tests in concrete tomorrow.

    Chris Anderson said:

    What kind of surface are you landing on? I've never had much success with sonar on anything but concrete. (Also prop noise can confuse it close the ground).  I only trust Lidar for accurate ranging close to the ground.  

  • 3D Robotics

    What kind of surface are you landing on? I've never had much success with sonar on anything but concrete. (Also prop noise can confuse it close the ground).  I only trust Lidar for accurate ranging close to the ground.  

This reply was deleted.


DIY Robocars via Twitter
RT @knightsautoteam: Hi @diyrobocars, we are Orlando's first Autonomous racing club and would love your support. We are hosting our first K…
DIY Robocars via Twitter
RT @Heavy02011: #VirtualRaceLeague: @DIYRobocars Race #14 - #ParkingLotNerds join us January 15th for #AutonomousRacing #RoboRace ⁦@DAVGtec…
Jan 16
DIY Robocars via Twitter
RT @chr1sa: And after that came our races, 50 in all. This battle between these two Russians was the best we've ever seen -- incredible fig…
Jan 16
DIY Robocars via Twitter
RT @chr1sa: Before our @DIYRobocars virtual race this weekend, we had a presentation from the team that won the Indy Autonomous Challenge i…
Jan 16
DIY Drones via Twitter
Dec 12, 2021
DIY Robocars via Twitter
Dec 12, 2021
DIY Robocars via Twitter
RT @chr1sa: Just a week to go before our next @DIYRobocars race at @circuitlaunch, complete with famous Brazilian BBQ. It's free, fun for k…
Dec 4, 2021
DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training https://www.youtube.com/watch?v=J5-zHNeNebQ
Nov 28, 2021
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
Nov 26, 2021
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Nov 25, 2021
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23, 2021
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord: https://discord.gg/EPsZHkg9Nx) https://t.co/PNDewvJdrb
Nov 23, 2021
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23, 2021
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20, 2021
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20, 2021
DIY Robocars via Twitter
Incredible training performance with Donkeycar https://www.youtube.com/watch?v=9yy7ASttw04
Nov 9, 2021