06 Color Refection Exploration | BOSON AI Starter kit for microbit:bit

Color classification technology plays a significant role in fields such as intelligent vision, robotic perception, and environmental monitoring. By accurately identifying and classifying different colors, the intelligence level of a system can be improved, enabling it to better adapt to complex environments.Color reflection serves as the foundation of color recognition. Different colored objects reflect light of different wavelengths, forming specific patterns of reflected light intensity.

 

The goal of this project is to develop a classification system based on color reflection. A Infrared Proximity is used to collect light intensity data reflected from surfaces of various colors. The collected data is then analyzed and classified to ultimately achieve accurate recognition and classification of different colors.

 

 

Learning Objectives

 

1. Understanding and Using the Infrared Proximity

 

2. Mastering the Mode Switching of the Infrared Proximity

 

3. Understanding the Definition and Classification of Colors

 

Preparation

 

 

Learning Content

 

When working on a color classification project, it's important to first understand how colors are formed, how objects display color, and how we can use hardware to "see" these colors. Understanding some basic principles of color can help you design and implement your project more effectively.

 

1. Definition and Classification of Colors

 

Color is essentially the wavelength of light. Each color we see with our eyes corresponds to a specific wavelength of light. For example, red light has a longer wavelength, while blue light has a shorter one. Different objects reflect different wavelengths of light, which is why we perceive different colors.

 

Understanding this concept is important because we will use a Infrared Proximity to detect these colors. The sensor doesn't directly "see" color; instead, it determines the lightness or darkness of a color by measuring the intensity of the reflected light. Light-colored objects reflect more light, while dark-colored objects reflect less.

 

 

2. Physical Properties of Colors

 

Different colors reflect light in different ways. For example, dark-colored objects absorb more light, so the light they reflect is relatively weak. In contrast, light-colored objects reflect stronger light. This difference in reflection is the basis for detecting color using a Infrared Proximity.

 

It's important to understand that these differences in reflected light intensity allow you to distinguish between colors. The sensor measures the intensity of the reflected light to determine whether the surface is closer to white, black, or falls within another color range.

 

 

3. Color Perception and the Human Visual System

 

Our eyes perceive color through three different types of cone cells, each of which is most sensitive to red, green, or blue light. These cells detect different wavelengths of light and send the corresponding signals to the brain, allowing us to see and distinguish colors.

Understanding this helps us see why the RGB (Red, Green, Blue) model aligns with human visual perception. Therefore, in our project, using a Infrared Proximity to measure different levels of reflected light intensity is conceptually similar to how our eyes perceive color.

 

4. Infrared Proximity Switching Operation Demonstration

 

The Infrared Proximity has two operating modes: digital mode and analog mode, each suitable for different application scenarios.

 

Digital Mode: In digital mode, the Infrared Proximity only outputs two states: "on" or "off." When you gently block the sensor probe with your finger, the indicator light will switch between "on" and "off." This mode is suitable for simple on/off control tasks.

 

Analog Mode: In analog mode, the Infrared Proximity can detect variations in light intensity. When the probe is partially blocked, the brightness of the indicator light changes gradually according to the degree of obstruction, showing a gradient from bright to dim. This mode is ideal for detecting colors and changes in light intensity.

 

Mode Switching: To switch between modes, connect the Infrared Proximity to the P0 pin on the expansion board and power the board accordingly.

 

 

Once the power is connected, you can switch the operating mode by gently pressing the button on the module.

 

 

So, how can you determine the current operating mode? You can identify it by observing the indicator light on the module:

 

Digital Mode: When the probe is not blocked, the indicator light is at its brightest, indicating that the sensor is in digital mode.

 

Analog Mode: When the probe is not blocked, the indicator light is dimmer, indicating that the sensor is in analog mode.

 

 

Project Practice

 

The main objective of this project is to detect the reflected light intensity of objects with different colors using a Infrared Proximity, and by analyzing these intensity values, to achieve basic color classification.

 

