Using the V5 3-Wire Light Sensor


The Light Sensor is a sensor which uses a photoresistor to measure the intensity of light. It is one of the 3-Wire series sensors. The sensor has a single mounting hole which will allow it to be attached to the robot's structure.

The 3-Wire Sensors are compatible with the V5 Robot Brain or the Cortex. The sensor’s cable can be extended using a 3-Wire Extension Cable.


In order for the Light Sensor to be functional with the V5 Brain, the sensor cable needs to be fully inserted into a V5 Brain 3-Wire Port. Note: The sensors cable connector is keyed to fit into the port with a specific orientation.

Light Sensor Sensor Cable Fully Inserted
276-2158.png Triport_Connected_to_V5_Brain.jpg

The Light sensor comes in the Advance Sensor Kit or can be purchased individually here.

How the Light Sensor Works


The Light Sensor functions due to a photoresistor mounted in the center of its housing. This photoresistor changes its resistance value depending on the amount of incident light shining on the sensor.

The Light Sensor is an analog sensor. This means the sensor will take a 5v source from the V5 Brain and the photoresistor will change this value to a value between 5v and 0v depending on the light exposure. The voltage returned to the V5 Brain will be converted into a percent brightness of the light.

Due to the analog nature of the sensor, a threshold of light brightness needs to be established for a returned value. In other words if the light shining on the sensor is too close to the intensity of the background light, the Light Sensor will not be able to detect a difference. A certain threshold of higher percent brightness needs to be used above the background light so a difference can be detected beyond the normal fluctuation of analog values returned from the background light.

A dim light may be able to be detected in a dark room, but a dim light will go undetected in a well lit room.

The Light Sensor needs to be paired with a programming language such as the VEXcode V5 or VEXcode Pro V5 to create a user program for the Brain to use the value from the percent of brightness to control the robot’s behavior.


Common Uses of the Light Sensor:

Light Sensors are most commonly used in classroom applications and can provide fun activities and effective programming challenges Some examples of these are:

Robot deactivation:  A Light Sensor can be placed on the robot and then a program written for the robot so it will drive in the classroom, but if the room lights are turned off the sensor will act as an emergency stop and the robot will stop running its program.

Photo Sensors are used in a similar fashion on light fixtures. Although in this case, the light fixture will turn on when it becomes dark out and turn off when the background light returns. Decorative solar garden lights work like this.

“Light” Driving: A Light Sensor can be placed on the right side of the robot and second Light Sensor placed on the left side. The robot can then be programmed so if it is placed in a dark room it drives straight. If a flashlight is directed onto the right sensor the robot will turn right. If the light is directed on the left sensor the robot will turn left and if both sensors are illuminated the robot will stop.

Flashlight Tag:  This activity requires each robot to have a Light Sensor, a VEX Flashlight, and a VEX Bumper Switch v2. The game takes place between two teams of robots and is played in a dark classroom. During the game, when the VEX Flashlight shines on an opponent’s Light Sensor it “freezes” the robot’s drivetrain until a teammate pushes a VEX Bumper Switch on the robot enabling the drivetrain once again. The game is over when all the teammates on one team are frozen.

Note: the VEX Flashlight can be powered by configuring one of the V5 Brain’s 3-Wire Ports to Digital Out Low.


Uses of a Light Sensor on a Competition Robot:

The most common use for a Light Sensor on a competition robot is for the sensor to serve as a photogate. In this application a Light Sensor can be used for indexing and/or control of game pieces as they move up a conveyor system or slide system on a robot.

The light sensor can be mounted under a piece of clear polycarbonate sheet or flush between two pieces of structural metal. As a game piece slides over the Light Sensor it blocks out the light and the sensor can detect the object.

This is a more effective method of detection than the use of a touch sensor which may cause an obstruction within the conveyor or slide system.

Indexing: A light sensor can be placed at the entrance of a slide or conveyor system. Each time a game piece passes over the sensor it will send a count signal to the V5 Brain.

The V5 Brain can in turn send a message to the LED screen on the V5 Controller. This way the human operator can know how many game pieces are in the system even if a visual check is not possible.

Control: A Light sensor can be placed at the end of a slide or conveyor system. When a game piece blocks the light, the sensor can send a signal to the V5 Brain and the human operator that the system is full and no additional game pieces should be attempted to be picked up.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: