Ultrasonic Measurement

Hello,

I am pretty new to arduino and c++ programming. I am using two HC-SR04 sensors (one in the front and one in the back) and I am using them to measure distance. The box they are in is mounted to a servo that uses two tilt switches to always keep it level with the ground or measuring surface. The sketch takes a measurement each way and then also adds the distance between them in the box enclosure and the only number that is printed on the LCD screen is the final distance in inches. It works great and is fairly accurate when measuring say between two walls or between two large objects. The servo and tilt switches makes sure it is always measuring straight for better accuracy. I have a delay between when the two sensors take a reading in hopes that they will not interfere with each others "ghost signals". The problem I have is that when I stick this inside a 5 gallon bucket and I am trying to measure the inside diameter and I know it is exactly 11" I will get all kinds of weird readings. How can I make it more accurate while measuring the inside diameter of a round object. Maybe narrow the beam? Put some kind or PVC pipe on the receiver side? Any ideas would be greatly appreciated.

Thanks a lot.

Change sensor to IR.

Hi Steelcity,

As Magician says, you can change the sensor type to an IR sensor, but the ones I've used aren't linear and require some fancy coding. ... And I don't think they work over greater distances, if you want to measure the distance between distant walls.

The problem might be that the distance is too small to measure. One ultrasonic sensor I've used wont work with objects any closer than 12", so putting it in a bucket would not work. Have you tested the minimum measured distance? I'm not familiar with the one you selected.

I've used PING))) sensors at close range. They work at close ranges.

Pat.

You may be taking readings too frequently, i.e. starting a new reading before the echoes from the previous ping have faded away.