I have an ultrasonic sensor SR04
the way it works is: you send a pulse on the leg, then it will send 8 ultrasonic waves, wait for echo, and then output a pulse on the same leg, the length of the pulse defines the distance measurement.
(you see trig and echo legs, but it can use one leg as both functions)
my question is - can i use this sensor for the arducopter ?
do all arducopter-official sonars works with the same protocol ?
Replies
I have solved this problem using an Arduino (Nano in my case) and made the project available on Bitbucket:
https://bitbucket.org/albuckley/alx_hc-sr04_pixhawk/wiki/Home
The system expects to see an analog voltage representing the distance on the ADC3.3 port. The Arduino does not produce true analogue output, it is PWM. As described n my solution, all that is required is a bridge circuit to transform the signal to DC and step the voltage down. It is easy, code provided along with instructions.
It is plug and play at that point with arducopter, just have to find your calibration gain value in the parameter config of your favorite ground station.
However, you'd need some additional components to get a true analog output from it.
OTOH, you could use it to output the ranging value via I2C (and daisy-chain it with the magneto, then modify the arducopter/ardupirates code).
you can't use this without extra components on arducopter, it eats too much processing power
the maxbotix sonar (which is recommended) gives out a analog value for the distance measured