This project implements a color detection system using an Arduino and the TCS3200 color sensor. The system measures the color of an object by analyzing reflected light and converting it into RGB values.
The detected color is displayed on an I2C LCD and reproduced using an RGB LED. The system includes calibration and normalization techniques to improve accuracy under varying lighting conditions.
- Convert physical light signals into digital RGB values
- Calibrate sensor readings using reference values
- Reduce the effect of ambient light through normalization
- Display results clearly on an LCD
- Reproduce detected colors using an RGB LED
The system operates as follows:
- An object is placed in front of the sensor
- The user presses a button to start the measurement
- The TCS3200 sensor outputs a frequency proportional to color intensity
- The Arduino reads the signal using pulse timing
- Raw values are calibrated and normalized
- The final RGB values are computed
- The color is identified and displayed
- The RGB LED reproduces the detected color
Arduino-Color-Detector/ │ ├── arduino_color_detector.ino ├── README.md │ └── components/ ├── tcs3200_sensor_only.ino ├── rgb_led_only.ino ├── lcd_i2c_only.ino └── button_only.ino
The components/ folder contains independent modules for each part of the system.
This folder is provided for two main purposes:
-
Troubleshooting
If the final integrated system (arduino_color_detector.ino) does not work correctly, each component can be tested separately to identify the issue. -
Reusability
Users who do not need the full system can use only the required part. For example:- Use only the sensor code
- Use only the RGB LED control
- Use only the LCD display
- Use only the button input
This makes the project modular and easier to debug and reuse.
Raw sensor values are converted using the following formula: RGB = 255 × (Raw - Black) / (White - Black)
This ensures consistent and accurate measurements across different lighting conditions.
- Arduino Mega or Arduino Uno
- TCS3200 Color Sensor
- RGB LED
- LCD I2C (16x2)
- Push button
- Resistors (220Ω recommended)
- Jumper wires
| Component | Arduino Pin |
|---|---|
| S0 | 2 |
| S1 | 3 |
| S2 | 4 |
| S3 | 5 |
| OUT | 6 |
| RED LED | 9 |
| GREEN LED | 10 |
| BLUE LED | 11 |
| BUTTON | A0 |
- Arduino IDE
- Required libraries:
- Wire.h
- LiquidCrystal_I2C.h
- math.h
- Connect the hardware components according to the pin configuration
- Open the Arduino IDE
- Install the required libraries
- Upload
arduino_color_detector.ino - Power the system
- Press the button to perform a color scan
- LCD displays the detected color name and RGB values
- RGB LED reproduces the detected color
- Red
- Green
- Blue
- Yellow
- Pink
- White
- Black
- Gray
- Sensitive to ambient lighting conditions
- Calibration must be adjusted depending on the environment
- Difficulty distinguishing similar colors (e.g., yellow vs orange)
- Measurement depends on distance between object and sensor
- Add a controlled light source
- Implement automatic calibration
- Use a higher-precision sensor
- Improve filtering and noise handling
- Add advanced color classification
Computer and Communications Engineering Student
Embedded Systems Project
This project is intended for educational purposes.