Range Detection with Shades
What is the difference between bright green and dark green? The only difference is that with
bright green there are more electromagnetic waves being detected and/or emitted. For example,
suppose you have a green apple and your robot takes a green color measurement. Then you move
the apple an inch back and take another measurement. What will happen? Simple, less green light
from the apple will reach your sensor. So how is this useful? Range detection!
Going back to the previous chart, can you see how you can calculate distance from an object?
Unfortunately your color range sensor won't have a range of more than a few inches at most, depending on the brightness
of your LED. You could of course use a green laser pointer for maximum range, or apply a trick I am about to show you.
This following trick employs the same method TV remotes use to increase sensor range. Normally, if you apply
a large amount of power to an LED to increase brightness it will fry. But what if you put a huge amount of power
into it but over a very short period of time? Then you could make it say 5x brighter for ~5x increase in range!
Power (watts) is voltage x current. A typical LED can only work at a few 100 milliwatts before they fry (check your
datasheet) - this is why you should always put a resistor in series with an LED!
Now watts is a measurement of energy divided by time: energy/second. So what if we had the LED shine for only 50ms?
Well, that's 1 / .05 = 20, or 1/20th of a second. This means that if you shine your LED for only 50ms, then it can
take about 10 to 20 times more current, and therefore shine about 10 to 20 times brighter.
The exact numbers would depend on the thermal cooling rate of the LED - something that can only be determined by frying
a few LEDs with testing . . . Just so you know, its quite common to find half an amp going through a TV remote IR emitter!
Modulation
There is yet another method to increasing detectable range of your sensor called modulation. It's somewhat complex
so Ill write about it in another tutorial, but it requires a very fast sensor. Basically you switch your
emitter on/off really fast so your sensor can therefore ignore background noise. As such you need a fast sensor.
Infrared sensors respond within
microseconds, but unfortunately photoresistors respond within milliseconds (bad!). If you were to do modulation,
it would be better to use IR, such as a Sharp IR Rangefinder. Unless . . .
Unless you use these neat color sensors that are made by TAOS.
These sensors can be bought for many different specific wavelengths in the visible spectrum, yet
have the frequency response rate of IR sensors! They also require zero interface electronics - just plug
them in to power and analog I/O and wallah! I've done some experimentation with them, but found
the ones I bought were over-sensitive. In a dimly lit room they already max out in voltage =(
So this concludes my color sensor tutorial, I hope you learned something!