Search
Filters
Close

HiTechnic NXT Color Sensor V2

Add a spectrum of color to your models with the new and updated HiTechnic Color Sensor (Version 2). Detect an extended range of more than 15 target colors and program your NXT robot to react to each color. Build a color sorter to sort LEGO bricks or a line follower that will detect different color lines and surface colors. The HiTechnic Color Sensor is “tuned” to standard LEGO colors. When positioned over a surface, the Color Sensor will return a numeric value identifying the target color. The new Version 2 Color Sensor has enhanced performance including better color recognition and longer detection range. The NXT-G programming block can be downloaded from the Downloads page.
SKU: NCO1038
$54.95

HiTechnic NXT Color Sensor Version 2 for LEGO MINDSTORMS NXT

Introduction

The new and totally redesigned HiTechnic Color Sensor Version 2 (V2) operates by using a single white LED (light emitting diode) to illuminate the target and analyses the color components of the light reflected by the target's surface and calculates a Color Number that is returned to the NXT program.

The Color Sensor V2 works best when it is positioned so that it is not too close to the surface being tested. The picture on the right should be used as a guide for proper distance and angle to the surface. The angle prevents the direct reflection of the light from the LED from coming back into the sensor element, which can prevent proper color determination.

The Color Sensor is housed in a standard MINDSTORMS sensor housing to match the other MINDSTORMS elements and connects to an NXT sensor port using a standard NXT wire and digital I2C communications protocol. The Color Number calculated by the sensor is refreshed approximately 100 times per second.

NOTE: The Color Sensor V2 must be configured to match the mains electricity frequency for your country details on how to configure the Color Sensor V2 can be found in the configuration tab on this page.

Programming

Mindstorms NXT-G

The Color Sensor can be programmed using LEGO Mindstorms NXT Software Color Sensor Block.

The Color Sensor Block is designed to support the HiTechnic Color Sensor.

1. This plug wires the number for which of your NXT’s ports are connected to the Color Sensor.
2. This plug wires the lower limit number for the Inside/Outside compare function.
3. This plug wires the upper limit number for the Inside/Outside compare function.
4. This plug wires the Color Number.
5. This plug outputs the relative Red value.
6. This plug outputs the relative Green value.
7. This plug outputs the relative Blue value.
8. This plug outputs the Inside/Outside logical value.

Color Front Panel

Port allows you to select the NXT port the compass is plugged into.

Compare

Compares the Color Number to the range set and sets the logic value to show if the value is inside or outside the range.

Using Range

The Compare lets you set a range and easily determine if the Color Number is inside or outside the range.

The Components for using the Range function are;

Inside Range / Outside Range: Select if you want to test for a Color Number inside the range or outside the range.

A: The lower limit of the range (0 – 17)

B: The upper limit of the range (0 – 17)

To use the Range function, set the lower and upper limit of your range and whether you want to test for inside or outside the range.

Examples showing the logical result.

A
B
Range
Color Number
Logical Value
8
12
Inside Range
10
8
12
Inside Range
15
8
12
Outside Range
10
8
12
Outside Range
15

Color Number Chart

The Color Number chart shows the relationship between the target color and the Color Number returned by the Color Sensor.

Sensor Register Layout

The color firmware supports the standard Lego company’s sensor memory model.

Address
Type
Contents
00 – 07H
chars
Sensor version number
08 – 0FH
chars
Manufacturer
10 – 17H
chars
Sensor type
18 – 3DH
bytes
Not used
3E, 3FH
chars
Reserved
40H
byte
Not used
41H
byte
Command
42H
byte
Color number
43H
byte
Red reading
44H
byte
Green reading
45H
byte
Blue reading

The Sensor version number field will report a revision number in the format “Vn.m” where n is the major version number and m is the revision level. Revision numbers will typically reflect the firmware level. The version number will be used to indicate the hardware level.

The Manufacturer field will contain “HiTechnc”.

The Sensor type field will contain “ColorPD”.

The Command field reserved for future use.

The Color number field will return a single number color estimate.

The Red, Green and Blue reading fields will return the current detection levels for the three color components.

Other Programming Environments

LabVIEW

