The Eye Sensor within the VEX 123 Robot allows the robot to detect both the presence of nearby objects and the color of that object. The sensor plays an important role in helping the robot make decisions based on what it “sees”—such as detecting a red marker, spotting an obstacle, or choosing which way to turn during an activity.
This sensor is located on the front of the robot.
For the best results when using the Eye Sensor, try to avoid shadows, glare, or very dim lighting. You can also use the set eye light power block to adjust the brightness of the sensor’s built-in light. Increasing the brightness can help the sensor detect colors and reflectivity more clearly in dimmer lighting conditions.
Detecting Colors
The Eye Sensor can read the hue of the reflected light and can compare it against preset hue ranges to identify basic colors like red, green, or blue.
A hue is a number on the color wheel from 0–360 degrees that represents the type of color.
When you use the eye detects block, the robot checks whether the hue reported by the Eye Sensor falls within a certain range for that color:
- Red: 340°–20°
- Green: 80°–145°
- Blue: 160°–250°
Note: If the hue falls outside of these ranges—even if it still looks like the intended color to the human eye—the project may not behave as expected. This can be mitigated by using the eye hue block and comparison operators (like greater than or less than) to create a custom range of hue values.
Detecting Light
In addition to detecting color, the Eye Sensor can also tell how much light is reflected off a surface. This helps the robot figure out whether something in front of it is bright or dark. Bright surfaces, like white paper or light-colored objects, reflect more light. Dark surfaces, like black tape or areas in shadow, reflect less.
For the eye bright object? block to return as “True”, the object in front of the sensor needs to reflect at least 70% of the light.
Detecting Objects
The Eye Sensor can also detect when something is physically close to the front of the robot. This is different from detecting color or brightness. Instead of measuring the color or how much light is reflected, the sensor checks whether an object is close enough to be considered “in front” of the robot.
An object needs to be approximately 18 mm away from the sensor to be detected. Note that this value can be impacted by environmental factors like ambient lighting.
This kind of detection is used with the following blocks: