Sonar protocol and compatibility

I have an ultrasonic sensor SR04

 

$%28KGrHqJ,%21j%21E2KsrSTrGBNlKf9UMSw%7E%7E_12.JPG

 

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 ?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

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.

    albuckley / ALX_HC-SR04_pixhawk / wiki / Home — Bitbucket
  • If you've got a spare Atmega328 with an Arduino bootloader lying around, you could theoretically program it to deal with the sonar logic, airwire it to the SR04 (with a few additional components) and fix it in place with some hotglue. It would still be cheaper than a Maxbotix and probably more fun.

    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

This reply was deleted.

Activity