Design of a handheld colorimeter based on the RGB three primary color principle
2026-04-06 05:44:47··#1
Color sensing technology is one of the core technologies of modern color measurement instruments, and has developed into a system integrating optics, mechanics, and electronics. With the development of modern industrial production towards high speed and automation, strict requirements have been placed on the inspection of product colors and the control of color quality. Using color measurement instruments has become the main means of objectively evaluating product colors. In color detection and recognition, many parameters affect its accuracy, such as the illumination source, sensor characteristics, receiving part, and signal processing, all of which directly affect the measurement results. How to properly handle these parameters to obtain accurate measurement results is currently one of the main problems. At present, RGB color sensors are widely used in detection. This article will introduce a method for implementing a handheld color detector based on the RGB three-primary-color principle. 1. Measurement System Structure and Measurement Principle As shown in Figure 1, this system mainly consists of a color sensor, illumination source, signal processing circuit, microcontroller, and LCD display. 1.1 Color Sensor The RGB three-primary-color sensor achieves color detection by measuring the reflectance ratio of the three primary colors that constitute the color of an object. Due to its extremely high precision, it can accurately distinguish extremely similar colors, and even different shades of the same color. This design uses an MCS series RGB three-primary-color sensor. 1.2 Illumination Source The required measurement spectrum range for this design is 380nm~750nm, and white light can basically cover this spectrum range. Therefore, white surface-mount LEDs are selected for illumination. Using white light illumination instead of multiple monochromatic lights to simulate white light illumination can improve the illumination effect both theoretically and practically, and simplify the design method. Multiple white LEDs form a ring illumination system of 45° (illumination)/0° (measurement). 1.3 Signal Processing Circuit The output signal of the color sensor is generally a tiny current in the nanoampere range, which brings inconvenience to the measurement. First, the tiny current signal must be converted into a voltage signal for subsequent A/D conversion circuit and microcontroller processing, and amplification must also be completed. How to complete the conversion and amplification of the photocurrent signal while minimizing distortion is a problem that must be solved in the measurement work. 1.3.1 Microcurrent Measurement Principle The microcurrent signal source can be regarded as a current source IS with very high internal resistance. The microcurrent measurement principle with a ground terminal is shown in Figure 2. For an ideal operational amplifier with infinite input impedance and amplification factor, the output voltage V0 = ISRf. Theoretically, as long as the resistor Rf is large enough, a large output voltage V0 can be obtained even if the current IS is very small. In reality, the input impedance of the operational amplifier is not infinite, and the increase of the resistor Rf is limited by the input impedance of the operational amplifier. Considering the shunting of the bias current IB to the measured current IS, V0 = -(IS - IB)Rf. If IB is greater than IS, IS cannot be measured. The primary factor affecting the sensitivity of micro-current measurement is the bias current IB of the operational amplifier, followed by noise voltage and zero-point drift. To achieve micro-current measurement, the operational amplifier must meet the following requirements: ① bias current IB < measured current IS; ② input impedance Ri >> feedback resistor Rf; ③ high gain and common-mode rejection ratio; ④ small offset voltage and drift; ⑤ low noise. 1.3.2 Circuit Analysis and Design In terms of component selection, the input bias current IB of the operational amplifier is one of the main sources of error. This scheme selects the AD8608 chip produced by Analog Devices as the main chip for current conversion and amplification, as shown in Figure 3. In order to measure nanoampere current, Rf in Figure 2 should be a resistor of the order of 10¹⁰. Such a large resistor has low accuracy, poor stability and high noise. Therefore, in Figure 3, a T-type network composed of small resistors is used to replace the high-impedance Rf, and an RC filter circuit is connected to the output of the operational amplifier to remove the interference of high-frequency noise signals and chopper spike noise. This is very beneficial to improving the stability of the circuit. However, the time constant is generally large and it is not suitable for measuring fast-changing signals. C and R form a feedback compensation network to reduce the bandwidth and prevent the T-type network from generating self-excited oscillation due to phase shift with C1. 1.3.3 Measures to improve performance (1) Do not connect the balancing resistor of the operational amplifier Experiments have shown that in micro-current amplifiers with high internal resistance current sources, connecting the operational amplifier to a balancing resistor not only makes it difficult to balance the input resistance, but also increases the circuit noise. Therefore, the non-inverting input of the AD8608 operational amplifier in Figure 3 is not connected to a balancing resistor, but is directly grounded. (2) Reduce the operating temperature of the operational amplifier. As can be seen from the temperature characteristics of the operational amplifier, for every 10°C increase in temperature, the bias current of the operational amplifier will double, thereby reducing the sensitivity and accuracy of micro-current measurement. Therefore, the power supply voltage should be reduced as much as possible, and the load resistance should be increased (greater than 10kΩ) to reduce the operating current of the operational amplifier and reduce the operating temperature. (3) Reduce the leakage current of the PCB. In micro-current measurement, it is very important to improve the insulation strength of the PCB and reduce the leakage current. Generally speaking, leakage current equivalent to the insulation in the nanoampere level will have a serious impact on the measurement results. Therefore, measures should be taken to strictly control the leakage current of the PCB: select a high-insulation circuit board with leakage current much smaller than the pA level, such as epoxy glass board; use polytetrafluoroethylene terminals with good insulation, no static electricity, and low moisture absorption for the input signal; surround the non-inverting and inverting input terminals of the operational amplifier with a grounding shield ring on the circuit board and ground it to make them equipotential and ensure that the leakage current between them is zero; after the circuit is installed, remove residual impurities, and clean, dry and moisture-proof the components and circuit board. (4) To improve the signal-to-noise ratio, select low-noise, 1% precision gold film resistors; select low-noise ceramic, mica, or tantalum capacitors; use two-stage LC filtering for the power supply to reduce noise; keep the power supply line as far away from the input signal line as possible; use the shortest possible shielded cable for the signal input line; apply copper plating to the power supply section and the output and input sections of the amplifier; ground the input section of the amplifier to the power supply at one point; and shield the entire micro-current amplifier with metal. 1.4 Measurement and Control Circuit This system uses a PIC18Fxx8 series microcontroller as its core, utilizing its built-in A/D converter to collect the current-voltage converted signal, compare it with the reference data, obtain the color code, and send it to the LCD screen for display, as shown in Figure 4. 2. Software Design This system uses assembly language programming, which is beneficial for improving the program's running speed. The system software flowchart is shown in Figure 5. 3. Experimental Results and Conclusions The sample used in the experiment is the "China Building Color Card". This is a set of standard color samples for use in the construction industry, and its color representation method is designed according to the numbering system of GB/T15608-1995 "China Building Color System". The color card encoding is made according to the requirements of GB/T 18922-2002 "Methods of Representation of Building Colors". 3.1 Experiment This system has conducted color detection experiments, and several standard colors were selected from the "China Building Color Card" for measurement. Figure 6 shows the actual measurement of the green color stimulus value after the color system is converted into the RGB color system. 3.2 Experimental Conclusion Analysis As can be seen from the curve in Figure 6, due to the existence of various interference factors, the experiment is not ideal for distinguishing extremely similar colors. The main interference factors include: (1) The influence of the lighting source on the measurement sensitivity The stability of the lighting source directly affects the accuracy of the color sensor output signal. The advantages of using white light illumination compared to simulating with a single color light do exist, but it also has its own problems, such as relatively unstable color temperature and less than ideal balance. (2) The influence of feedback resistor on the sensitivity of current-voltage conversion A feedback resistor with a large resistance value has low accuracy, poor stability, and high noise, while a feedback resistor with a small resistance value is prone to drowning the measured signal in noise. (3) Color Card Calibration Issues Each set of standard color cards has a service life. After a period of use, color deviation and discoloration are likely to occur, requiring cleaning, maintenance, or replacement. Color detection is widely used in industrial, production automation, and office automation fields. Effective, convenient, and reliable measurement of the color of the object being measured is one of the key technologies in color detection. RGB three-primary-color sensors ensure the accuracy of measurement, while the amplification circuit and the control circuit based on a single-chip microcomputer ensure the accuracy and speed of data processing. The handheld color detector described in this paper has wide applications and explores the rapid, convenient, and accurate acquisition of color information technology, which will surely promote further research on this type of technology in China. References 1 Zhang Guoxiong, Jin Zhuanzhi. Measurement and Control Circuits. Beijing: Machinery Industry Press, 2000 2 Liu Heping, Liu Lin. PIC18Fxxx Single-Chip Microcomputer Principles and Interface Principle Programming. Beijing: Beijing University of Aeronautics and Astronautics Press, 2004