All the features of the HiTechnic Color sensor V2 can be accessed using LabVIEW and the NXT toolkit. A LabVIEW vi is available on the HiTechnic Downloads page.

RobotC

All features of the HiTechnic Color Sensor V2 can be accessed using RobotC. For more information go to http://www-education.rec.ri.cmu.edu/robotc/.
NOTE: When programming the Color Sensor V2 with RobotC, it must be accessed using I2C standard speed. At other non-standard higher speeds the Color Sensor V2 will not consistently return accurate data.

NXC

NXC is a C programming language compiler that can access all Color Sensor features. For more information go to http://bricxcc.sourceforge.net/nbc/.

Notes:

  • The HiTechnic Color Sensor operates best when positioned straight above the target surface and not at an angle to the target surface.

HiTechnic NXT Color Sensor Version 2 for LEGO MINDSTORMS NXT

Introduction

The new and totally redesigned HiTechnic Color Sensor Version 2 (V2) operates by using a single white LED (light emitting diode) to illuminate the target and analyses the color components of the light reflected by the target's surface and calculates a Color Number that is returned to the NXT program.

The Color Sensor V2 works best when it is positioned so that it is not too close to the surface being tested. The picture on the right should be used as a guide for proper distance and angle to the surface. The angle prevents the direct reflection of the light from the LED from coming back into the sensor element, which can prevent proper color determination.

The Color Sensor is housed in a standard MINDSTORMS sensor housing to match the other MINDSTORMS elements and connects to an NXT sensor port using a standard NXT wire and digital I2C communications protocol. The Color Number calculated by the sensor is refreshed approximately 100 times per second.

NOTE: The Color Sensor V2 must be configured to match the mains electricity frequency for your country details on how to configure the Color Sensor V2 can be found in the configuration tab on this page.

Programming

Mindstorms NXT-G

The Color Sensor can be programmed using LEGO Mindstorms NXT Software Color Sensor Block.

The Color Sensor Block is designed to support the HiTechnic Color Sensor.

1. This plug wires the number for which of your NXT’s ports are connected to the Color Sensor.
2. This plug wires the lower limit number for the Inside/Outside compare function.
3. This plug wires the upper limit number for the Inside/Outside compare function.
4. This plug wires the Color Number.
5. This plug outputs the relative Red value.
6. This plug outputs the relative Green value.
7. This plug outputs the relative Blue value.
8. This plug outputs the Inside/Outside logical value.

Color Front Panel

Port allows you to select the NXT port the compass is plugged into.

Compare

Compares the Color Number to the range set and sets the logic value to show if the value is inside or outside the range.

Using Range

The Compare lets you set a range and easily determine if the Color Number is inside or outside the range.

The Components for using the Range function are;

Inside Range / Outside Range: Select if you want to test for a Color Number inside the range or outside the range.

A: The lower limit of the range (0 – 17)

B: The upper limit of the range (0 – 17)

To use the Range function, set the lower and upper limit of your range and whether you want to test for inside or outside the range.

Examples showing the logical result.

A
B
Range
Color Number
Logical Value
8
12
Inside Range
10
8
12
Inside Range
15
8
12
Outside Range
10
8
12
Outside Range
15

Color Number Chart

The Color Number chart shows the relationship between the target color and the Color Number returned by the Color Sensor.

Sensor Register Layout

The color firmware supports the standard Lego company’s sensor memory model.

Address
Type
Contents
00 – 07H
chars
Sensor version number
08 – 0FH
chars
Manufacturer
10 – 17H
chars
Sensor type
18 – 3DH
bytes
Not used
3E, 3FH
chars
Reserved
40H
byte
Not used
41H
byte
Command
42H
byte
Color number
43H
byte
Red reading
44H
byte
Green reading
45H
byte
Blue reading

The Sensor version number field will report a revision number in the format “Vn.m” where n is the major version number and m is the revision level. Revision numbers will typically reflect the firmware level. The version number will be used to indicate the hardware level.

The Manufacturer field will contain “HiTechnc”.

The Sensor type field will contain “ColorPD”.

The Command field reserved for future use.

The Color number field will return a single number color estimate.

The Red, Green and Blue reading fields will return the current detection levels for the three color components.

Other Programming Environments

LabVIEW

