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
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
REQUIRED COMPONANTS
- TSC34725 color sensor
- Arduino Uno
- OLED display
- USB cable
- jumper wire
- Breadboard
CIRCUIT DIAGRAM
CIRCUIT BLOCK DIAGRAM
.
STEP 1
CONNECTION OF TCS34725 RGB SENSOR TO ARDUINO UNO
- VIN-5V
- GNG-GND
- SDA-A4
- SCL-A5
STEP 2
CONNECTION OF OLED TO ARDUINO UNO
- VCC-5V
- GND-GND
- SCL-A5
- 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
INSTALL REQUIRED LIBRARY
WORKING
WORKING:-
- Aurduino Uno act as main controller
- TCS34725 RGB Sensor Detect RGB value and Send data to Aurduino Uno.
- And Aurduino Uno process the data and send to OLED Display
- Both OLED And TCS34725 RGB sensor are connected using I2C communication (SDA and SCL line)
- The OLED Display shows the RGB value and shows the Detected color
APPICATION
APPLICATION
- Color sorting machine
- Used in Industries to Automaticaly sort the object based on color.
- Smart Dustbin system
- Help in wast Segregation by idetifing different type of material
- Industrial Automation
- Used in production line for quility control and color based inspection.
4 object detection system
- 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