Using HC-SR04 range finder with Mini Maestros

Hi folks,

just want to share how to use the HC-SR04 cheap ultrasonic range finder with the Mini Maestro servo controllers.

Brief abstract:
The HC-SR04 is used in continuous mode, one servo output is used to continuously trigger the senser with a short pulse (I use 25 ms).
As the Maestro has no timer I filter the output of the sensor through a simple RC lowpass. This signal is then read via an analog input of the maestro.

If you just need to measure the level in a water tank (signal changing very slowly) take a RC time constant of several seconds (100k 10uF or more) and take a few readings to average the remaining ripple.

However I needed distances for a moving robot so I choose 100k and 0.68uF resulting in a 68ms time constant. Then I used a script to sample the resulting sawtooth and find the minimum.

Please be aware, that you have to calibrate each sensor manually because of the big tolerances of capacitors and the non linear nature of the generated sawtooth.

I upload the quite extensive documentation as a zip file.


Herbert (510 KB)

Hello, Herbert.

Thank you so much for sharing your work. It is great to see a way to use those sensors with the Maestro. I am sure many of our forum members will find this very useful.