What should be the distance between the object and the sensor (TCRT5000L), for sensor to be able to detect it? I foun in datasheet operating distance is 0.2 to 0.15mm, but it seems little to me.
Electronic – Distance range IR sensor
infraredsensor
Related Solutions
You want an IR distance sensor like this http://www.adafruit.com/index.php?main_page=product_info&cPath=35&products_id=164
(I am sure there are lots of sources).
Just hook it up to an analog pin of your UC and you will get your proportional voltage.
Summary:
Your requirement can easily be met.
Working with only one light source present light below the illumination levels that you can see at can be detected with an under $1 sensor.
Having other light present may require optical filtering to distinguish between the various type of light present.
Range capability of a given sensor will depend on absolute light level and on relative % illumination compared to total illumination from all sources.
Absolute light level depends on emitter light output (lumen) and radiation or cone angle of source - which together result in the level of brightness (= lux = lumen/meter^2) at a given distance away. Brightness can also be measured in candela (= candle power) which is the amount of light over a given area and distance from the source compared to what would be emitted by a "standard candle".
A typical modern 5mm LED operated at full power (typically 20 mA at 1.5 to 3.5 V depending on LED type) will typically produce around say 3 to 12 lumen (depends on wavelength etc). An LED with a say 15 degree cone angle and the above output will produce a brightness of around 30 candela or 33,000 millicandella.
If you double the cone angle for the same lumen output the candela reading drops by about 4 x as the light has to cover 4 x the area. (draw yourself a picture).
A single modern eg White LED operating at 20 mA and 3V with a15 degree one angle - as would be used in a typical high quality flashlight - and producing about 8 lumen will produce about about 30+ candela of brightness. At one metre that is approximately blinding - enough tp destroy your night vison and leave spots before your eyes. At 2 metres it's "rather bright" and at 4 metres still "extremely noticeable". If that was a red or green or blue or other modern LED the results would vary somewhat due to eye response but it would still be very bright.
SO a colour detector working with that sort of light and no other light present would need to have very very modest capability to detect it at 1 metre. In oherwise darkness light at 0.1% of that would be detectable with relative ease using easily available technology.
The sensor below is an example of what is chap and readily avaiable.
Sensors can be mde to respond to specific colors only or ranges of colors using filters. These may be as simple as gelatin or plastic or cellulose fultyers or be complex and expensive interference filters. So filter cost cam be from under 1 cent to $100+. Sensors are also avai;able which respond to only a range of frequencies. For example a colored LED (NOT a phosphor based LED) can often be used as a sensor for light of around it's emission frequency. Gets complex in detail.
Superb example of an under $1 sensor:
This Avago APDS-9003 (Hewlett Packard in another lifetime) typical "ambient light sensor costing under $1 can detect light levels of well under 0.01 lux .
Bright daylight at midday = 100,000 lux
A monitor screen on full brightness may be 300 lux.
Reading level with comfort and good color rendition = 50+ lux
Bright moonlight < 1 lux
Just perhaps see shapes on a dark room as you stumble about = 0.1 lux
So 0.01 to 0.001 lux is "very dark"
Best Answer
Read the datasheet again. 0.2 to 15 mm, not 0.2 to 0.15 mm.