I'm working on a solution for this. The current MaxsonarXL implementation uses a generic analog source reader with a default median filter. The interface returns centimeters, so a simple wrapper around i.e. the New-Ping library might work, but I'm worried about the delay of measurement and how it might effect the control loop. To get around this I'm building a simple integrator circuit to convert the pulse width from the HC-SR04 into a voltage. This requires an extra pin to clear the voltage between readings, but if it works then it will just be another implementation of the AP_RangeFinder interface.
though that design is based on components I had on hand, it really should have a (forward bias) diode between the source and the pull down transistor, and the signal would be much cleaner with a FET. And the transistor's base should be the "clear" pin. And adding a timer and a buffer would make the functionality very similar to the maxsonar devices.
... it's a work in progress ^_^;;
Integrator for HC-SR04 UltraSonic Range Finder
Integrator for simple DtoA conversion from a particular digital PWM device.
Replies
also, this deserves a cross reference here I think:
http://www.multiwii.com/forum/viewtopic.php?f=7&t=1033&star...
I'm working on a solution for this. The current MaxsonarXL implementation uses a generic analog source reader with a default median filter. The interface returns centimeters, so a simple wrapper around i.e. the New-Ping library might work, but I'm worried about the delay of measurement and how it might effect the control loop. To get around this I'm building a simple integrator circuit to convert the pulse width from the HC-SR04 into a voltage. This requires an extra pin to clear the voltage between readings, but if it works then it will just be another implementation of the AP_RangeFinder interface.
My first design gives a signal between ~.3V and 3.3V out to about four meters https://www.circuitlab.com/circuit/4etd6v/integrator-for-hc-sr04-ul...
though that design is based on components I had on hand, it really should have a (forward bias) diode between the source and the pull down transistor, and the signal would be much cleaner with a FET. And the transistor's base should be the "clear" pin. And adding a timer and a buffer would make the functionality very similar to the maxsonar devices.
... it's a work in progress ^_^;;