Measuring speed when approaching an obstacle using ultrasonic sensor is pretty trivial. Take two distance measurements, divide by time between them, you have the speed.

But a sensor aimed diagonally at the ground, in horizontal movement, will keep giving the same distance readout. The only thing changing with speed will be the reflected frequency - doppler shift of the reflected ultrasound.

Can any inexpensive, common, compact sensors perform such measurements? Or would it require "cooking my own", with frequency analysis and such?

...or maybe I'm trying to force open an open door, and there's a different, simple, compact, inexpensive solution for measuring groundspeed at a distance of a couple meters? (other than GPS; this must be able to work in terrain with poor GPS reception.)

  • \$\begingroup\$ You should read up on "Doppler effect" \$\endgroup\$ Aug 16, 2016 at 11:37
  • \$\begingroup\$ @MarcusMüller: I have a fairly good understanding of the Doppler effect. In this case, sound wave reflected off a moving object will have a different frequency upon reception, depending on relative speed of the object in relation to the emitter and sensor (in direction of approaching/departing); measuring the frequency change you can derive the relative speed. On the other hand, whole books were written on the subject... Is there anything else I need to know about it - what in particular would I need to read about? \$\endgroup\$
    – SF.
    Aug 16, 2016 at 11:44
  • \$\begingroup\$ How flat / close is the ground? It's probably completely impractical but if you have a really flat ground and can get close to it then could you use an optical computer mouse to track the ground? \$\endgroup\$
    – Andrew
    Aug 16, 2016 at 11:57
  • \$\begingroup\$ @Andrew: Flat but rough terrain (grass, rocks etc); within distance of the sensor (some 3-4m). At altitudes of >20m GPS signal will be available. The "middle ground" would be a blind spot in case GPS is unavailable. \$\endgroup\$
    – SF.
    Aug 16, 2016 at 12:10
  • \$\begingroup\$ @SF. -Andrew has a possibly workable approach. A modification is required: re-focus the lens. Mouse focus is about 1mm - too short. In practice, an external lens is needed. See my profile photo on this site? It was taken with an optical mouse (with new lens). The on-board chip calculates X-Y speed for you, available by reading I2C data registers. \$\endgroup\$
    – glen_geek
    Sep 12, 2016 at 19:07

5 Answers 5


I'm not aware of cheap ultrasound sensors that can measure the Doppler in the return signal. At the risk of answering something that isn't quite what you asked do you need ground speed or is air speed sufficient?

If you place two ultrasound sensors facing each other in line with the direction of travel and measure the range between them then you will get a measurement error proportional to the airspeed in the direction between the sensors. e.g. If measure over 1m then you would expect the ultrasound to take 1/330 = 3.03ms to arrive. (taking the speed of sound as being 330m/s for convenience). If you are traveling at 10m/s then you will get a reading of 2.94ms pining from the front to the back since the sound is traveling at 340m/s relative to your device.

This is how ultrasonic wind speed measurement systems work, the only difference is that you are measuring the airflow caused by your movement rather than the wind.

Pinging in both directions (back to front and front to back) and taking the difference between the two allows you to compensate for temperature effects and separation measurement errors.

Of course this all falls apart if your environment has significant wind in comparison to your velocity or if you place the sensors somewhere where the air flow around them isn't representative of your speed.


maybe I'm trying to force open an open door, and there's a different, simple, compact, inexpensive solution for measuring groundspeed at a distance of a couple meters?

I don't know how cheap the cheapest one is (or what inexpensive means in real numbers) but maybe a laser surface velocimeter might be a useful method.

enter image description here

  • \$\begingroup\$ I've seen this used in a helicopter (real 'full-size' one, not a 'drone') with reasonably good results. \$\endgroup\$
    – brhans
    Aug 16, 2016 at 12:45
  • \$\begingroup\$ That sounds quite nice but... expensive. A camera able to observe particles moving across the laser dot? The optics alone may set the price bar quite high. \$\endgroup\$
    – SF.
    Aug 17, 2016 at 10:42

Ultrasound is an audio signal like any other, so relative movement can be detected using "normal" sonar methods.

Now, Andrew mentioned that

