LEGO® MINDSTORMS® and Technic®MINDSTORMS® EV3/NXTMINDSTORMS SensorsLEGO® technical dataLDrawMiscellaneous LEGO®VEX;LEGO® & PhotographyPanoramic PhotographyPhoto GalleryHome

 

 


    Color Sensors Showdown

    I have a long standing interest in color sensors... I am lucky this year: two colors sensors for NXT hit the market. One is the LEGO color sensor, included in NXT 2.0 kit. The other is HiTechnic color sensor V2. You'll find below a comparison between these sensors.

    The sensors are based on different principles. LEGO sensor uses a RGB LED, and successively shines red, green and blue light on the object. Reflected light is collected by a light sensor sensitive to all wavelength. HiTechnic one has a white LED, and a specialized color sensitive chip. This chip has three sensitive areas covered by red, green and blue filters. An added advantage of HiTechnic method is that it can detect the color of light sent on it (in passive mode, with the white LED shut off).

    Detection range

    This test was performed with the setup pictured above. Six colored plates are mounted on a NXT motor. They are successively shown to the color sensor, and the color read is recorded. In order to test reliability, this cycle is repeated 10 times at each distance. The triangle shaped support allows to change the angle between the plates and the sensor.

    To simplify things, the test was limited to the 6 basic colors that LEGO sensor is able to detect using regular NXT-G block. Note that the NXT-G block provided with HiTechnic color sensor is able to directly discriminate 18 different colors and access color components. Access to color components with the LEGO sensor is possible using other languages, or with a NXT-G block created by Steve Hassenplug (soon to be available here)

    Here is a table with the color numbers provided by the sensors:

     

    Yellow

    Green

    Red

    White

    Black

    Blue

    LEGO

    4

    3

    5

    6

    1

    2

    HiTechnic

    6

    4

    9

    17 (>10)

    0

    2

     

    Dark room, color sensor perpendicular to the plates

    The first test was performed in a dark room, with the color sensor perpendicular to the plates. Test distance between base of the sensor and the plates is 1, 2, 3, 5 and 8 studs. 

    LEGO sensor provides reliable values at a distance of 1 and 2 studs. At 3 studs distance, green is seen as black. At 5 and 8 studs, all colors are seen as black. With this setup, HiTechnic sensor returns rather weird data, with - for example - black seen as white!

    At that time, I discovered this warning in the help file of HiTechnic NXT-G block:

    Note: When measuring the color of a target surface, light from the sensor's internal light source can reflect from the target and interfere with readings.  To minimize problems caused by reflections, place the color sensor at a slight angle so it is not positioned exactly perpendicular to the target surface.

     

    Dark room, color sensor slightly tilted

    So I performed a second test, this time with the color sensor tilted by about 10°.

    The LEGO sensor behaves the exactly the same as previously, perpendicular or tilted. But this time HiTechnic sensor works perfectly at a distance of up to 5 studs, and correctly identify all colors except green (seen as black) at a 8 studs distance. Note HiTechnic sensor detects white plate as light yellow (LEGO white has a distinct yellowish tint indeed).

    Ambient light immunity

    Lit room, color sensor slightly tilted

    The next experiment check ambient light immunity. The previous setup is used, but this time a low voltage, 35W halogen lamp was placed about 55 cm away from the plates.

    This time, LEGO sensor works correctly only at 1 stud distance, it returns "black" for all colors above this distance. HiTechnic sensor is not affected at all by this ambient light level, the result are the same as those obtained in a dark room.

    Day light, color sensor slightly tilted

    Now I placed the test setup behind a window, with fine weather (with some white, reflecting clouds).

    At this light level, LEGO sensor is useless, even at short distance. HiTechnic remains completely immune to ambient light level! Impressed by the quality of ambient light cancellation of HiTechnic sensor, I even tried it under direct sunlight. But there it was not able to provide reliable readings.

    Speed test

    I then tried to characterize the sensor detection speed. For that I constructed this contraption, with a red/yellow propeller that can be rotated at variable speed in front of the sensor. Knowing the diameter of the propeller, width of blade and rotation speed, it's easy to derive the time during which the blade is in front of the sensor. The NXT-G program used counts the number of cycles during which yellow and red are detected. This number is compared to the number of turns done by the propeller. Motor speed is increased just below the point where color detection becomes unreliable.

    Here the LEGO sensor wins hands down, needing only 2.5 milliseconds to detect the blade. HiTechnic sensor needs 17 milliseconds for a reliable detection. Part of the explanation probably lies in the different choice of sensor interface: LEGO sensor data directly enters NXT ARM processor through integrated analog to digital converter, while HiTechnic uses the slow I2C interface of NXT.

    Conclusions

    Each sensor has strong points and will be best suited in different situations. LEGO color sensor will perform best in situation where speed is important, such as color line following. HiTechnic sensor will make wonder when it is difficult to light shield the sensor or when discrimination between more color shades is needed.
     

     

    LEGO sensor

    HiTechnic sensor

    Orientation sensitivity

    +

    -

    Detection range

    - -

    + +

    Ambient light immunity

    - - -

    + + +

    Speed

    + +

    - -

    Number of colors
    discriminated (NXT-G)

    6

    18


     

LEGO® MINDSTORMS® and Technic®MINDSTORMS® EV3/NXTMINDSTORMS SensorsLEGO® technical dataLDrawMiscellaneous LEGO®VEX;LEGO® & PhotographyPanoramic PhotographyPhoto GalleryHome