Task 1: Explore How Different Colors Affect Reflected Light Intensity Use the Infrared Proximity to measure the intensity of light reflected by objects of different colors, and gain a preliminary understanding of the relationship between color and reflected light intensity.

 

Task 2: Color Classification Based on Reflected Light Intensity Building on Task 1, add a NeurOne Module to allow the system to learn and memorize the analog values from the BOSON base via the Infrared Proximity. The system will then scan according to the learned base sequence and determine whether the BOSON module bases are classified correctly.

 

Task 1: Explore How Different Colors Affect Reflected Light Intensity

 

Hardware connection

Program Design

 

Function instruction

 

In analog mode, the data detected by the Infrared Proximity from different colored objects will be mapped to the brightness of an RGB LED. The corresponding grayscale values will also be output through the serial port.

 

Flowchart Analysis

 

Sample program

 

Operating Effect

 

By mapping the analog values detected by the Infrared Proximity to the brightness levels of the RGB LED, you can observe that the RGB LED's brightness varies when the Infrared Proximity detects objects of different colors. This allows the sensor to effectively reflect the intensity of light for different colors through the RGB light output.

 

 

The grayscale values detected by the sensor will be displayed in real-time in the data section of MakeCode. However, it's important to note that in order to view the numerical display in the data section, you must connect the micro:bit main board to the computer using a USB cable.

 

 

Task 2: Color Classification Based on Reflected Light Intensity

 

The BOSON module has two bases: one that can be connected with LEGO bricks and one that can be fixed with screws. However, during production, there will likely be a large number of bases in different colors. How can these bases be separated?

 

 

Let's analyze these bases. The main distinguishing feature is their color. So, we can use the color feature for feature extraction and matching. Our current solution is to have a robotic arm sort the bases by color in the order of "Blue - Green - Red - Yellow" and transport them to the corresponding positions via a conveyor belt. However, we need a detection device to ensure that the bases are placed in the correct order.

 

 

Hardware connection

 

Program Design

 

Function instruction:

 

Based on Task 1, add a NeurOne Module to allow it to learn the analog values of the BOSON base through the Infrared Proximity and memorize their changes, so as to determine whether the detected BOSON module bases are classified in the correct order.

Operation Demonstration:

 

1. Infrared Proximity Modification

 

Since the Infrared Proximity needs to maintain a distance of about 2mm between the probe and the base during the detection process, this distance must be maintained during both the learning and debugging stages. We need to modify it using modeling clay.

 

2. Learning Phase

 

Press the learning button on the NeurOne Module, then move the probe of the Infrared Proximity from left to right, facing each base, and record the analog values of the reflected light for the colors in the "Blue - Green - Red - Yellow" sequence.

 

Note: The entire learning process must be completed within 10 seconds.

 

3. Precision Adjustment

 

Repeat the "Blue - Green - Red - Yellow" sequence in the same order as recorded by the learning probe, maintaining a consistent detection speed. If the output indicator light does not light up, turn the precision adjustment knob on the NeurOne Module counterclockwise to reduce the sensitivity to the input signal. Otherwise, rotate the adjustment knob clockwise to increase the sensitivity to the input signal.

 

Flowchart Analysis

 

Sample program

 

 

Operating Effect

 

Before starting the recognition, the RGB light should remain red. Use the Infrared Proximity to scan in the learned base sequence. If recognition is successful, the light will turn green; if recognition fails, the light will remain red.

 

Project Development

 

Did you succeed in this project? What does it indicate? Think about it!

 

In fact, each BOSON base can be viewed as a pixel in an image, and with the NeurOne Module, we can simply record the color. If we can record a large number of pixels, wouldn't it be possible to form an image? A large number of images could then serve as a feature library for image recognition. Can you recognize the numbers in the image below?

 

License
All Rights
Reserved
licensBg
Tags BOSONAI
0