We deside to cotstruct device to help visually impared people to identify colors. It is useful for washed socks sorting and for clothing combinations. We decide to find some schematics for color determination. The simplest way we think is to use adressable RGB LED WS2812 and chip light detector breakboard GY-302.
Fig. 1 Schematist of color deteciton test.
PCB Arduino control LED. LED emits red light (firxt cycle), and Green, Blue, all 3 colors and no color (Fig.2)
Fig.2 5 cycles of color determination.
We applied the method of recording the reflected signal by successively illuminating the object with three colors - red, green and blue, as well as three colors simultaneously, and then with all the LEDs off (measuring the background level). A photosensor with a digital interface registers 5 values - for 3 components IR, IG, IB, common when illuminated with all 3 colors IW and background IF when all illumination LEDs are off. The timing diagram is shown in Fig. 2. The received data is processed by the microcontroller - it calculates the sum of the IRGB components:
IRGB = IR + IG + IB (1)
This value is compared with the signal when all LEDs IW2 are on, and if the relative difference is greater than a certain threshold ε
ε <| IF - IR - IG - IB | / (IR + IG + IB) (2)
then the measurement result will be rejected, the device reports "Color not detected". This is the criterion for the correct operation of the measurement logic. Also, the result will be rejected if the background illumination IF exceeds a certain relative (in IRGB fractions) threshold δ δ <IF / (IR + IG + IB) (3).
We made some tests and decide to use this method of color determination.