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.