Using the VEX IQ Color Sensor

The Color sensor uses reflected light to detect an object’s color, hue value, grayscale value, and proximity.

The following article will cover:

  • Description of the Color Sensor
  • How the Color Sensor Works
  • Common Uses of the Color Sensor
  • Color Sensors on a Competition Robot

The VEX IQ Color Sensor is included in the VEX IQ Super Kit and can also be purchased here.


Description of the Color Sensor

The VEX IQ Color Sensor has multiple modes, which allow it to capture different types of information from its environment. The information it collects is affected by the lighting conditions of its environment as well as the distance between the sensor and the object or surface it is reading.



How the Color Sensor Works

The Color Sensor can detect both color and proximity.

Detecting Colors

When in brightness mode, the Color Sensor is used to detect the intensity of all light in the robot’s environment. The more light that reaches the Color Sensor while it's active, the higher the percentage value sent to the Robot Brain.

If the detected brightness percentage is low or unreliable, the Color Sensor’s lamp can be turned on or the lamp’s brightness percentage can be raised by using the following set light to block:

The Color Sensor can report the color it sees as either a color value or as a hue value.

Color values. There are 14 listed colors that the Color Sensor can detect. The colors missing from the image of the block are red, green, blue, white, and yellow.

Hue values. Hue values are like color values but numerical. The hue value ranges from 0 to 360, like degrees. The color values listed above have their own equivalent hue value ranges. 

It is important when detecting colors and hues that the Color Sensor have the proper amount of light to do so. Be sure to test, also known as calibrating, your Color Sensor in different levels of light and with the lamp set at different levels to determine which is the most reliable setting for your robot’s Color Sensor.

 
Detecting Proximity

The Color Sensor includes an infrared sensor-emitter. The infrared emitter shines an invisible light and then detects its reflection. If most of the infrared light bounces back toward the sensor, it tells the Robot Brain that an object is close.

Common Uses of the Color Sensor

Color sensors are used in many technology applications where having specific colors on displays or products is important.

Some common uses in daily life include:

  • Color calibration tools check if a digital screen is displaying accurate colors, and then adjust the display settings as needed. It is important for graphic artists and any designer who works with color on a digital screen to be able to see exactly the correct color being displayed. Misunderstandings and wasted resources result when the colors are not accurate.
  • Cameras and camcorders use color sensors to adjust settings based on the lighting conditions they are in, in order to enhance their photos and videos by maximizing light levels and enhancing otherwise dull colors. These sensors also allow a photographer to focus on specific colors in their photos.
  • Color sensors are sometimes used in manufacturing, to quickly inspect if a product has the correct color before it gets shipped to a customer. For example, fruits and vegetables that turn colors when ripe or ready to be eaten can be scanned to ensure that they are the correct color to send to market. 


Some common uses with a VEX IQ Robot include:

  • This sensor can be used to detect the color of an object.

  • This sensor can be used to detect and/or follow a line.

  • This sensor can detect whether an object is near.

Color Sensors on a Competition Robot

Remember, it is important when detecting colors and hues that the Color Sensor have the proper amount of light to do so. Be sure to test, also known as calibrating, your Color Sensor each time you arrive at a new competition site because different levels of light can affect how your Color Sensor performs. Test your project with the lamp set at different levels to determine which is the most reliable setting for your robot’s Color Sensor. 

The information collected by the Color Sensor is useful for programming a competitive robot to respond to a variety of conditions. The Color Sensor can make a competition robot better in the following ways:

  • It lets the robot detect the color of an object near the sensor. This is useful if you want the robot to sort differently colored objects, drive up to a specifically colored object, or detect the color of objects as they pass by the sensor.
  • It lets the robot detect how much light is reflected back into the sensor. This allows your robot to drive until it reaches a line on a surface, or even to follow a line.
  • It lets the robot know whether an object or surface is near. This is helpful in determining whether a detected color is a reading from a nearby object or potentially, an anomalous reading of a distant surface or light.