Color Sensor V2

The HiTechnic Color Sensor is an I2C (Digital) sensor for the LEGO NXT that reads the color of a surface as Red, Green and Blue (RGB) values. It processes the RGB values to calculate a Color Number from 0 (Black) to 17 (White).

You can view the output of the Color Sensor service from a web browser. The web page should look like the following:

Click for larger image

The service state includes a Color Number (0-17) and RGB values (0-255).

The sensor can operate in Active or Passive mode. To reduce the effects of fluroescent lights (which flicker at the frequency of the mains power), the sensor can be set to 50 Hz or 60 Hz mode. There is also a Default setting which uses the last saved value. Each time that you send a command to the sensor specifying the frequency, it is written to EEPROM. You should avoid doing this repeatedly because EEPROMs eventually wear out. This is why there is a Default value.

V2 sensors should also allow you to select Low or High power for the LED, and Near or Far operation. This has not been tested.

Notes

The Color Sensor only operates over a short range (1-2cm). When the surface is out of range, you will get 0 for the Color Number. It also tends to give dark (low) RGB values, but the Color Number is generally correct.

This service also works with the Color Sensor V1.

See the general note about Polling.

Last edited Mar 2, 2010 at 6:56 AM by TrevorTaylor, version 8

Comments

No comments yet.