Light Sensor with Color?

When browsing through vexlabs a while ago, I noticed that the description mentioned light filters and color vision.

Does anyone know how it would work, and how it could be programmed? I don’t have a light sensor yet, but I plan on getting one. Any reccomendations?

The light sensor is actually just a photoresistor that’s resistance changes depending on the illumination. It returns a value (1 to 100, I believe) depending on the lighting.
You can place color filters in front of the sensor to block out different wavelengths and allow the robot to “see” a different color, although it would still return the same value range (1 to 100). “Vision”, unfortunately, is not a very good way to describe the sensor and filter, but if you’re clever ( and use several light sensors… ) they can be programmed to do some interesting things (ie, putting 1 on the front left and 1 on the front right, and depending on which sensor is receiving lower values, have the robot drive towards a light source)

well i you made a sensor aray with three photoresistors/lightsensensors one with a yellow filter one with a cayan filterr and one with a blue filter you could esentially tell the color of the object in front of the robot.

I am currently testing a different method. The team I am in has to build an autonomous robot from scratch for a Electrical Engineering competition. One thing we have to do is find the right colored box and then move it. We are thinking of attaching a light to the front of the robot next to the light sensor. when we turn on the light the object the light hits will return the light back to the sensor. if we keep the same distance each time we test the light the different colors should return a different number in the sensor. I dont know if the vex sensor will work but if you have the programing kit it would not be hard to test.


You need an approach that is insensitive to ambient light. Somehow you either need a reference sensor that measures the ambient light and helps you compensate for it, or that uses a patch of the correctly colored material to tell you what to look for; or you need a sensor that can discriminate based on color (i.e. the filters), without being confused (as much) by the intensity of the light.

To say it another way, you want to be able to scan the boxes and have color (instead of distance or the ambient light) dominate any signal changes coming from the light sensor. Notice that I am suggesting looking for on-the-fly signal changes (differences between boxes measured as the robot is comparing the boxes). I am not suggesting comparing the return from each colored box to a pre-determined threshold.

Try your approach under various lighting conditions (incandescents, fluorescents, and halogens of various brightnesses) and see if it is easily confused by the ambient light. I suspect that it will be. Consider using one of these alternatives. Let us know what you discover.


The light sensor will return an analog signal. Each color should return a slightly different value. You can write code to look for a certain color range. You can use color filters to enhance or negate colors “seen” by the sensor. Research color filtering in reference to photography for more info.

I wonder if you’d get better results by putting the light filter on the light source, instead of the light sensor. For example, by using different color LEDs to illuminate the target. Then you could maybe remove the ambient light response by measuring the sensor with no leds on, and then compare that to the responses with different color LEDS illuminated.

has anyone tried using the light sesor as a color sensor?
if so how well does it work?

I’ve been doing some experiments but several questions come to mind. For the Elevation contest, are colored filters allowed since they aren’t standard VEX accessories? Is adding non VEX narrow angle, high intensity LED’s to generate a reflected light allowed for the contest? If not the only light source I’m aware of is the line follower.

Essentially cube detection is (relatively) easy. Differentiation requires a degree of color spectrum filtering whether additive or subtractive reflected light.

I know for sure that color filters are legal, I just dont know what rule it is under.

Rule <R5> b is the rule you are looking for.

Drego I know you are trying to help but it’s more helpful if you find the actual rule than just say that you know it exists, that way the person who asked the question knows what you are basing your answer off of.

Wow, be a little bit more rude.

Look I wasn’t trying to be rude. The reason I said that is because I have seen people say that they know something is a rule only to have someone else figure out that it was in fact not a rule or not a current rule. Sorry if it sounded harsh.

Well you could have simply told the person what the rule was. I know that I should have posted the rule, but I have read the rules more than once, there is no need to tell me to post the rules well. I was hoping someone would give the rule number in a kind manner.

Guys, I think you may have taken offense when none was intended. Corpralchee’s advice was good advice.

The best answer to questions like the one that was asked, is almost always an answer that points the questioner to the rules, without attempting to summarize, paraphrase or otherwise substitute someone’s understanding of the rules for the actual text of the rules.

Everyone should read all the rules (as you did) and should refer to the original material as often as is necessary.

It is hard to imagine a situation when opening up an online copy of the rules, in order to find the answer to answer a question; will take significantly longer than posting that question here and waiting for an answer that one hopes will be correct.

Also, when Corpralchee said that one should cite a specific rule in situations like this, he was indirectly telling everyone that being able substantiate statements through citations of original or authoritative sources is an important life skill. It is necessary when publishing scientific papers, legal papers, and other scholarly works (and it should be necessary in political debates;)).