Understanding Color & Sensors

How Computers See Color

To a computer, every color is just a mix of Red, Green, and Blue light. This is called the RGB Color Model.

  • Red: (255, 0, 0)
  • Green: (0, 255, 0)
  • Blue: (0, 0, 255)
  • White: (255, 255, 255)
  • Black: (0, 0, 0)

The TCS34725 Sensor

This sensor has a tiny grid of filters that measure the intensity of red, green, and blue light reflecting off an object.

Ambient light can affect readings! We use a bright white LED on the sensor to overpower the room lighting and get consistent results.

Reading the Data

When we ask the sensor "What color is this?", it gives us three numbers: R, G, and B.

CPP
uint16_t r, g, b, c;
tcs.getRawData(&r, &g, &b, &c);