1
\$\begingroup\$

I need to measure the distance to an unknown object, which can be made out of any material. The solution should be low-cost, so I assumed using a HC-SR04 sensor would be a good choice.

Would an ultrasonic sensor like that be able to measure the distance to any object accurately (with a maximum error of 1cm) without knowing what material that object is made out of?

The distance I have to measure is approximately a range of 0-0.5m.

As an alternative, I could possibly also settle for the ability to detect if an object is present between the sensor and a known background pane for example. Measuring the distance would be preferable, but that might also work.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Short answer: Probably not. Any material that absorbs the ultrasound or any object that is not hard, flat and perpendicular to the transmitter will not give accurate results. You might consider an infrared proximity sensor if the range is suitable. \$\endgroup\$ – Roger Rowland Jul 12 '16 at 7:27
  • 1
    \$\begingroup\$ "Any material" is the obvious killer for this idea. \$\endgroup\$ – Andy aka Jul 12 '16 at 8:30
  • \$\begingroup\$ Is there an alternative type of low-cost sensor, which might be better suited for the project? The infrared proximity sensor seems interesting, the problem is that the material could also be transparent. Like clear PVC for example. \$\endgroup\$ – FHannes Jul 12 '16 at 8:39
  • \$\begingroup\$ @FHannes I think you need to tighten up your specification. You have not mentioned the range of distances required, only the maximum error (1cm). Also, as Andy said, any material is a bit too much to expect for a single sensor type. \$\endgroup\$ – Roger Rowland Jul 12 '16 at 8:58
  • \$\begingroup\$ I have added the range to the question. I believe it should be less than 0.5m in distance. \$\endgroup\$ – FHannes Jul 12 '16 at 9:10
2
\$\begingroup\$

Short answer:

Probably not.

Long answer:

Ultrasonic sensors are very sensive to the shape and surface of the object distance to which is being measured. If the surface is relatively flat and very large (book, wall etc.) and is parallel to the sensor lineup you could have some good results after calibration and taking the average of many measurements. However not even then an error of 1cm or less can be expected at all times on a distance of 50cm. Additionally, if your surface if uneven with irregularities of +-1cm or so, you will have additional fault introduced. From my experience you will have hard time implementing a system of this precision cheaply using ultra-sound. My advice would be to lower the expectations of the precision of the system. You could also try out some cheap infra-red sensors, they can be more accurate under some circumstances.

A general hint is that the object you want to measure the distance to should have a decent area exposed to the sensor. At a distance of 50cm using a cheap sensor we are talking at least 5-10 centimeters or more in order to get any reasonable reading.

\$\endgroup\$
4
  • \$\begingroup\$ How about my alternative. Could that be implemented at reasonable cost? For example, a low-power laser diode + light sensor to detect if an object is present in between the two? \$\endgroup\$ – FHannes Jul 12 '16 at 9:49
  • \$\begingroup\$ To detect an object is a much easier task. You just need to look for a deviation in your measurement data. For that, cheap ultrasound/IR or other methods are just fine, assuming your object is thicker than a couple of centimetres. Laser setup is certainly possible as well. All in all this completely depends on where the sensors can be placed, how the object looks and maybe some other factors inroduced by the environment. \$\endgroup\$ – NoobPointerException Jul 12 '16 at 10:06
  • \$\begingroup\$ Switching to the method does alter the setup slightly. Essentially I still need to measure the distance to the object, but I can loosen the accuracy constraints. So I'm thinking I can sample from the side rather than the front in like 2-3 places to see if the object is present at those locations. I always know where the object begins, so knowing that, such a method might allow me to get a rough estimate of where it ends. The only problem is figuring out what sort of sensors to use. It should be low-cost. But I'll need multiple ones, so using the diode/light might be cheaper than alternatives? \$\endgroup\$ – FHannes Jul 12 '16 at 10:12
  • \$\begingroup\$ A quick google search gave me very mixed results regarding Laser Diode price. System price however further depends on what controler you want to use and many other things. How many systems you will need, quality, working conditions and so on. I would say that you probably will not save a lot of money on buying the diode setup if you are making one system. Not knowing much about your setup i'd say go for IR. \$\endgroup\$ – NoobPointerException Jul 12 '16 at 10:29
1
\$\begingroup\$

Using multiple ultrasound sensors might minimize the error rates and compensate by taking measurements from different angles with respect to the surface of the object. Overall it will be better than a single sensor. And as for your alternative solution, it is definitely easier to achieve results because reflections are from the background with fixed perpendicular position, if you put an object between, intensity of the reflection will fall and that is easy to detect unless background is not very big compared to the object

\$\endgroup\$
1
  • \$\begingroup\$ The angles at which I can take measurements if I go with the original plan would be fairly limited, as the hardware could have to be constrained to a small box in a single plane. But using multiple sensors might indeed improve my odds of getting an accurate reading. Worst case it can be off by a bit, but a rough estimate of the distance is definitely required. This idea might warrant some experimentation. But I'll have to check if I have multiple sensors lying around. \$\endgroup\$ – FHannes Jul 12 '16 at 12:14

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.