0
\$\begingroup\$

How does an ultrasonic distance sensor work?

My thoughts:

A microcontroller (Arduino nano) sends a signal to an amplifier that makes it into a 40kHz pulse, which then goes to the transmitter which sends it out. After some time the receiver get the pulse, where it runs it though an op amp (because of the loss in air?) and then sends it back to the Arduino.

If this is true, how does the Arduino / microcontroller convert this information into time?

\$\endgroup\$
  • \$\begingroup\$ "Some time" is linearly related to how far away the object reflected off with. \$\endgroup\$ – Scott Seidman Feb 28 at 11:57
  • \$\begingroup\$ How about watching some tutorials? For instance howtomechatronics.com/tutorials/arduino/… > how does the Arduino / microcontroller convert this information into time? With the sensor from the example above: Using an edge sensitive timer: Start counting when the rising edge occurs and stop at falling edge. <br> \$\endgroup\$ – mic Feb 28 at 12:08
  • \$\begingroup\$ Try reading this document from NXP. It explains how it works, and gives flow charts and program code for a specific microprocessor. Once you've got some idea what is going on, you can ask better questions about the details of how it works - and use the diagrams to illustrate the points you need help with. \$\endgroup\$ – JRE Feb 28 at 12:25
0
\$\begingroup\$

Some US sensors send a continuous sinus signal, that is therefore reflected and received by US sensor. Due to the fact, that signal needs some time to travel, the received sinus will be phase-shifted.

enter image description here

Consider red sine wave as transmitted signal and blue sine wave as received. They are shifted related to each other.
This phase-shift can be computed using autocorrelation.

Other sensors may send single pulses and then calculate the difference between transmitted and received time. Then the distance can be computed as follows:

enter image description here

where v is the speed of sound. Computed distance is divided by 2 because the sound had to travel from the sensor to the object and then back from the object to the sensor.

\$\endgroup\$
  • 4
    \$\begingroup\$ The first part of your answer is way oversimplified. CW ultrasound, like CW radar, frequency-modulates the signal. The phase analysis is done on the modulation, not the carrier. Remember, the wavelength of 40 kHz sound in air is less than a centimeter! \$\endgroup\$ – Dave Tweed Feb 28 at 13:07
  • \$\begingroup\$ @DaveTweed Even if it is not CW, you would still send a chirp, since it reduces the required power output quite significantly due to the bandwidth compression. \$\endgroup\$ – user110971 Aug 3 at 16:14
  • \$\begingroup\$ @user110971: Not necessarily. Low-cost ultrasound distance sensors wouldn't want to invest in the hardware required to process a chirp. You may be thinking of radar, where this is much more common. \$\endgroup\$ – Dave Tweed Aug 3 at 19:03
  • \$\begingroup\$ @DaveTweed Yeah, I was thinking about radar. But you don’t need extra hardware to process the chirp. Just a simple ADC / DAC can be used. It does require extra engineering effort though. \$\endgroup\$ – user110971 Aug 3 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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