I'm not aware of cheap ultrasound sensors that can measure the Doppler in the return signal.

Neither am I, but:

Producing ultrasound is no rocket science.

In fact, there's plenty of >= 40 kHz "audio" actuators readily available on the market, and most of them double as sensors (transducers), for less than 10€.

PC/Raspberry-pi-style-computer-based method

You could easily produce a working transmit tone (e.g. by using a sound card to produce a 5 kHz tone, and by adding harmonics through nonlinear amplification, simply by feeding that signal to a bipolar transistor, and then filtering out everything but the 3rd order overtone, i.e. 8 times the original 5 kHz == 40 kHz), amplify that tone sufficiently much to drive your transmitter, receive the reflection with another ultrasonic transducer) and use an ADC (e.g. a soundcard again) with removed anti-aliasing filter, so that the 40 kHz +- Doppler Shift end up being aliased. Undersampling! Simply multiply in your PC with the "original" 40 kHz (account for the fact that this tone aliases, too), and you should see the Doppler frequency shift as tone. Done!

microcontroller-based method

If you don't want to use a PC, but rather do everything with microcontrollers, things can even get easier, as producing a 40 kHz square wave can usually be done with a simple PWM unit, and that square wave can be filtered to a sine simply by a very easy RC low pass with a cutoff somewhere between 40 and 80 kHz. Use that sine both on your transmitter and on one of the mixing inputs of a SA612 mixer IC. Connect the other mixing input to your amplified received signal; filter the output of the SA612 to remove DC offset (easy - coupling capacitor) and frequencies above the doppler shift you'd expect.

Now all you'll have to do is to determine the frequency of the mixer's output. That can be done by specialized ICs that convert frequency to voltage (e.g. LM2907) and ADC'ing that, or simply by using a comparator (or equivalently used opamp) to convert the sinusoidal output of the mixer to a logic signal, and using the microcontroller to count the edges in a given time window (in fact, many microcontrollers have extended PWM features that do just that in hardware – no programming/CPU cycle overhead).

Also note that it might be beneficial to not use the exact same frequency for transmission as for mixing – if you use something different, you'll get your "undopplered" response somewhere else than DC, and will have an easier time telling positive and negative Doppler shifts apart. You'd be building a superheterodyne receiver, by the way.

All that's left to be done is converting frequency estimate to speed estimate. That's simple math.


You complicate things by "looking diagonally". Looking diagonally can still be separated into a vertical and horizontal component.

The vertical part will give you height and (using doppler) can give you speed (in the vertical plane) so ascend and descend speed.

The horizontal part gives you nothing unless you are about to fly into a wall, then you can measure distance and speed just before you crash into it.

If the ground is completely flat (no walls etc) there's no way to detect at what speed related to the ground you're going. If the ground does have features (walls, bumps etc) then some doppler shift can occur and in theory you could use that. I am unsure how cheap ultrasound sensors cope with that. I'd guess they are unsuitable unless you do advanced signal processing on the reflected signal (to filter out the information you want, I'm thinking complex FFT algorithms as used for radar).

  • \$\begingroup\$ The ground isn't completely flat - it's rough. It's not like the waves can slip over the surface before reflecting back - sure the reflection would be much weaker than from a wall, but it would still be present. Of course a sensor pointing directly down, for altitude and vertical speed measurement would be present, to provide the vertical component which can then be substracted. \$\endgroup\$
    – SF.
    Aug 16, 2016 at 12:13

How about a pitot tube airspeed sensor ?

Fairly expensive although there are RC hobby variants that are a bit more affordable.

Don't work as well at low speed or on multicopters though.

Edit: Maybe disregard as that is airspeed not groundspeed.

  • \$\begingroup\$ Airspeed with pitot tubes is not a problem. Barometer chips are cheap, especially if instead of a dedicated differential one I use multiple absolute ones turned directionally (with central one protected, e.g. by a piece of sponge from wind), and calibrate their readouts on the ground to account for inherent unit-to-unit differences. The problem is exactly the difference of wind and airspeed; 2m/s wind is nothing uncommon and enough to totally rain all over my parade during autonomous landing. \$\endgroup\$
    – SF.
    Aug 16, 2016 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.