LogoLogo
  • REV Crossover Landing
  • Sensors
    • Through Bore Encoder
      • Specifications
      • Application Examples
    • Color Sensor V3
      • Specifications
      • Application Examples
      • Discontinued Color Sensors
        • V2 Specifications & Examples
        • V1 Specifications & Examples
    • 2m Distance Sensor
      • Specifications
      • Application Examples
    • Magnetic Limit Switch
      • Specifications
      • Application Examples
    • Touch Sensor
      • Specifications
      • Application Examples
    • Potentiometer
      • Specifications
      • Application Examples
  • Blinkin LED Driver
    • Blinkin LED Driver Overview
    • Blinkin Specifications
    • Blinkin Getting Started
      • LED Pattern Tables
    • Blinkin Troubleshooting
    • REV ION Application Examples
    • REV DUO Application Examples
  • UltraPlanetary System
    • UltraPlanetary System Overview
    • UltraPlanetary Features
    • Cartridge Details
    • Load Ratings
    • Assembly Instructions
    • Mounting Brackets
    • Ultra 90 Degree Gearbox
      • Assembly Instructions
      • Rotation Direction
  • Servos & Accessories
    • Servo Hub
      • Servo Hub Wiring
      • Configuring the Servo Hub with a Control Hub
      • Channel Power
      • Channel Pulse
      • Servo Hub Status LED Patterns
      • Troubleshooting
      • REVLib for Servo Hub
    • Smart Robot Servo
      • SRS Gear Replacement
    • SRS Programmer
      • Switching Operating Modes
    • Servo Power Module
  • Indicators
    • Digital LED Indicator
      • Specifications
      • Application Examples
Powered by GitBook
On this page
  • Application Information
  • FTC Application
  • FRC Application
  • Additional Resources

Was this helpful?

Export as PDF
  1. Sensors
  2. Color Sensor V3

Application Examples

PreviousSpecificationsNextDiscontinued Color Sensors

Last updated 7 months ago

Was this helpful?

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 or similar time-of-flight sensor for accurate distance measurement.

FTC Application

Configuring for the Control System

Note to users transitioning from Color Sensor V2 to V3: Color values will not be consistent between V2 and V3 sensors and there are minor changes to the FTC SDK. Be sure to update to the latest SDK.

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.

The code assumes that the Color Sensor was configured with the name “test_color.”

package org.firstinspires.ftc.teamcode;
 
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.ColorSensor;
import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
 
@TeleOp
public class TestColorSensor extends LinearOpMode {
    // Define a variable for our color sensor
    ColorSensor test_color;
    
    @Override
    public void runOpMode() {
        // Get the color sensor from hardwareMap
        test_color = hardwareMap.get(ColorSensor.class, "test_color");
        
        // Wait for the Play button to be pressed
        waitForStart();
 
        // While the OpMode is running, update the telemetry values.
        while (opModeIsActive()) {
            telemetry.addData("Light Detected", ((OpticalDistanceSensor) test_color).getLightDetected());
            telemetry.addData("Red", test_color.red());
            telemetry.addData("Green", test_color.green());
            telemetry.addData("Blue", test_color.blue());
            telemetry.update();
        }
    }
}

FRC Application

​When using the Color Sensor V3 on the navX’s I2C Interface, you will need to make sure that the Voltage Select Jumper on the navX is set to 3.3V. The Color Sensor V3 has a max operating voltage of 3.3V and applying 5V can damage the sensor.

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:

Latest REVLib Installation Information
Online REVLib Java Documentation
Online REVLib C++ Documentation
C++ Examples
Java Examples
LabVIEW Examples
APDS-9151 Datasheet
2m Distance Sensor