Sonar on Pixhawk

I’ve just built my first rover and found I need to add sonar too it after it crashed into a curb.

I read somewhere that sonar isn’t working on Pixhawk. Is this true?

@Calcium_Girl,
Andrew Tridgell, our ArduRover programmer, and I got the sonar (Maxbotix MB1240) functioning on the Pixhawk during one of our code hacking hangouts.
You will need to use the Pixhawk ADC3.3v connector which means you will need a five wire cable with a five pin DF13 connector on the end.
The pin out for the cable is as follows:
1 (red) VCC +5vdc
1 (blk) ADC IN
1 (blk) GND
1 (blk) ADC IN
1 (blk) GND

This Wiki Link will help you with the Pixhawk DF13 connectors: http://rover.ardupilot.com/wiki/common-pixhawk-overview/
This section of the Wiki explains the Virtual Pins: Pixhawk analog input pins (Virtual Pin = Firmware Mapped Pin ID)

This Wiki section will show you how we added sonar to the APM: http://rover.ardupilot.com/wiki/sonar-sensors/ The concept is similar for the Pixhawk, but a little more complex

If you only want to run one Maxbotix sonar just choose one of the ADC in pins and use the PM to make you pin selection in the Sonar section of the Full Parameter List. If you want to run two sonars sequentially, like we did on the APM, the process is going to be a little more complicated as you will have to use two of the Pixhawk Aux Analog pins as digital pins to sequentially trigger the two sonars so they will not interfere with each other.

Here is a link to a tutorial on how to wire up the Maxbotix Sonar and its power filter: http://diydrones.com/profiles/blogs/sonar-quick-connector-and-power-filter

I suggest you use single pair shielded cable (similar to the old PC CDROM cables) to run the power, signal, and gnd from the Sonar to the Pixhawk DF13 five pin cable.

One observation: the sonar is not going to help at high speeds as the processor cannot react fast enough to steer away from a collision once a target is detected at a reasonable distance (200cm). It is only good at lower speeds and big targets like barrels. You will find that you need to point the sonar upwards to avoid having the beam cone see reflections from the ground at farther detection distances.

I have not used sonar on any of my rovers since winning the Sparkfun 2013 AVC Peloton Class. This year we are trying for close to a Cruise_Speed of 9m/s (~20mph) and sonar is not going to help here. Active Braking and dual GPS modules along with very accurate waypoints, in relation to the gps positions of the barrels, hoop, and ramp, are the way to win this year.

I will be glad to answer any of your questions once you have digested what I have presented above.

Regards,
TCIII ArduRover2 Developer

@Calcium_Girl,
See my Post: Install Dual Sonars on a Pixhawk.
Regards,
TCIII ArduRover2 Developer