TransWikia.com

Measure distance using an ultrasonic sensor in a pipe

Electrical Engineering Asked by Hari on February 15, 2021

I am trying to find the distance of an object in a pipe, but I am getting wrong values using the ultrasonic sensor with an Arduino as the sound is bounced back from the surface of the pipe.

What do I need to do to get the right values?

This is the picture of what I am trying to do.
enter image description here

4 Answers

If your sensor is like the HCSR04 it generates an 8 cycle burst of a 40 kHz tone. In free air at 330 m/s the wavelength is 8 millimeters and the burst is roughly 6 centimeters long.

The signal from the receiver is amplified and some simple discriminator circuit tries to decide either when the leading edge or the maximum of the delayed and terribly distorted return burst happens.

This works fairly well in relatively free space where mostly a single reflection from an oddly shaped object is detected, but assuming that your pipe is larger than 8 millimeters in diameter it will reflect the sound many many times and each angle will produce a different delay due to it's zig-zag pattern.

A good analogy would be comparing single-mode optical fiber which works like a waveguide and can maintain absurdly high modulation frequencies over tens to hundreds of kilometers with amplification but without regeneration, to the earliest kinds of step-index multi-mode optical fiber which only worked at much lower bandwidth and that strongly depends on the distance. (The graded index MMF has much less modal dispersion than the old step-index fiber.)

What you have is an analogy of the step-index fiber with huge modal dispersion; the higher the angles of the zig-zag reflections the longer the path length and the slower the reflection. Your sharp "ping" input gets smeared out terribly with distance.

That means that the simple discriminator in your budget device is totally unprepared to receive this mess, and gives a poor result.

The other answers all provide good advice. If you can line your pipe with material that blocks acoustic reflections as recommended in @AJN's answer so that the signal propagation is more like that of a free-space situation, you may get much better results!

All is not lost!


From Graded Index or Step Index Multimode Fiber:

Graded Index or Step Index Multimode Fiber

Answered by uhoh on February 15, 2021

Ultrasound Sensors measure the distance by sending an ultrasound signal and measuring the time it takes to be reflected from the object and come back. The biggest problem are reflections inside the pipe, which can be solved using sound absorbing material inside the pipe.

Another problem is, that the speed of sound is dependent on air pressure. Even small changes, like opening a door or moving an object quickly in front of the sensor completely ruins the measurement. A much better solution is to use a time-of-flight laser-ranging sensor. They are really inexpensive these days (the VL53L0X is around $10) and give vastly better accuracy and performance.

Answered by w7sbc on February 15, 2021

I assume the pipe is only to protect the sensor from environment noise. If the pipe is not filled with anything, then just line the inside of the pipe with sheets of sponge or foam to eliminate or reduce internal reflections.

Searching the net yields results for sound proofing foam sheet

foam sheet image from efoam.co.uk

acoustic foam image from amazon.com

Images from amazon.com and efoam.co.uk (no affiliation, just top google results for me)

The principle is similar to the black paint used inside telescopes and camera lenses.

Answered by AJN on February 15, 2021

You may very well need a completely different technology than the ultrasonic. Some type of focused and targeted sensor beam reflected back from a target on the distant object may be a possibility but much depends upon the environment, what is in the pipe and just what you are trying to achieve.

It may be better to step back away from the ultrasonic problems and restate the problem in a more general way as to what you are trying to measure. When doing that you will also have to provide more detail about the environment and what is in the pipe.

Answered by Michael Karas on February 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP