ARDUINO COLOR DETECTION USING TCS34725 AND OLED DISPLAY

by prajaktagumphalwar in Circuits > Arduino

437 Views, 1 Favorites, 0 Comments

ARDUINO COLOR DETECTION USING TCS34725 AND OLED DISPLAY

WhatsApp Image 2026-04-07 at 4.10.55 AM.jpeg

INTRODUCTION

Color deection is important concept of electronic and automation and automation sytem in this project we the TSC34725 RGB color sensor along aurduino and OlED display to detect and display the different color in realtime..

The TSC34725 RGB color sensor is highly accurate that measure Blue ,Red and Green value.using these value the system idetifies the color of object place in front of sensor.

Supplies

Breadboard.jpg
jumper wire.jpeg
Ardiuno uno.jpeg
OLED display.jpeg
TCs34725 RGB sensor.jpeg
WhatsApp Image 2026-04-07 at 4.02.10 AM.jpeg

REQUIRED COMPONANTS

  1. TSC34725 color sensor
  2. Arduino Uno
  3. OLED display
  4. USB cable
  5. jumper wire
  6. Breadboard

CIRCUIT DIAGRAM

CIRCUIT BLOCK DIAGRAM

+-------------------+
| |
| Arduino UNO |
| |
+---------+---------+
|
-----------------------
| |
| |
+---------------+ +---------------+
| TCS34725 | | OLED Display|
| Color Sensor | | (SSD1306) |
+---------------+ +---------------+
| |
| |
(I2C Communication: SDA & SCL)

.

STEP 1

tcs step 2.jpeg

CONNECTION OF TCS34725 RGB SENSOR TO ARDUINO UNO

  1. VIN-5V
  2. GNG-GND
  3. SDA-A4
  4. SCL-A5


STEP 2

WhatsApp Image 2026-04-07 at 3.53.53 AM.jpeg

CONNECTION OF OLED TO ARDUINO UNO

  1. VCC-5V
  2. GND-GND
  3. SCL-A5
  4. SDA-A4

CODE

CODE:-

#include <Wire.h>

#include <Adafruit_TCS34725.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>


// OLED settings

#define SCREEN_WIDTH 128

#define SCREEN_HEIGHT 64


Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);


// Color sensor

Adafruit_TCS34725 tcs = Adafruit_TCS34725();


void setup() {

Serial.begin(9600);


// Start sensor

if (!tcs.begin()) {

Serial.println("Sensor not found");

while (1);

}


tcs.setInterrupt(false); // LED ON


// Start OLED (check address 0x3C or 0x3D)

if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {

Serial.println("OLED not found");

while (1);

}


display.clearDisplay();

display.setTextSize(1);

display.setTextColor(WHITE);

}


void loop() {

uint16_t r, g, b, c;


tcs.getRawData(&r, &g, &b, &c);


// Serial output

Serial.print("R: "); Serial.print(r);

Serial.print(" G: "); Serial.print(g);

Serial.print(" B: "); Serial.print(b);

Serial.println();


// OLED display

display.clearDisplay();


display.setCursor(0,0);

display.println("Color Sensor");


display.setCursor(0,15);

display.print("R: "); display.println(r);


display.setCursor(0,30);

display.print("G: "); display.println(g);


display.setCursor(0,45);

display.print("B: "); display.println(b);


// Detect color

display.setCursor(70,30);

if (r > g && r > b) {

display.println("RED");

}

else if (g > r && g > b) {

display.println("GREEN");

}

else if (b > r && b > g) {

display.println("BLUE");

}


display.display();


delay(500);

}

IMPORTANT

Screenshot 2026-04-07 030402.png
Screenshot 2026-04-07 030650.png
Screenshot 2026-04-07 030734.png

INSTALL REQUIRED LIBRARY

WORKING

WORKING:-

  1. Aurduino Uno act as main controller
  2. TCS34725 RGB Sensor Detect RGB value and Send data to Aurduino Uno.
  3. And Aurduino Uno process the data and send to OLED Display
  4. Both OLED And TCS34725 RGB sensor are connected using I2C communication (SDA and SCL line)
  5. The OLED Display shows the RGB value and shows the Detected color

APPICATION

APPLICATION

  1. Color sorting machine
  2. Used in Industries to Automaticaly sort the object based on color.
  3. Smart Dustbin system
  4. Help in wast Segregation by idetifing different type of material
  5. Industrial Automation
  6. Used in production line for quility control and color based inspection.

4 object detection system

  1. idetifies object based on their color in robotics and Automtion

CONCLUSION

CONCLUSION

In this project we succusefully built color detection system using TCS34725 RGB sensor,Aurduino Uno and OLED Display.The system is cabale of detecting diffrent color and display Realtime RGB value.Along with Idenfied Color Name