0% found this document useful (0 votes)
13 views

Color Sensor

Uploaded by

Carlos Brasil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Color Sensor

Uploaded by

Carlos Brasil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Color Sensor

1. Basic knowledge of color sensor


Me Color Sensor is a sensor which can recognize 6 different colors, including black,
yellow, red, blue, green and white. The interface of this module is marked with blue
and white, which means it uses I2C protocol and it needs to be connected to the
corresponding interface.

Back sensor

Electronic wiring

Assembly & setup

Figure 1: Me Color Sensor

2. Properties of color sensor


 The white area of the module is a reference area that contacts with the metal beam.
 It has reverse connection protection and power reverse will not damage IC.
 Support Arduino IDE programming, and provide runtime to simplify programming.
 Support mBlock graphical programming, suitable for users of all ages;
 It is convenient to use the RJ25 interface.
 Modular installation, compatible with the Lego series

3. Principle of color sensor


The visible light in our life is composed of three primary colors: red, green, and
blue. When the light is irradiated on objects, there will be different degrees of
absorption and reflection effects on the primary lights due to the differences of surface
properties of the object. The Color Sensor determines the color of the object surface by
detecting the reflection intensity of the three primary lights, as shown in Figure 2. The
switching time for Color Sensor detecting different colors is 160ms, that is, it takes
0.16s for the sensor switching from detecting one color to another color.

1
White object
The value of RGB

Yellow object
The value of RGB

Figure 2: Principle of Color Sensor

4. Connection of hardware
Since the port of the Color Sensor module is blue-white, when we use a RJ25 port,
it needs to be connected to the port with a blue-white mark on the main board. Taking
the main board of mBot as an example, all RJ25 ports on mCore have blue and white
color marks. All the ports can be connected to a color sensor, as shown in Figure 3.

Figure 3: Color Sensor Connection


2
5. Color sensor programs and examples
(1) The programming module instructions of Color Sensor are as shown in Figure 4.

statement blocks Description


Parameter 1: Select the port to which
the module is connected;
Parameter 2: Select the target color;
Parameter 1: Select the port to which
the module is connected;
Parameter 2: Select the corresponding
color value;

Figure 4: Programming Module Instructions of Color Sensor


(2) The basic programs for using a color sensor are as shown in Figure 5.

Figure 5: Color Sensor Basic Program


(3) When the LED module displays the color collected by the Color Sensor, mBot
starts to move and the example programs are shown in Figure 6.

Figure 6: mBot starts to move when LED module displays the color collected
by the Color Sensor
3
6. Matters need attention
(1) Each team should install the color sensor to the appropriate height according to the
situation of the arena (the recommended height range is 1.5 ~ 3cm).

(2) Due to the influence of the external environment, each team member should develop
the ability of using programming to improve the sensor recognition.

(3) One motherboard can only support one color sensor running.

You might also like