yahboom
HomeTutorialsProduct
Solution
Blog
Online Store
About Us
EN/中文
Store
8-channel Grayscale Tracking Module📖
0. Precautions for use
  • Identifying Defective Solutions
1.About 8-channel tracking module
  • 8-channel grayscale module introduction
2.MCU data reading
  • 1.MSPM0G3507
  • 2.MSPM0G3519new
  • 3.STM32F103C8T6
  • 4.ESP32
  • 5.Arduino
  • 6. Raspberry Pi Pico
3.Car gray line tracking
  • 1. MSPM0 Smart Car
  • 2. STM32 development board for small car
  • 3. ESP32 wheeled car chassis V1
  • 4. Arduino Wheeled Car Chassis V2
  • 5. Raspberry Pi Pico Wheel Car Chassis V2
Download
  • Code
  • 3D Model File
  • Serial Port Assistant
Download ZIP

Welcome to 8-channel Grayscale Tracking Module repository

8-channel grayscale module introduction

Introduction to the 8-Channel Grayscale Module

Introduction to the 8-Channel Grayscale ModuleI. Product Parameters1. Dimensions2. Pin FunctionsII. Grayscale Sensor Theory1. Principle2. Color TheoryIII. Instructions for Use1. The Influence of Height on the Probe2. Usage Range

I. Product Parameters

1. Dimensions

2. Pin Functions

Indicator Light Names and Functions:

  • Power Indicator: Indicates power supply, green.
  • Function Indicator: Indicates recognition effect. On a white background, the indicator lights up when the corresponding color is recognized; on a black background, the indicator turns off when the corresponding color is recognized.

Port Names and Functions:

Port Names and Functions:

  • Positive and Negative Power Ports: For connecting to a 5V power supply.
  • Output Port: For outputting digital signals, connected to the OUT pin of the CD4051.

Addresses 0, 1, and 2: Used to select the output channel. Please refer to the truth table below for details.

This table is compiled based on the CD4051 manual.

Input   Channel
ENAD2AD1AD0OUT
0000CH1
0001CH2
0010CH3
0011CH4
0100CH5
0101CH6
0110CH7
0111CH8

Note:

  • The enable pin here has a default 10K pull-down resistor and is always in a low level state, requiring no processing.
  • The output is a digital signal; the GPIO port outputs high and low levels. - If, under a sheet of white paper at the same distance, the data from 8 probes are found to be different, this is normal. This is due to the different factory sensitivities of each probe.

II. Grayscale Sensor Theory

1. Principle

A grayscale sensor is a sensor used to detect the grayscale levels (brightness) of an object's surface. Its core function is to convert differences in light intensity into measurable electrical signals, thereby distinguishing the grayscale values ​​of different objects (such as black, white, and gray gradients). This is a simplified schematic diagram of a sensor. An LED emits a beam of light, which is reflected by the detection surface and then shines into a phototransistor. The phototransistor is a light-sensitive device; the more light it receives, the greater the current flowing through it. When light shines on the detection surface, part of it is absorbed, and part is reflected into the phototransistor, thus generating a current value.

 

2. Color Theory

In the context of grayscale sensors, "gray" does not simply refer to a "fixed color between black and white" as we commonly understand it, but rather a broad concept of "brightness/darkness range"—essentially a quantitative description of the "difference in light intensity reflected from an object's surface," encompassing all transitional states from "dark gray close to black" to "light gray close to white." Its core is measuring an object's ability to reflect light through "grayscale values," rather than referring to a specific visual "gray tone." Here, we introduce the concept of a color wheel. The color wheel is based on three colors: red (100, 0, 0), green (0, 100, 0), and blue (0, 0, 100). These colors are called primary colors because they are the only colors that cannot be mixed from other colors. Mixing adjacent colors on the color wheel in equal amounts yields secondary colors. For example, red plus green equals yellow (100, 100, 0), blue plus red equals magenta (100, 0, 100), and blue plus green equals cyan (0, 100, 100).

Furthermore, by combining the three primary colors with the three secondary colors, adjacent colors are combined to form secondary colors: orange (100, 50, 0), yellow-green (50, 100, 0), cyan-green (0, 100, 50), indigo (0, 50, 100), violet (50, 0, 100), and magenta (100, 0, 50). For example, red (100,0,0) and yellow (100,100,0) blend to form orange (100,50,0); cyan (0,100,100) and blue (0,0,100) blend to form indigo (0,50,100).

 

In the RGB color system, each color on the color wheel can be created by mixing the three primary colors, just like the screen you are looking at now, which is composed of countless red, green, and blue light-emitting units. When an LED emits red light, only red light is reflected by the detection surface. Therefore, the green or blue detection surfaces absorb the red light, resulting in black. Using this method, we can extract all the red channels, convert them into digital signals, and analyze them to obtain the grayscale of a single channel. We have also verified this conclusion in our experiments.

As you can see, cyan and red, these complementary colors, are at a 180° angle in the image. In the color wheel theory, any two colors that are 180° apart in an image are complementary colors, meaning they have the strongest contrast. It's worth noting that if you encounter white and black, don't worry; grayscale sensors ultimately convert colors to black and white. You can consider white to be eternally white, reflecting the strongest brightness from any color LED, and the same applies to black. The following image is a table showing which lines to look for under four different lighting conditions, which can be used to quickly select the track and light color.

 

III. Instructions for Use

1. The Influence of Height on the Probe

When a flashlight shines on a wall, the closer the distance, the more obvious the beam. The farther the distance, the more diffused the beam. The same applies to the transmitter of the eight-channel grayscale sensor; the closer the distance, the smaller and brighter the beam. Here, our transmitter uses a high-focusing LED, which is more focused than common LEDs. We use a yellow copper tube on the probe to isolate the influence of ambient light, receiving only the light reflected from the transmitter. Therefore, visually, we place the transmitter in front of the probe to reflect the received light source. During use, ensure the probe is on the line for line inspection.

ScreenShot_2025-11-07_113204_767

Regarding height, we recommend using a probe height of 18mm from the ground as the optimal height. This ensures the most complete aperture coverage during testing, without interference between probes.

2. Usage Range

For these four models, the height range is listed, referring to the probe's height from the ground.

White LightBlue LightGreen LightRed Light
White Background10-30mm16-24mm16-24mm
Black Background10-30mm12-20mm12-20mm
Optimal Height18mm18mm18mm

Note:

On a white background, the line color should ideally be matte for better absorption and better line tracking. For the green light version, due to poor blue absorption, a dark blue line is recommended for better absorption and identification. On a black background, check if the line shows through; if so, consider using two layers of line to cover the black background.

Identifying Defective Solutions
MSPM0G3507

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文