Is it possible to use ultrasound sensor like this: http://www.uugear.com/?product=hc-sr04-ultrasound-sensor along navio+ on raspberry pi?
That’s a nice cheap sensor, but needs 2 control lines. So I guess that’s either 2 ADC ports (one sensor in total) or two Navio PWM/servo connectors per sensor. Sounds too complicated then, unless there is some kind of driver chip which you could connect in-between to provide a more flexible connection like I2C. The other problem is the built-in APM range/sonar support only appears to allow you to connect two. Also search the APM Rover documentation and forums to see what they do, because these style of sensors are more common on those.
If all you want is altitude hold then this is the answer:
MaxBotix wrote a nice article which explains the difficulties and tips for installing sonar sensors (applies to all) with best performance:
After reading that, I gess if you want full surround collision detection then you’ll need a frame with sensors at the end of the arms on anti-vibration mounts, or on the edge of propeller ducts (like a UFO) to get around the prop wash problem. Actually that would look quite cool if it worked!
Along these lines, I’m waiting for the follow-up video of Bruce from RC Model Reviews who is currently investigating the potential for efficiency increase with propeller ducts, but current discussions suggest that are negative side effects of such designs.
Anyway, the APM documentation is here:
Unfortunately nothing appears to be documented about multiple sensors, just in the full parameter list:
Navio on the other hand, has a full operating system and plenty of on-board and standard Raspberry Pi connectivity options. So you could just create a background application in the OS and have that do the range finding with as many sensors as you can physically connect (13 PWM - # of motors/servos needed to fly or dozens via I2C). Communication between the background app and APM would of course be via a local MAVLink proxy.
Well that’s the theory anyway so far as I understand it. It’s something I’m hoping to turn into experience soon. So anybody who knows better please correct me.
The HC-SR04 requires a 10 us pulse to start the echo. I don’t think ADC can provide that pulse. But I think we can listen for the echo using ADC. Using GPIO to provide the pulse would be easiest, but I have a telemetry link, so the UART port is not an option, regardless of whether it’s being used by telemetry or not. There are no other GPIO pins available. So, I am trying to get PWM to deliver that pulse, but it’s giving me problems. Is there any good way to use i2c with the HC-SR04?
Hello @joseph.chai !
HC-SR04 is not an I2C sensor. Also, HC-SR04 not uses PWM too.
But I think you can use special modules for connect HC-SR04 by I2C. I hope it helps