Servers by jDrones

Sonar Not Working- Quad AC3.2.1 - APM2.6 - MB1240 EZ4

Hi I’m Josh! I have a 250mm quad. I’m using an APM(ardupilot microcontroller) 2.6 with AC(arducopter) 3.2.1 and MP(mission planner) 1.3.30 built 1.1.5648.36304
I have the Maxbotix MB1240 EZ4 sonar mounted on the bottom out of prop wash. I have a 220microfarad cap from the APM power line to ground to smooth voltage fluctuations. I have sonar plugged into Pin 0 of the APM right next to the cap on the power pins of pin 1. My copter flys somewhat smoothly but I need to reduce the roll PID below program minimums to iron out some roll oscillation but I just haven’t yet because I have to change some code to do it I think and the quad is very flyable.

My Question:

If sonar works and gives me distances which make sense while plugged in via USB to MP then why won’t it work in ALTHOLD? I have tried gains between 2 and 0.2 and there is no change in my altitude. The quadcopter doesn’t hold it’s altitude it drifts up and down, differently then when out of althold mode and control is full manual. It seems to have a lot of deadstick in the middle. I think I have gain trouble but reviewing the log shows me a lot of noise and dead signal then a lot of noise again. Most of my tests have been between 0-20 feet off the ground over dirt, 3-4 inch grass, and concrete with no change in behavior.

Please help!

What does 4 slow loop lines found, max 7.40% on line 21573 mean? is it related?

Extra Info:
Under MP - Initial Setup - Optional Hardware - Sonar:
I have Analog selected and the distance measures correctly when referenced to a meter stick. Lower voltage equals lower distances.

Under MP - Config/Tuning - Full Parameter List - RNGFND_…
RNGFND_FUNCTION = 0 (linear)
RNGFND_GAIN = 0.2
RNGFND_MAX_CM = 700
RNGFND_MIN_CM = 20
RNGFND_OFFSET = 0
RNGFND_PIN = 0
RNGFND_RMETRIC = 1
RNGFND_SCALING = 2.04 (meters/Volt)
RNGFND_SETTLE_MS = 0 (milliseconds)
RNGFND_STOP_PIN = -1
RNGFND_TYPE = 1 (analog)

Hi Josh, old topic, but did you ever resolve this? Having the same issue here…

No, sorry. I tried many things but never got it to work. It was reading back the distance values but flight was never affected by the values. I mapped a channel on the remote to the control used to change the response to sonar distance but it could never hold the altitude and would always sink down and bounce on the ground. I’ve forgotten most of the details.

Funny, tried exactly the same and got exactly the same behaviour. Mission Planner shows quite stable distance values (i.e. readings are within 1 cm or 3/8") but Alt Hold does actually a worse job than without the sonar. Also tried to modify the Alt Hold P value in similar manner but again to no avail. I think I give up… Thanks anyway for your quick reply!

same problem here. spend around 2k for getting MB1240 ( got 2 Numbers). i consulted a professional guy in drone field for solving, it seems like the new firmware withdrawn the support for sonar rangefinders. only lidar will work from now… so keep the rangefinder as a metaphor of old golden days of affordability.

Hello.
If you are using an can you tell the firmware?

Hello
I’m change parameter RNGFND_PIN = 11
I don’t know why sonar Operation
Press Ctrl+F and press Proximity to see if it works.
I hope you have good results.

Servers by jDrones