DIY Color Detector: Arduino + TCS3200 Sensor + OLED Display Names the Color!

DIY Color Detector: Arduino + TCS3200 Sensor + OLED Display Names the Color! | Kids Robotics Project
Kid-Friendly Robotics Project 🌈🔍

Build a Color Detector — scan any object and watch its name pop up on screen!

This little gadget uses an Arduino UNO, a TCS3200 color sensor, and a 0.96" OLED screen, all connected with colorful jumper wires. Hold any object under the sensor, and the OLED instantly names its color — Red, Green, or Blue. Here's exactly how to build it, with the full circuit and code.

1

How a color sensor actually "sees" color

The TCS3200 doesn't take a photo — it measures light. Inside it are tiny light detectors covered with red, green, and blue filters. Each filter lets through mostly its own color of light, so by comparing how much light passes through each filter, the Arduino can work out which color is strongest and print its name.

Light filters

3 filters, 1 sensor chip

The TCS3200 switches between red, green, and blue filters super fast to measure each one in turn.

Pulses, not pictures

Reads light as a signal

Each filter reading comes out as a stream of electrical pulses — more light means a faster pulse rate.

Instant label

OLED shows the answer

The Arduino compares the three readings and prints the winning color's name straight onto the little screen.

2

What you'll need

A short, beginner-friendly parts list — everything here is common in hobby electronics starter kits.

Brain

Arduino UNO

Runs the code, talks to the color sensor, and controls the OLED display.

Eyes

TCS3200 color sensor module

Detects red, green, and blue light levels reflecting off any object placed in front of it.

Screen

0.96" OLED display (I2C, SSD1306)

Shows the detected color's name in big, easy-to-read text.

Wiring

Breadboard + colorful jumper wires

Connects everything without any soldering — color-coding the wires makes it easy to follow.

Power

USB cable

Powers the Arduino directly from a computer or a USB power bank.

Test objects

Red, green, and blue objects

LEGO bricks, colored paper, or bottle caps work great for testing the detector.

🛡️ Adult helper zone: This project uses low, safe USB power, but it's still a good idea to build alongside a grown-up, especially the first time you wire a breadboard.
3

How the circuit works

The TCS3200 needs four control pins to choose which filter it's reading, plus one output pin that sends pulses back to the Arduino. The OLED just needs two wires for I2C, since it shares the same "conversation line" style as many other small sensors.

// Color Detector wiring map
   Arduino UNO
     5V  -----------------------> VCC (TCS3200) + VCC (OLED)
     GND -----------------------> GND (TCS3200) + GND (OLED)

     D4  -----------------------> TCS3200 S0
     D5  -----------------------> TCS3200 S1
     D6  -----------------------> TCS3200 S2
     D7  -----------------------> TCS3200 S3
     D8  -----------------------> TCS3200 OUT

     A4 (SDA) -------------------> OLED SDA
     A5 (SCL) -------------------> OLED SCL
🧠 Arduino = the brain 👁️ TCS3200 = the color eye 🖥️ OLED = the answer screen
Red wire → 5V power
Black wire → GND
Yellow wire → S0
Green wire → S1
Blue wire → S2
Orange wire → S3
Purple wire → OUT
White wires → OLED (SDA/SCL)
💡
Why so many colorful wires: using a different jumper wire color for each connection makes it much easier to double-check your wiring matches the diagram before powering it on.
4

Step-by-step build

Follow these steps in order, and test after each wiring stage if you can.

Place the parts on the breadboard

Position the TCS3200 module and OLED display on the breadboard with enough space between them for wires.

Power both modules

Run a red wire from Arduino 5V and a black wire from GND to both the TCS3200 and OLED power rails.

Wire the TCS3200 control pins

Connect S0, S1, S2, and S3 to Arduino pins D4–D7 using four different colored wires, as shown in the circuit map.

Wire the sensor's output pin

Connect the TCS3200's OUT pin to Arduino pin D8 — this is the wire that carries the light readings back.

Wire the OLED display

Connect the OLED's SDA and SCL pins to Arduino A4 and A5.

Install the libraries

In the Arduino IDE, install Adafruit_SSD1306 and Adafruit_GFX through the Library Manager.

Upload the code

Paste in the sketch below, select "Arduino UNO" as your board, and click Upload.

Test with colored objects

Hold red, green, and blue objects close to the sensor one at a time and watch the OLED name each color.

5

The Arduino code

This sketch switches the TCS3200 between its red, green, and blue filters, measures each one's pulse timing, and prints whichever color came back strongest on the OLED screen.

color_detector.ino
// Color Detector — Arduino UNO + TCS3200 + OLED
// Beginner-friendly Arduino sketch

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define S0 4
#define S1 5
#define S2 6
#define S3 7
#define OUT_PIN 8

Adafruit_SSD1306 oled(128, 64, &Wire, -1);

void setup() {
  pinMode(S0, OUTPUT);
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  pinMode(OUT_PIN, INPUT);

  digitalWrite(S0, HIGH);  // 20% frequency scaling (good default)
  digitalWrite(S1, LOW);

  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  oled.setTextColor(SSD1306_WHITE);
}

long readFilter(bool s2, bool s3) {
  digitalWrite(S2, s2);
  digitalWrite(S3, s3);
  return pulseIn(OUT_PIN, LOW); // shorter pulse = stronger color
}

void loop() {
  long red   = readFilter(LOW, LOW);
  long green = readFilter(HIGH, HIGH);
  long blue  = readFilter(LOW, HIGH);

  String colorName;
  if (red < green && red < blue)       colorName = "RED";
  else if (green < red && green < blue) colorName = "GREEN";
  else                                    colorName = "BLUE";

  oled.clearDisplay();
  oled.setTextSize(1);
  oled.setCursor(10, 6);
  oled.println("Detected Color:");
  oled.setTextSize(2);
  oled.setCursor(20, 28);
  oled.println(colorName);
  oled.display();

  delay(300);
}
🧩
Make it your own: try adding "Yellow" or "White" detection by comparing all three readings together, or make the OLED background flash a matching color pattern using an extra RGB LED.
6

Frequently asked questions

Why does a shorter pulse mean a stronger color?

The TCS3200 outputs a frequency signal — more detected light means faster pulses, which show up as a shorter time between pulses when measured with pulseIn().

Does lighting affect the results?

Yes — bright, even lighting gives the most reliable readings. Testing in a dim room or with a shadow over the sensor can throw off the comparison.

Can it detect more than just red, green, and blue?

Yes, with more advanced code — comparing the three raw readings together (instead of just picking the smallest) lets you detect colors like yellow, purple, or white too.

Is this project safe for kids to build?

Yes — it only uses safe, low-voltage USB power, but building alongside a grown-up is still recommended, especially for first-time breadboard wiring.

Built for curious young makers 🎨 — always build with a grown-up, and have fun scanning everything in sight!

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course