Color Sensor

The Modern Robotics Color Sensor detects the color of an object using reflected light or the color of light from an external light source. Great for detecting and tracking colored lines and determining the color of a lit object.
SKU: 45-2018

The Color Sensor detects the color of a target and returns values identifying the color. 

The Color Sensor operates in two modes, Active and Passive. The mode can be selected by writing the required mode code to the Command register.  

In Active mode, the internal LED provides the light source for detecting the target color. Best results in Active mode are obtained when the target is within about 7cm of the color sensor.

In Passive mode, the internal LED is switched off and the sensor detects the color of the light from an external light source such as a colored LED or lighted device.

The Color Number returned is in the range 0 – 16 as shown this chart.  The sensor also returns values for red, green, blue and white. 

The Color sensor I2C bus address is 0x3C.

Color Sensor Programming

To use the color sensor set the mode (default 0x00 Active mode) and then read 0x04 to get the color number and optionally 0x05 - 0x08 to get individual color channel values.  

Address Function
0x03 Command
0x04 Color Number
0x05 Red Value
0x06 Green Value
0x07 Blue Value
0x08 White Value

Color Gif



Sensor Documentation

All the information you need about
Modern Robotics Sensors in one document.

PDF File

Note: If you are not sure what the mains A/C electric frequency is for your country, it can be found chere.


5 Volt DC 20mA max
Standard 4 Pin Connector
4 pin I2C port
Logic Voltage Levels
Logic 0 - 0 Volts
Logic 1 – 5 Volts
Wiring Diagram
Black - Ground
White - SCL
Yellow - SDA
Red - +5V
 I2C Address
I2C Change Option
I2C Bus Speed
100KHz max
Operational Frequency
50Hz or 60Hz
Typical Maximum Range
7 Centimeters
Internal Sampling Rate
30 Samples Per Second
Unit Dimensions - LxWxH
32 x 32 x 11 Millimeters
Mounting Holes
24 x 24 Millimeter Square Pattern - designed for 8mm grid spacing
Unit Weight
10 Grams
Connecting Wire Length
25 Centimeters
Customers who bought this item also bought

Core Motor Controller

The Core Motor Controller has two motor channels to connect and control two 9 - 15 volt DC motors, with optional encoders.

Touch Sensor

The MRI Touch Sensor is robust and enclosed in a housing for easy mounting. Great for installing as a limit switch or bumper switch.

Integrating Gyro

The Modern Robotics 3 Axis Integrating Gyro returns the rate of rotation for the x, y, and z axes as well as heading information from the z axis.

Optical Distance Sensor

The Optical Distance Sensor, or ODS, detects changes in the distance from a target surface using pulsed light.