ColorLightSensor - unit of values

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc

Moderators: roger, 99jonathan, imaqine

ColorLightSensor - unit of values

Postby LangerJan » Mon Jul 05, 2010 6:34 pm

Hi all,

can you give me some pointers (hardware refs. etc) about the unit of the values behind the ColorLightSensor, which comes with ne NXT 2.0. This aims especially about the light value. I understand that there are hardware dependent values between 0 and 1023. Can somebody give me a hint where to find what they represent (values in lumen, cd. in some range)?

Many thanks

Jan
LangerJan
New User
 
Posts: 19
Joined: Wed Feb 10, 2010 5:06 pm

Postby gloomyandy » Mon Jul 05, 2010 7:42 pm

Hi,
I don't think the sensor values are calibrated in any particular way, other than being optimized to identify Lego colors.... I suppose you could calibrate the return from the sensor against some known source...

Perhaps if you provide a little more detail as to how you wish to use the sensor someone may be able to help....

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby LangerJan » Mon Jul 05, 2010 9:36 pm

Hi Andy,

the reason I'm asking is that I want to put a unit on my charts. I made a series of color measurements in which only the ambient light changes.

For instance, i placed the colorsensor in short distance to a plain red legobrick. I constantly measured the RGB and brightness values and dimmed the light.

By doing that, I was able to implement a narrowed color recognition only for that specific "lego-red" under changing brightness conditions.

Now I was curious what's behind the brightness value.
LangerJan
New User
 
Posts: 19
Joined: Wed Feb 10, 2010 5:06 pm

Postby gloomyandy » Mon Jul 05, 2010 10:20 pm

Hi,
It sounds like what you are doing is pretty much what the standard color recognition code does. It uses weighted values (that are built into the sensor and are calibrated by Lego, they are different for different instances of the sensor), for each of the RGB values and the background reading. I'm not sure if you have seen the actual code used by the standard driver (which is based on the code in the Lego firmware), but it is here:
http://lejos.svn.sourceforge.net/viewvc ... iew=markup
The code is a little tricky to follow, because we wanted to allow the linker to be able to strip the class away if it was not being used, but you may find it interesting...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby LangerJan » Mon Jul 05, 2010 11:26 pm

Hi,

thanks - yes, it's basically the same. The main reason for implementing it on my own were some "false-detections", e.g. for detecting blue.

At the edge of a green brick, I got the values:
Red: 137
Green 138
Blue 138
Brightness 30

readColor() judged it to be blue - which is not what I wanted.

Anyway, thanks for the help!
LangerJan
New User
 
Posts: 19
Joined: Wed Feb 10, 2010 5:06 pm

Re: ColorLightSensor - unit of values

Postby Taklu » Fri Oct 21, 2011 8:11 am

I placed the colorsensor in short distance to a plain red legobrick. I constantly measured the RGB and brightness values and dimmed the light. buy cialis
Last edited by Taklu on Fri Dec 30, 2011 5:25 am, edited 2 times in total.
Taklu
New User
 
Posts: 2
Joined: Fri Oct 21, 2011 8:07 am

Re: ColorLightSensor - unit of values

Postby s.frings » Sat Oct 29, 2011 7:12 pm

I have the same problem. My sensor also detects green bricks often as blue.

A green brick reflects only very few of the green light, because the LED has a much brighter green light than the colour of the brick is. It works much better with green things that are a little brighter.

Orange is also problematic. Its between yellow and red. I tried to detect orange using the raw values without success. It's even worse than the green colour.
s.frings
Active User
 
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm


Return to NXJ Hardware

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff