3
\$\begingroup\$

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

\$\endgroup\$
10
  • \$\begingroup\$ These need serious calibration and need to be fitted perfectly. I used one on a 45cm diameter pipe to detect the flow rate and was dismayed by the error in the result. Contacted the tech help and was told that I was lucky to be getting a result at all in the conditions I was applying it. They are very sensitive devices, and need a lot of care in use. \$\endgroup\$
    – Solar Mike
    Jul 17, 2020 at 10:44
  • \$\begingroup\$ Is the object's size a significant portion of pipe cross-section area? Perhaps you can look for audio resonant frequency peak (resonant frequency goes down as object moves away). You might use a white-noise signal source for this, or a swept-oscillator. \$\endgroup\$
    – glen_geek
    Jul 17, 2020 at 11:00
  • 1
    \$\begingroup\$ @Hari of course the object is smaller (it's not a TARDIS) than the pipe so, answer the question. \$\endgroup\$
    – Andy aka
    Jul 17, 2020 at 11:14
  • 3
    \$\begingroup\$ That said, since the whole point of this is to measure something else and the pipe appears to only be an odd means to that end, have a look at linear encoder strip or digital calipers with a data output. \$\endgroup\$ Jul 17, 2020 at 11:52
  • 4
    \$\begingroup\$ With so little information I don't think you're going to get a useful answer except maybe by pure luck. You really need to describe what it is you are trying to do and what your requirements are. Otherwise the best answers you are going to get are things like 'try a different sensor'. \$\endgroup\$ Jul 17, 2020 at 14:57

4 Answers 4

7
\$\begingroup\$

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.

\$\endgroup\$
0
7
\$\begingroup\$

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.

\$\endgroup\$
0
5
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ I need low cost solution. And was told to use ultrasonic sensor. Is there any low cost laser sensor, then I can change the technology. Its for checking the size of the product. A pipe will have a slot, a small object with rod welded which comes out of the slot to set it to the product height, to measure the size of the product. \$\endgroup\$
    – Hari
    Jul 17, 2020 at 11:11
  • \$\begingroup\$ @Hari - Sounds like you need to step back. More detailed information belongs in your question and may very well need to include diagrams. The description you put into the comment is not possible to visualize as you have described it. \$\endgroup\$ Jul 17, 2020 at 11:17
  • \$\begingroup\$ I have added a picture in the question. \$\endgroup\$
    – Hari
    Jul 17, 2020 at 11:35
  • 1
    \$\begingroup\$ This is misleading, sound can work fine and is far more suitable. What doesn't work is the Arduino sensor meant for free space. \$\endgroup\$ Jul 17, 2020 at 11:48
2
\$\begingroup\$

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

\$\endgroup\$

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.