In this post I will explain how I have connected the Pixhawk Sonar by Maxbotix model XL-EZ0 High Performance Ultrasonic Rangefinder (MB1200 XL) on the Pixhawk autopilot
The XL-EZ0 Sonar
There are two reasons I chose this sonar.
- It was the only one in stock at the time I was looking to buy one
- I wanted a sonar that would allow me to avoid obstacles and this one had a wide enough beam to make me think it will do the job
A sonar sensor is used to measure the distance to obstacles. Even though the built in barometer can tell the altitude pretty accurately, using this with my Arducopter should give me precise altitude hold above the ground. The EZ0 has the most suitable beam width and angle to give good response over a variety of textured surfaces such as grass, and concrete, making it ideal for indoor and outdoor use.
- 42kHz Ultrasonic sensor
- Operates from 3.3V-5.5V
- High acoustic power output
- Real-time auto calibration and noise rejection
- Calibrated beam angle
- Object detection includes zero range objects
- 10Hz reading rate
- RS232 Serial Output – 9600 baud, 8-N-1
- Analog Output – (Vcc/2014) per cm
- PWM Output
- Small, light weight module
For better results it’s recommended to use shielded cable. For that I took a spare USB cable used with my phone and cut it to my desired length. As it’s recommended on the Maxbotix site you should add a power filter to remove any possible electrical noise. For that you need 100uF Capacitor and 10 ohm resistor.
After adding the power filter on the end that connects to the Sonar using 3 out of the 4 USB cable wires I took a spare 5 position DF13 connector, removed 2 out of the four wires and soldered the other 3.
I followed the below illustration for my connection and soldering.
ArduCopter Firmware and Configuration
For the Sonar to work I needed to install ArduCopter V3.2 instead of V3.1.5. For that I open Mission Planner > Initial Setup > Install Firmware and clicked Beta firmwares after which I clicked on the Quad Copter that matches my FlameWheel F450 model setup and loaded it onto the Pixhawk. (Please note that it’s not encouraged using Beta firmwares as they may contain bugs, doing so you are putting at risk your aircraft as well as people and property around where you fly it).
I then followed the instructions on the ardupilot site specifically for the Analog Sonar and AC3.2. Please also note that in mission planner 1.3.16 the Sonar setup under Initial Setup > Optional Harware > Sonar didn’t allow me to set it up so I had to go and set it up through the Config/Tuning parameters as it’s explained in the ardupilot site.
After a few flights in alt-hold mode I was happy it works but I need to do further flights and tests so when I have more observations, I will update this page.