All pages
Powered by GitBook
1 of 6

Color Sensor V3

Overview

The REV Robotics Color Sensor V3 is a combined color and proximity sensor. From a single sensor you can measure colors and rough distances to various targets. Version 3 introduces a new sensor chip from Broadcom due to the end-of-life of the V1/V2 color sensor chip.

Features

  • Digital RGB Color Sensing

  • IR Proximity Emitter and Detector

  • Built-in (switchable) white LED

  • Supports Standard (100kHz) or High Speed (400kHz) I2C

Kit Contents

Part Number

Description

Qty

REV-31-1557

Color Sensor V3

1

REV-31-1407

JST PH 4-pin Sensor Cable - 30cm

1

Specifications

Specifications

General Specifications

Parameter

Value and Units

Sensor Type

I2C

I2C Address

0x52

Sensor Part

APDS-9151

Measurement Channels

Red, Green, Blue, Alpha, and Proximity

Electrical Specifications

Parameter

Min

Typ

Max

Units

Operating Voltage Range

-

-

3.3

V

Proximity Sensor Range

1

-

10

cm

Mechanical Drawings

All dimensions are in millimeters.

Pinout

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

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.

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

Example Blocks Code for the Color Sensor

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

@TeleOp
public class ColorSensorTest extends LinearOpMode {
    private NormalizedColorSensor test_color;
    
    @Override
    public void runOpMode() {
        test_color = hardwareMap.get(NormalizedColorSensor.class, "test_color");

        waitForStart();

        while (opModeIsActive()) {
            telemetry.addData("Light Detected", ((OpticalDistanceSensor) test_color).getLightDetected());
            NormalizedRGBA colors = test_color.getNormalizedColors();
    
    //Determining the amount of red, green, and blue
            telemetry.addData("Red", "%.3f", colors.red);
            telemetry.addData("Green", "%.3f", colors.green);
            telemetry.addData("Blue", "%.3f", colors.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

  • Latest REVLib Installation Information

API Documentation

  • Online REVLib Java Documentation

  • Online REVLib C++ Documentation

REV Color Sensor V3 Example Code

  • C++ Examples

  • Java Examples

  • LabVIEW Examples

Additional Resources

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

  • APDS-9151 Datasheet

Discontinued Color Sensors

Color Sensor V2 Overview

The REV Robotics Color Sensor V2 is a combined color and proximity sensor with updated features from the original REV Color Sensor. From a single sensor you can measure colors and rough distances to various targets.

Features

  • Redesigned case

    • Better mounting

    • Wider field of view

    • Better sensor protection

  • Built-in white LED

    • LED power is switchable with new built-in switch

  • Supports Standard (100kHz) or High Speed (400kHz) I2C

    • Supports auto-increment register reads

  • Built-in IR Proximity Emitter and Detector

Kit Contents

Part Number

Description

Qty

REV-31-1537

Color Sensor V2

1

REV-31-1407

JST PH 4-pin Sensor Cable - 30cm

1

Color Sensor V1 Overview

The REV Robotics Color Sensor V1 a single sensor you can measure colors and rough distances to various targets. The Color Sensor V1 has a built-in IR (optical) and Proximity Sensor and white LED for active target lighting. Using High Speed I2C Communication (400kHz), as well as auto increment register read, allows the user to return all the color register and status register data in one read command instead of 4 separate read commands.

Features

  • M3 Mounting Hole

  • Built-in white LED

    • LED power is switchable with new built-in switch

  • Supports Standard (100kHz) or High Speed (400kHz) I2C

    • Supports auto-increment register reads

  • Built-in IR Proximity Emitter and Detector

Kit Contents

Part Number

Description

Qty

REV-31-1154

Color Sensor V1

1

REV-31-1407

JST PH 4-pin Sensor Cable - 30cm

1

V2 Specifications & Examples

General Specifications

Parameter Description

Parameter

Sensor Type

I2C

I2C Address

0x39

Sensor Part

TMD37821

Measurement Channels

Red, Green, Blue, Alpha, and Proximity

Electrical Specifications

Parameter

Min

Typ

Max

Units

Operating Voltage Range

-

-

3.3

V

Proximity Sensor Range

5

-

25

cm

Mechanical Drawings

All dimensions are in millimetres.

Pinout

Application Examples

Application Information

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

Proximity measurements are based on IR reflectance and can vary depending on lighting conditions and target reflectivity.

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.

FTC Application

Configuring for the Control System

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

In this example, the Color Sensor V2 is configured on I2C bus 2. The Color Sensor V2 can be configured on any of the I2C busses.

Recall that I2C sensors must have different addresses in order to operate on the same bus.

Programming Example

This program shows the values from the Color Sensor on your phone. Your team will need to figure out the logic to use this information in your program. Below there are three examples of different color modes and their readings. Light Detected mode will read the amount of light on the sensor from 0-1.0. Because the sensor is close to a surface, the LED in the sensor reads 1.0 in the examples.

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

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

Additional Resources

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

  • TMD37821 Datasheet

V1 Specifications & Examples

General Specifications

Parameter Description

Parameter

Sensor Type

I2C

I2C Address

0x39

Sensor Part

TMD37821

Measurement Channels

Red, Green, Blue, Alpha, and Proximity

Electrical Specifications

Parameter

Min

Typ

Max

Units

Operating Voltage Range

-

-

3.3

V

Proximity Sensor Range

5

-

25

cm

Mechanical Drawings

All dimensions are in millimeters.

Pinout

Application Examples

Application Information

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

Proximity measurements are based on IR reflectance and can vary depending on lighting conditions and target reflectivity.

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.

FTC Application

Configuring for the Control System

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

In this example, the Color Sensor V1 is configured on I2C bus 2. The Color Sensor V1 can be configured on any of the I2C busses.

Recall that I2C sensors must have different addresses in order to operate on the same bus.

Programming Example

This program shows the values from the Color Sensor on your phone. Your team will need to figure out the logic to use this information in your program. Below there are three examples of different color modes and their readings. Light Detected mode will read the amount of light on the sensor from 0-1.0. Because the sensor is close to a surface, the LED in the sensor reads 1.0 in the examples.

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

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

Additional Resources

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

  • TMD37821 Datasheet