Detecting Colors with the SparkFun Tristimulus Color Sensor

Pages
Contributors: -KJB-
Favorited Favorite 4

Interpreting the Results

  • CIEx, CIEy, CIEz: These are the values from the CIE 1931 color space which represent the color's chromaticity.
  • Detected Color: Based on the values, the code attempts to classify the color into a basic category like "Red," "Green," "Blue," etc.

The CIEx and CIEy values are going to fall somewhere between 0 and 1. Page 35 of the datasheet gives more detail on this, but generally speaking, you can map the predominant color of the space you're measuring using the following:

CIE Y and X Color Readings

CIE V and U Color Readings

CIE XY and CIE UV space plots of color coordinates

For more information on the CIE and CIY values, refer to the CIE 1931 Color Space Wiki Page.

If you see unexpected values or the sensor isn’t detected, double-check your wiring and ensure the sensor is properly connected to the I2C bus.