distance measurement

Hi i want to measure the distance to an opaque surface with a range of 0mm to 3000mm and with a precision of ±10mm i’d like to know which sensor can i use for that application.
Thanks

Most ultrasonic sensors will work out to 3 m or more, with +/- 1 cm precision/accuracy.

What he said. ^ As long as it's a hard surface, and at about 90 degrees with respect to the sensing direction.
A cheap HC-SR04 sensor would be fine for this. (Available very cheaply on eBay.)

And to improve reliability, a library such as "NewPing" could be used. It has a 'ping_median' method that allows averaging a number of readings, default 5, but you can set this value.

Ultrasonic sensors have a minimum usable range of several cm due to hardware limitations.
For short range sensing you'll need to use capacitive or inductive sensing.
To get the full range you'll probably need to use multiple sensor types.

mikb55:
Ultrasonic sensors have a minimum usable range of several cm due to hardware limitations.
For short range sensing you'll need to use capacitive or inductive sensing.
To get the full range you'll probably need to use multiple sensor types.

True. I somehow overlooked the "0mm" bit. The claimed range for a HC-SR04 is 20mm to 4000mm. I haven't tested at that close a range though, only to about 100mm.

I don't know if an inexpensive ultrasound can measure with 1 cm accuracy but I'm pretty sure Maxbotix ultrasounds can. I think Parallax's Ping can do 1 cm accuracy pretty well. None of the ultrasound sensors I know of can measure very short distances. Of course if the sensor is just moved back a bit this shouldn't be a problem.

If ultrasound can't do the job, there are laser range finders (probably) capable of this sort of resolution.

Here's a link to a video I made compare two different types of rangefinders. Here's a link to the thread where I discuss some of the details.

I once experimented with a Ping ultrasound sensor. I had the sensor on the table pointing at the ceiling. I recall measuring the distance between sensor and the ceiling with a tape measure and I found the sensor readings dead on.

The speed of sound is affected by temperature. The effect from temperature is not likely to matter enough for most applications. However to get the most accurate measurements, especially at distances over a meter, adjusting for the temperature is a good idea. Here's a thread where I shared a code which uses temperature in the calculation of distance. The code was written in Spin for the Propeller microcontroller but the equations would be easy to add to an Arduino program.