Tuesday, May 02, 2006

HiTechnic's New Light Sensor

Lego Mindstorms NXT has some great sensors right out of the box. An ultrasonic sensor allows you to measure the distance to obstacles, and a light sensor detects the amount of light, and its color. But now, HiTechnic is introducing a better light sensor.

Why A New Light Sensor?

The Lego Mindstorms NXT light sensor can determine the color of a ball (and other surfaces, off course). To do that, it measures the amount of light entering the sensor. This light is the combination of lights and sun in the room, and the amount of light from its own light, a red LED. To accurately measure the color of the ball, you need to measure how much of a particular color is reflected. One way of detecting color is by illuminating the object with a particular color, and then seeing how much extra is reflected.

The LED on the Lego Mindstorms NXT light sensor can be switched on and off under software control, so in principle, it should be possible to determine the difference between ambient light and LED light being returned by the ball. But in practice, this kind of "ambient light cancellation" process does not work well (because the sensor is highly nonlinear, the LED is not very bright, only a red LED is used which distorts the colors, and the NXT measurement cycle is quite slow).

To overcome the sensor limitations, the Lego Mindstorms NXT set comes with a blue and red ball. These colors are amongst the easiest to distinguish colors for the Lego Mindstorms NXT light sensors.

HiTechnic takes a different approach by introducing their new NXT Compatible Color Sensor. The sensor looks quite similar to Lego's light sensor, but the HiTechnic sensor allows you to measure any color, with higher resolution, and you can measure them a lot faster. The HiTechnic NXT Compatible Color Sensor can be used for tasks like accurate color recognition and object detection broadly independent of ambient illumination. It is not necessary to "recalibrate" the NXT program each time it is run due to varying light levels at different locations, which makes it a lot simpler to program. In short, you can make your robot do cooler stuff, but keep your software simpler.

How It Works

The HiTechnic NXT Compatible Color Sensor works by pulsing the target surface fast, with three colored LEDs, one red, one green and one blue. The LEDs are brighter than the one used by Lego. The difference between ambient illumination and the increase due to each light source output is used to measure the target surface’s (our ball) reflection for each color.

The three color values are further processed to correct for the spread of each LED’s spectral output. For each color measurment, three values are returned to the NXT brick: the red level, the green level, and the blue level. Each color level is returned as a value between 0 and 255. For example, if values returned were red = 255, green = 255, blue = 0, the target color is yellow. The sensor updates the color data at a rate of 100 samples per second, which means you can use it while the robot is driving and still notice color differences.

Applying It to Robots

The Lego Mindstorms robot that follows the black line is a well known application of the Lego light sensor. Using HiTechnic's light sensor, you could draw a much more complicated track. You could draw a blue, red, and green track, partially overlapping, and have the robot choose which colors he will follow.

Or you could create a robot that tries to race along the track. A green line marks the inside of the track, blue marks the outside border, and red marks signal dangerous curves ahead (the more red, the more dangerous the curve is). Using this information, you could try to have your robot car go as fast as possible. You could even throw in the ultrasonic sensor to avoid bumping into other cars.

If you are looking for a really cool and complex robot tasks, you could build a robot ant farm. Imagine adding color marker pens to your robot. When your robot is just randomly exploring, it colors green. When it has found a food source and returns home, it colors red. And when the food source is depleted and returns home, the robot colors blue. Using these color schemes to leave trails of "pheromones" could create really complex robot behavior. By the way, because the Mindstorms NXT has angle encoders on its tracks, you could try to cut corners, and effectively implement "ant colony optimization" to find the shortest route to the food source. And the "really intelligent robot" fun is only starting at that point.

Or you could create a color coded world, where the robot drives on a large piece of paper. By varying the colors cleverly, each position could have a unique color the robot could read. When the robot looks down, he has an absolute measurement of his location. Voila, instant indoor GPS!

And these are just applications of having a color sensor look down. How about mounting the color sensor inside a robot hand, to better understand what it is picking up. But there is no need to make things that complicated. The applications of the new HiTechnic sensor are only limited by how colorful your imagination is!


The HiTechnic Color Sensor can be calibrated by the NXT program in two ways.

Black level calibration may be used to correct for reflections that come from your own robot. It takes about 1 second to perform, and there should be no obstacles present for at least 50 cm (other than the robot itself).

White balance calibration takes about 0.25 seconds, and may be used to balance the sensitivity of the sensor for each of the three LED outputs when illuminating a white target at a specified distance (normally about 1,5 cm).

Calibration data is stored in non-volatile memory and will be retrieved each time power is applied to the sensor.


The price has not yet been announced. The sensor should be available in September of this year.


Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home