Conveyor Belt Ev3

- Jan 11, 2019-


The current color sensor of the EV3 uses a low-power single-product machine from ST, which is not a dedicated color sensor chip. When color recognition is used, color recognition errors often occur. As the front-end sensor appears to be inaccurate in recognition, it will directly affect the movement of the follow-up machine, and it will cause great trouble to friends who have learned this knowledge. The content of this Weibo is to discuss several ways to avoid color error recognition.


Let's first look at how this color sensor works. When she works in the color recognition mode, her color tube passes through the integrated red, green and blue LEDs, using the three-color principle of light, alternately emitting 7 different colors of light, and then passing the sensor. The upper receiving diode measures the intensity of the reflected light of the measured object. When the reflected light is the strongest, it is considered that the color light emitted at this time is the color of the object.

  For example, when her emitting LED alternately emits 7 different colors of light, it also continuously receives the intensity of the reflected light. When the red light is emitted, it is measured that the reflected light of the object is the strongest at this time, and then the object to be measured is considered to be red.


Since the black object absorbs all visible light, when the sensor alternately sends out 7 different colors of light, the intensity of the reflected light received by each color is very weak, and compared with the measured ambient light, it is considered The object to be measured is black.

 Understand the working principle of this color sensor, let us look at the problem of color recognition error and several solutions: We use blue as an example, first the color block is measured as close as possible to the color sensor to reduce the interference of the external ambient light source, but not It is completely attached to the sensor, leaving a distance space for the object to reflect back to the sensor, generally about 5mm. Do not move the measured color block and look at the measurement results.

 1. If a blue color block, the color sensor always reads green, or the probability of reading the error is too large, indicating that this blue color is not suitable for the EV3 color sensor. It is recommended to change to a different shade of blue, preferably with Lego's blue blocks. Because the EV3's color sensor is designed with Lego's own color as the standard.

 2. If a blue color block is detected, it is sometimes recognized as green, but most cases are correctly recognized as blue. In this case, the digital mean filtering method can be used to remove the interference. For example, when the blue color is read for the first time, the delay is read again, and then it is judged whether the second reading is still blue. If the two readings are inconsistent, it is ignored. This color is considered correct until the same color result is continuously read. The frequency and frequency of sampling are measured according to the actual application. In the color sorting conveyor program, I used two samples at intervals of 0.5 seconds depending on the speed of the conveyor and the size of the color block. Examples are as follows:


3 In practical applications, most of the cases identify the color blocks to be identified, and do not need to repeatedly identify the identified color blocks. For example, counting the color patches that pass on the conveyor. After a color block is recorded a number of times, how to control the detection counter is also often used. My more common method is to digitally filter and confirm that the object is correctly recognized, and the counter operates once, and at the same time, the ‘this time has been operated’ flag. Ensure that the operation is no longer repeated for the same object. After the sensor has sampled another color, such as black or colorless or other environmental colors, clear the “This has been operated” flag. The specific procedures are not complicated, so you can try it yourself.