Hi everyone,
I recently picked up a GY-31 TCS230 TCS3200 color sensor module to try out some simple color detection with Arduino. The idea is to read RGB values from different objects and eventually use it for a sorting project.
Setup Details:
Thanks in advance for any tips. I’d like to make this stable enough for a small DIY color-sorting project.
I recently picked up a GY-31 TCS230 TCS3200 color sensor module to try out some simple color detection with Arduino. The idea is to read RGB values from different objects and eventually use it for a sorting project.
Setup Details:
- Arduino Uno
- GY-31 TCS3200 color sensor (connected with jumper wires)
- Pins S0/S1 set for scaling, S2/S3 used for filter selection (red/green/blue)
- OUT pin connected to Arduino digital input (using pulseIn() to measure frequency)
- Four onboard LEDs powered from Arduino 5V
- Test objects: red, green, and blue plastic blocks under the sensor at ~1cm distance
- The sensor gives fluctuating readings even when holding the same object in place
- Ambient light in the room seems to affect the results a lot (values shift depending on the time of day)
- Sometimes the readings for red and green overlap, making it hard to distinguish clearly
- White balance seems off — even a plain white sheet gives slightly tinted results
- Placed the sensor in a cardboard box to block out external light
- Adjusted distance between sensor and object (5mm → 20mm)
- Averaged multiple readings in code to smooth results
- Tried powering the LEDs from an external 5V source for steadier light
- Is it normal for the GY-31/TCS3200 to be this sensitive to ambient light, or am I missing a calibration step?
- What’s the best way to do white balance correction for this sensor?
- Would shielding the sensor with a non-reflective enclosure significantly improve accuracy?
- For sorting applications, do people usually rely on raw RGB values, or is it better to convert them into HSV/other color spaces?
Thanks in advance for any tips. I’d like to make this stable enough for a small DIY color-sorting project.