The Pixhawk can receive info from two analog sonar sensors, which you can use to aid in an indoor "altitude hold" mode or for checking distance from a wall. Check out the ArduPilot page on wiring and configuring sonar sensors to the Pixhawk and Mission Planner.

These sensors are sensitive to interference caused by the quadcopter's motors. To cut down on interference, a special cable must be made! In addition to one of the MaxBotix sensors suggested in the ArduPilot guide, you will need:

Strip and tin the three wires, joining the shielding to the black ground wire and attaching the resistor at the end of the red power lead. Slide a small piece of heat shrink over the resistor and its wire connection.

Insert black to ground, the power-line resistor to V+, and the white signal wire to the sensor's analog out.

Before soldering, also insert the capacitor between power and ground, making sure the long leg goes to ground.

Solder the other ends of the wires to correspond with the pins on the 5-connector plug on the Pixhawk and of the cable according to this diagram from the ardupilot site:

Although we did get sonar signals coming into the Pixhawk, we did not get so far as to use them to successfully control the autopilot for IRIS+ for this project-- perhaps you can pick up where we left off!

This guide was first published on Jun 05, 2015. It was last updated on Jun 05, 2015.
This page (Sonar sensor cables) was last updated on Sep 14, 2020.