Rangefinder problem

I am trying out one of the new (cheap) sonar units based on the SR04 ultrasonic unit that have started to appear on e-bay etc

I have connected the unit and set it up as per instructions and on the bench it seems to perform reasonably accurately (up to 5 metres)

However when I fly with the quadcopter it does not hold altitude in either loiter or altitude hold modes. In fact the vertical stability is much worse with the sonar than without.

I have downloaded the logs and compared barometric altitude with sonar and the sonar altitude never shows an altitude higher than about 0.45 metres.

I am about to add some filtering to reduce noise but was wondering if anyone could suggest why the sonar never shows above 0.45 metres in flight when it works well on the ground (no motors running etc.) up to 5 metres.


I’m looking to do the same with the cheapo SR04 sonar and did some reading.

Apparently the sensors are sensitive to all sorts of things on a copter.
Motor vibrations, prop wash, prop sounds and flight sounds.

I read that it is recommended to enclose the sensor in a “can” lined with foam and to use a vibration mounting of the sensor unit.

That should reduce the interference and improve sensitivity and range of the sensor.

There also seems to be a rangefinder max distance setting that should be set to around 60% of the Sensors range.
I thought those sensors were rated for ~3 meters so I would try that setting at 1.8 meters to start and then adjust upwards if you find you are getting good readings.

I’m awaiting my APM 2.8 from China still but would like to know how your testing went, so post an update if you dont mind.

Its good to know the SR04 works at all. What pins did you use on the SR04?


Hi Ray

I’ve just wrapped each sensor in foam projecting about 1cm below the cans as a trial and ordered the components to make up a filtered lead.
Should know in a few days if it improves things and will let you know


The sr04 I used included an interface board that converts signal to same as the maxbotix ez0 so it just connects to the first analogue input pin via a standard male to male servo lead.
I’m making g a filter lead up using shielded cable and 10 ohm resistor in line and 100 microohm capacitor to remove electrical spikes as suggested

Regards Roger

I analyzed your flight log with the APM log analyzer and see that you are having vibration issues.
Those vibrations could also be effecting the sonar according to what I have read.

It will be interesting to see how much difference it makes, once you have all your fixes in place.

Looking forward to getting the APM mounted on my Quad. It has a Crius SE Multiwii so it ought to be night and day difference moving up to APM 2.8 even though its not the latest/greatest.


Components arrived today
Lead and vibration damping done (hopefully).
Flight trials tomorrow, will post results

Any luck with the Sonar rangefinder.

Got my APM 2.8 in and will be digging up the rangefinder to try it out on the bench.