Electronic – arduino – Measure distance using an ultrasonic sensor in a pipe

arduinorange-detectorsensorultrasound

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

Best Answer

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.