Application Examples

Application Information

The REV Robotics Color Sensor has two sensing elements: color and proximity.

Color measurements consist of Red, Green, Blue, and Alpha (clear) values. The white LED on the sensor has a slide switch to turn the LED on or off. Unlit targets are best illuminated with the build-in LED while bright or light-emitting targets may not require the build-in LED. Color data is best collected within 2cm of the target for the strongest color differentiation.

Proximity measurements are based on IR reflectance and can vary depending on lighting conditions and target reflectivity. The proximity sensor is ideally used to determine if something is in front of the sensor. While you can receive rough distance data, we recommend using the 2m Distance Sensor or similar time-of-flight sensor for accurate distance measurement.

FTC Application

Configuring for the Control System

When working with the Color Sensor V3 configure your robot to use the "REV Color Sensor V3" as shown in the image below.

In this example, the Color Sensor V3 is configured on I2C bus 1. The Color Sensor V3 can be configured on any of the I2C busses as long as a 2m Distance Sensor is not configured to the same bus.

Recall that I2C sensors must have different addresses in order to operate on the same bus. The Color Sensor V3 and 2m Distance Sensor share the same address.

Programming Example

This program shows a readout of values from the Color Sensor on your Driver Hub's screen while the program runs. "Light Detected" shows the amount of light detected between 0 and 1.

"Blue", "Red", and "Green" each show the amount of that "component" in the color the sensor is pointed at. If pointed at a red color, for example, it will likely have the highest amount shown.

To learn more about programming a Color Sensors check out Hello Robot for Blocks and OnBot Java!

Example Blocks Code for the Color Sensor

FRC Application

Software Libraries

API Documentation

REV Color Sensor V3 Example Code

Additional Resources

Additional information about the APDS-9151, its capabilities, and its features can be found in the following datasheet:

Last updated

Was this helpful?