Small distance sensor

What type of sensor can measure distances less than 1 inch? I'd like at least 20 steps as it moves from 1/4" to 1". It should work when there is ambient light. What is the accuracy of the common sonar sensors in this close range?

Can't you use a mechanical one (potentiometer, spring, kind of lever)? Commonly used ultrasonic sensors don't work in that range and are by far not accurate enough (at 40kHz best you get is about 1cm/0.4" in theory, practically it's over 1").

Sometimes the most obvious answer is best, but this will not have the Wow I'm looking for. Can anyone think of another solution?

Can you attach a small magnet, and use a hall sensor?

40kHz in air is around 8.5mm. Phase comparison?

@AWOL - I can't find any links using Google. Can you provide one?

A small magnet sounds like the way to go! Thanks!

More detail of your app usually inspires ideas from readers.

Do you, say, have a mass suspended on a string, hanging (mostly) still by a wall, and want to know when it swings slightly, or, say, a black bar on a roof, fixed at one end, with the other end near another solid wall, and you want to watch the bar expand and contract as its temperature changes? Etc....

What are the "things" which are close? Why do they move? How fast? Etc...

Then we might have ideas as to how to detect the movement.

I’d like to detect a face or hand as it moves closer from 6" to 1/2". So no magnet or mechanical lever. Both are a great idea for another project I have, but not this one. Any more ideas?

http://www.sparkfun.com/search/results?term=proximity&what=products

@Magician - Didn't find much that is useful in your list, thanks for trying!

How about this? https://www.adafruit.com/products/466

Why? You don't like this one:

Infrared Proximity Sensor Short Range - Sharp GP2D120XJ00F

Description: Infrared proximity sensor made by Sharp. Part # GP2D120XJ00F has an analog output that varies from 3.1V at 3cm to 0.3V at 30cm

How about this? https://www.adafruit.com/products/466

If the sensor holds what the datasheet promises it an almost ideal candidate for your project, I guess.

@Magician - Doesn’t go much below 2" not at all below 1"

Even the "professional" companies won't help much... http://www.sick.com/us/en-us/home/products/product_news/distance_sensors/Pages/um30_2.aspx

The UM30-2 Ultrasonic Distance Measurement Sensors feature a new EasyTouch display and keypad that enables easier setup, configuration, and access to advanced problem solving features

If you pull the data sheet -- down to 30mm -- but no better -- decent resolution of 0.18mm but not the range.

Maybe they have other sensors.

Maybe do a little looking at digikey http://www.digikey.ca/PTM/PTMMaster.page?site=ca&lang=en

Some of the Product Training modules may have some ideas on how to go about this easily and cheaply.

This sensor should works at small distances, sensing even more accurate when distance getting smaller: http://interface.khm.de/index.php/lab/experiments/theremin-as-a-capacitive-sensing-device/

Though could be an issue to get equal results for different in size and shape faces :) I wonder, why someone would measure distance to face accurately at all, it's not flat surface. Distance to nose or distance to lips is always variable.

This looks like it... http://ca.mouser.com/Sensors/Proximity-Sensors/_/N-7h7mq?Keyword=proximity&FS=True

I just went to Mouser and looked for Proximity Sensors -- choose by manufacturer, type function etc....

Note there are no Breakout Boards -- so that's your problem.

Choose the 1-200mm range...

Direct link to a PDF: http://www.vishay.com/docs/83462/vcnl4010.pdf

When you are looking for this type of component you are far better off going to a "professional" parts house.

That's almost the identical sensor as on the adafruit breakout, just an interrupt line more, which is probably not needed. I'd go for the adafruit breakout.

When you are looking for this type of component you are far better off going to a "professional" parts house.

Does that imply that adafruit and the like does not have professional parts? Strange opinion...

Vishay TCND5000 is the only analog device with appreciable range. It goes from 5mm to 50mm and shouldn't require a breakout.

http://www.vishay.com/optical-sensors/reflective-outputisnot-16/

Thanks everyone! So many good choices...

pylon: That's almost the identical sensor as on the adafruit breakout, just an interrupt line more, which is probably not needed. I'd go for the adafruit breakout.

When you are looking for this type of component you are far better off going to a "professional" parts house.

Does that imply that adafruit and the like does not have professional parts? Strange opinion...

Only if you read in things I never said...

However, Mouser, DigiKey Newark and similar have a much greater range of sensors a -- and a much higher price tag for many of the "professional./engineering" grade sensors. It can be educational to find that the type of sensor you are seeking might well cost $200US/CDN and wonder why.

While those sensors are often outside the price range of many hobbyists sometimes people are willing to pay the price.

Again -- please do not suggest people said things that simply aren't in the text.