Dual MaxSonar MB1240 with a APM 2.6

I was able to get a single sonar working perfect but when I tried to add another one I ran into trouble. Is there a way to test or show the results of the other sonar with Tuning. It seemed that there isn’t an option for sonar range 2. I also tried to follow the setup for dual sonar sensors but the stop doesn’t have an option to set the output for an APM pin. RNGFND_STOP_PIN. So I set them both to 1. Is this the correct way to set them?

RNGFND_STOP_PIN = 1
RNGFND2_STOP_PIN = 1

I am using MP 1.3.34
ArduRover V2.50
It doesn’t seem like a lot of users are using the APM any more.
Any help would be great.
Thanks

@BJS Power Wheels,
It has been so long since I used an APM2.6/5 with the analog sonars that it is hard to remember how I had them attached to the APM.
If the two sonars are both facing forward then you will have to trigger them sequentially to avoid having them see each other.
You might try this:
Sonar 1 on A0
Sonar 2 on A1
Sonar 1 trigger on A2
Sonar 2 trigger on A3

Per the Maxbotix data sheet for the MB1240:
Pin 4-RX– This pin is internally pulled high. The XL-MaxSonar-EZ sensors will continually measure range and output if the pin is left unconnected or held high. If held low then it will stop ranging. Bring high 20uS or more for range reading.
The two triggers from the Pixhawk will go to each sonar’s Pin 4-RX respectively.

Also, look at this discussion thread which is a bit dated as to the parameter terminology: http://ardupilot.com/forum/viewtopic.php?f=36&t=8124
Regards,
TCIII AVD

I have my sonar set up that way.
I looked at the link there and they have a command

BRD_PWM_CNT 0 (Makes all the Aux Servo pins digital)

I could not find that in the list.

I also can’t find a way to set Sonar Stop Pin. they have theres set to 53 and 54 but for the APM I can’t find a way to set them to pin A2 and A3. There isn’t an option for it.
Thanks for the help.

@BJS Power Wheels,
I finally found where I described the Maxbotix MB1240 sonar connections to my APM2.6/5:

I had my left sonar on A0 and my right sonar on A2. I use A1 to trigger the left sonar and A3 to trigger the right sonar. When you are using two sonars it is best to trigger them at 50ms intervals to avoid them seeing each other.

Unlike the Pixhawk firmware where the Aux Servo outputs must be defined by the BRD_PWM_CNT parameter, I believe that the APM2.6/5 rover firmware sets the Ax pins used for the trigger pulses to be digital outputs.

Have you followed the Maxbotix recommendation for power filtering the sonars and for using a shielded cable to connect the sonar output to the APMs input?

Regards,
TCIII AVD

How did you set the pins for the trigger?
I understand the hardware side but not the software side.
I have not found a way to pick or set what pins are the triggers?

I wonder if they are not supporting 2 sonars with ArduRover V2.50 and the APM?

Thanks again for your help on this.

I found it.
If you get out of the program and look at the list on the internet site it shows you the other options.
Thanks again for working with me on this.

Ok I didn’t.
I thought I found a list that shows how to set the stop pin but that was the rangefinder pin.
Anybody know how to set the Stop pin with an APM.
Thanks

I just used this discussion to get my ArduRover 2.5 with APM 2.6 working with dual MaxSonar MB1240. The key piece of info above seems to be that the APM 2.6 rover firmware automatically sets the A0 to A8 pins used for the trigger pulses to be digital outputs. This is automatic depending on what number is entered in the parameters. Enter 0 to 8 for analog inputs and enter 54 to 62 for digital outputs. Don’t need to use the BRD_PWM_CNT parameter.

This is discussed on the page http://ardupilot.org/rover/docs/common-apm25-and-26-overview.html#common-apm25-and-26-overview

In the example above from @TCIII,
try this as it worked for me:
Sonar 1 on A0
Sonar 2 on A1
Sonar 1 trigger on 56
Sonar 2 trigger on 57

@Phil,
This configuration worked in earlier versions of ArduRover firmware (~v2.48 or earlier), but might be broken now?
Regards,
TCIII AVD

This works fine for my ArduRover 2.5 with APM 2.6 on a cleared area where I have put obstacles in the path I set up in mission planner. However… I am finding that the sonar is sensitive to pieces of grass sticking up, ground sloping up in front and maybe even wind gusts (maybe dust blown up?) and after trying to turn away a few times the rover just stops moving. Therefore I can only use it in a nice controlled area, not just following any a path I have set around the farm.

I need to lift the sonar up higher and longer term I will try lidar. Happy to follow any suggestions on the best obstacle avoidance sensor to use outdoors. I would also like to look into automatically reversing the Rover and trying again and working out why I cant take back manual control after it is confused.

Regards, Phil

@Phil,
I also experienced the same issues with my sonar setup when using it outdoors.
Based on the spread of the sonar cone in the vertical axis, I angled my sonars up at maybe 5 - 10 degrees to keep ground reflections from inducing false returns.
I eventually abandoned the acoustic sonar because it was only good at responding to objects when the rover speed was at 3 m/s or less. At higher speeds it could not respond fast enough to avoid objects in the rover’s path.
Regards,
TCIII AVD

can you tell me how your single sonar is working?? because i’m using maxbotix MAB 1200 EZ0 sonar with apm 2.6 and it is showing values in misssion planner but when i fly quadcopter it uses barometer instead of sonar.