Color Sensors Tutorial

of 11
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
  COLOR SENSORS TUTORIAL Understanding Color  In reality, color doesn't actually exist - color is simply a figment of your imagination. No I'm not joking, serious. COLOR DOES NOT REALLY EXIST!!!!!!!! So what about blue and green and orange? Figments of your imagination. Confused? Light, an electromagnetic wave, can come in different wavelengths. These wavelengths enter your eye and the energy gets absorbed by cells on the  back of your eye. This light energy then gets converted into chemical energy, gets processed by a few hundred million specialized neurons, and after a few fractions of a second magically your brain says wavelength 450nm is blue and wavelength 520nm is green (much more useful information, anyway). At the conscious level you never actually see these wavelengths, only what your brain processed them as. Through this process a lot of other wavelengths get rejected, too, such as infrared or ultraviolet. These wavelengths also exist,  but you just can't see them. For more information on how your brain can 'see' check out my  computer vision tutorials . So what's the point of this rambling? Stop thinking of light as something visible, and start thinking of light as colors you both can and can't see. Green is a color, but infrared is also a color. Once you realize the color green is no different than the electromagnetic waves your cell phone uses, then you will start to understand how a robot really can 'see.' For example, what would the world look like if you could see infrared but not blue, green, and yellow? Exactly.    Color of Objects  Again, objects don't actually have any color - its a figment of your imagination. For example, when you look at a red apple, the apple isn't actually red. Instead, the molecular surface on the apple reflects wavelengths that appear red in your  brain and absorbs the other wavelengths molecularly so that you can't see them.  Now if your robot wanted to see a red apple, how would it do this? I bet you would guess, 'Well, I need a sensor that can see the color red.' Wrong! Actually, you need a sensor that can tell the difference between red and another color. For example, suppose your sensor can't see red but it can see all other colors. If this sensor saw nothing, then it was looking at red. Basic Color Sensor  Suppose you have a sensor that can see many different colors, such as a photoresistor . How would you use this sensor to detect red apples vs. green apples? Well, consider brightness comparisons. Red apples reflect red light but absorb green light. Green apples reflect green light but absorb red light. If you shine a red light (such as from a red  LED ) on both apples, the red apple will reflect much more light than the green apple. As such, the apple that appears the brightest to your sensor will be the red apple. If you shine green light from a green LED on both apples, the green apple will appear the  brightest.   Suppose you had some M&M's and you wanted your robot to tell the difference  between the blue, green, yellow, and orange candies. How would you do this? Well, get a blue LED, a green LED, and a red LED. Then shine each onto the M&M's, one light at a time, and record the brightness values. Obviously, the blue M&M's will read the highest brightness values when the  blue LED is turned on, but very low values otherwise. The green and the yellow M&M's can be detected in a similar manner. So how do you tell the difference between the yellow and the orange M&M? Well, the orange one is closer to red in the light spectrum, and as such will reflect more red light than the yellow one. But it gets a little more complicated . . . first, photoresistors have different levels of sensitivity to different colors. Typically photoresistors are optimal and  peak at around 520nm. They are also sensitive to distance away from the target. As you can see, this particular sensor can detect the most light, and hence get the best readings, at .12 inches away. This information can be obtained from the datasheets.   If you move the object to a different distance, or change the angle of the object, the reading will also change. And yet it gets more complicated. The ambient light (for example, sunlight coming in through your window) can change throughout the day. You will need to shield your sensors from this light. And even more complicated . . . different color LED's shine at different wavelengths and different brightnesses, but they also do a spread to where they can often even share some wavelengths (obtained from the datasheets):
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks