As part of a larger project to utilize my drone at fairly low altitudes I needed a distance sensor. Thanks to Seeed Studio I had an inexpensive option on hand (and a spare for later).
The Ultrasonic Ranger v2.0 is an equivalent to the SRF05 distance sensors, but meant to use a single pin for both the trigger and signal. To trigger a measurement you pull the signal line high for 10us. After that, switch the pin to read and Meade the return pulse. This complicated things slightly since I couldn’t convince the FMU to use the pin as both input and output reliably, I needed another plan.
Luckily, there is a Garmin sensor that had the same design. The solution is to use a Trigger pin with a 450ohm resister between it and the Signal connection. This lets it isolate enough the return pulse is detected.
One custom wiring harness later (with 2 1K ohm resistors in parallel so I didn’t wait for more pieces) and it was up and running. Sort of.
If you try this with the built in SRF05 driver for PX4 Autopilot you may only get one reading, then lots of errors. Check with this from the PX4 CLI by running listener
distance_sensor
and see how long since the last measurement.
This is because of the timing used by the old driver. I wrote a fix though. Until it’s included in Main you’ll need to use the fork listed below.
To use it, you’ll need to run make (FMU name) menuconfig
and include Distance Sensor> usonicv2
then build and upload.
After the upload you can enable the new sensor through QGroundControl. Search for the parameter usonicv2_enable
and set it to 1
I’ll try and write a walkthru of this later but the PX4 user guide has lots of information on compiling for your flight controller
Update Great Timing! The PX4 channel just posted a new walkthrough about building and uploading.
Comments
Please log in or sign up to comment.