Part 1.
One of the long term items on my “to do” list has been to get hold of a VEX light sensor and see how suitable it is for detecting colored objects, specifically the color of the alliance starting tile. Before jumping into that I’m going to deviate a little into some basic color science that needs, at least partially, to be understood so the behavior of the light sensor is a little clearer.
As you all know from high school physics, visible light is part of the electromagnetic spectrum with wavelengths in the range of approximately 400nm to 700nm (nm = nanometer or 1/1000,000,000 meter). Wavelengths below 400nm are on the boundary of ultraviolet, wavelengths above 700nm are becoming infra red light. Color scientists talk about the “spectrum” of a light source and illustrate this using a graph that shows its spectral power density against wavelength(see note 1). That is, how much energy (or intensity) each wavelength of light has.
When light is reflected from an object, some wavelengths may be reflected more than others. If long wavelength light is reflected more than short wavelength light we may perceive that as a red object, if short wavelength more than long we may perceive blue. To illustrate how light is reflected from an object a similar graph to that which shows the spectrum of the light source is used. The graph can either show the modified spectrum of a know light source or, more commonly, the relative reflectance value at each wavelength.
The third part of the color science puzzle is the detector that “sees” the light source. The human eye is stimulated by the light entering it, different wavelengths of light stimulate cells in our retina which our brain converts into the color we perceive. Light detectors also have different sensitivity to wavelengths in the same way objects reflect light at different wavelength. The human eye has a response know as the photopic curve (unless there’s not much light then it’s different, we don’t see colors when it’s dark). The VEX light sensor also has sensitivity to different wavelength, conveniently it’s quite similar to that of our eyes.
To make many of the measurements used in color science an instrument known as a spectrometer is used, now I just happen to have access to this type of equipment so decided to make some measurements of the light sources we have available from VEX (ie. leds) and the reflectance of the blue and red field tiles.
Measuring the light sources is the easiest, here is (more or less) the spectral power graph for the three VEX leds as well as a white led flashlight I have (unfortunately I don’t have a VEX flashlight to measure).
[ATTACH]7620[/ATTACH]
The X axis of this graph is the wavelength of the light (you could think of it as the color of the light). The Y axis is the intensity of the light at that wavelength (think brightness, although that is over simplified). The green led is rather pathetic, not much light output there, yellow and red are both quite reasonable. Notice how the spectrum of an led is very narrow, only 10nm to 20nm at the 50% point. The white led has a much broader spectrum with two peaks, I would assume that two different elements/materials are used. One centered on green with a wide spectrum and then a secondary blue emitting substance used.
Contrast these to some other common light sources.
[ATTACH]7621[/ATTACH]
The black curve was captured from the window by my desk, it has a very broad spectrum centered on 500nm. The red spectrum was from a florescent light, it’s very spiky with the energy concentrated into three primary wavelengths. I’m also showing on this graph the sensitivity of a typical cadmium sulphide (CdS) light sensor. It matches quite closely the daylight spectrum, it’s most sensitive to light in the 500nm to 600nm range (greenish) and less so at the red and blue ends.
The final graph shows how the colored field tiles reflect light. To make these measurements a known light source, in this case a white led flashlight, illuminates the field tile and the reflected spectrum is captured. The reflected spectrum is processed such as to normalize the light source, that is, the spectrum is modified assuming that the light source has equal energy at all wavelengths (its spectrum would be a horizontal straight line). The processed data now has the relative reflectance for all wavelengths, we show this on a scale of 0 to 100%.
[ATTACH]7622[/ATTACH]
As you might expect, the red field tile reflects most light at the long wavelength end of the spectrum (after all, that’s why we see it as red). The blue tile reflects at the lower end but also reflects relativity less light than the red tile.
In part two, I will talk about the VEX light sensor a little more and show how we can use this data to help us use it for colored tile detection.
Note(1)
For any expert readers of this post, the graphs here do not actually show spectral power density but rather the raw output from my spectrometer. Working with spectral power density data requires a more calibrated and stable setup than I could create in the school robotics classroom yesterday. I may redo the experiments sometime in my lab at work but for illustrative purposes that’s not really needed.