All the features of the HiTechnic Color sensor V2 can be accessed using LabVIEW and the NXT toolkit. A LabVIEW vi is available on the HiTechnic Downloads page.

RobotC

All features of the HiTechnic Color Sensor V2 can be accessed using RobotC. For more information go to http://www-education.rec.ri.cmu.edu/robotc/.
NOTE: When programming the Color Sensor V2 with RobotC, it must be accessed using I2C standard speed. At other non-standard higher speeds the Color Sensor V2 will not consistently return accurate data.

NXC

NXC is a C programming language compiler that can access all Color Sensor features. For more information go to http://bricxcc.sourceforge.net/nbc/.

Notes:

  • The HiTechnic Color Sensor operates best when positioned straight above the target surface and not at an angle to the target surface.

The RobotC driver suite supports HiTechnic products for RobotC 4.x and RobotC 3.x. Select the corresponding repository at the link below and download the zip file. 

https://github.com/botbench

HiTechnic Color Sensor Configuration

The updated version of the HiTechnic Color sensor (sold from July 2009) must be configured to match the mains electricity frequency for your country. There are two electric supply frequencies commonly used throughout the world. These are 50Hz (50 cycles per second) and 60Hz (60 cycles per second). The HiTechnic Color Sensor is configured by default for locations with 60Hz electrical supplies so if you live in a country with a 60Hz electrical supply no configuration is necessary.  Such locations include Canada, USA, and South Korea.

MINDSTORMS and the color sensor are often used in environments that are illuminated with electric lights. The light produced by electric lights “flickers” at the frequency of the electric supply and this flickering can interfere with the HiTechnic color sensor. To overcome the interference, the color sensor should be configured for your local electric frequency.

Using the Electric Frequency Table HERE, determine your local electric frequency and then click on the appropriate configuration program name to download the appropriate program for your location. 
The configuration programs are;

50Hz - SetTo50Hz.rxe

60Hz - SetTo60Hz.rxe

Configuration using EV3 is not available at this time.

To load the program into your NXT, connect the NXT to your PC.

Run the MINDSTORMS software and select “Create new program”.

Click to open the NXT window.

Click the Memory tab to display the NXT memory map.

Click Download to download the configuration file to the NXT.

Navigate to the location where you downloaded the configuration program file and click OK to download it to the NXT.

Connect your new HiTechnic color sensor to port 1 and use the NXT buttons to run the configuration program.

use the Enter (orange) button to load and run the program.  Press to select Software files.

Press to select the configuration progam.  (use the arrow keys to display the program name if it is not displayed)

Press to run the confgiuration program

The configuration program will make sure the HiTechnic Color Sensor is connected to port 1 of the NXT and will display the following if the program
completes the configuration correctly.  It will take only take about 1 second for the program to run.

If the sensor is not found on port 1 or is not the correct version of the sensor, the following error message will be displayed.

The HiTechnic Color sensor is now ready for use. 

Description Version Release Size
NXT
HiTechnic Color Sensor Block for Mindstorms NXT Software
The Color Sensor Block adds support for all Color Sensor features to the LEGO MINDSTORMS NXT Software. This block enables access to Color number, Red, Green and Blue relative color content, and in/out of color range. 
New with version 2.0: This block adds support for the HiTechnic Sensor Multiplexer as well as data logging with the LEGO Mindstorms 2.0 Education software.
2.0 7/28/2010 646KB Download
Color Sensor VIs For LabVIEW2009
Color Sensor VIs and sample program VI for LabVIEW 2009. Supports the HiTechnic Sensor Multiplexer. See included readme.txt file on how to install into LabVIEW 2009.
1.0 10/6/2010 115KB Download
Color Sensor VI
LabVIEW VI to access the features of the HiTechnic Color Sensor. 
Note: This vi is designed for LabVIEW 7.1 with NXT Toolkit.
1.0 4/2/1009 47KB Download
HiTechnic EV3 Color Sensor Block
This is preliminary release of the HiTechnic EV3 Color Sensor Block. Note that this block only supports the EV3 and will not work with the NXT. Zip file includes both the Color Sensor block and a sample program that shows the color sensor values on the EV3 screen. See instructions at top of this downloads page for installation instructions.
0.30 2/8/2014 41KB Download