Arduino Color Recognition Using TCS34725 Color Sensor and Neopixels

by RonFrtek in Circuits > Arduino

401 Views, 3 Favorites, 0 Comments

Arduino Color Recognition Using TCS34725 Color Sensor and Neopixels

Arduino Color Recognition Using TCS34725 Color Sensor and Neopixels

In this tutorial we are going to recognize a color of the paper and display this color on the Neopixel strip (8 led) using a TCS34725 Color Sensor & Arduino.

Watch the video!

What You Will Need

Neopixel strip 8 led.jpg
TCS34725.jpg
VisuinoAdvrtisemenESPNowESP32C3-1.jpg
breadboard.png
FZEK4WBK3XGYAP0.LARGE.jpg
jumper-wires.jpg
  • Arduino UNO (or any other Arduino or ESP)
  • WS2812 LED strip (8 led) or WS2812 LED Ring
  • TCS34725 Color Sensor
  • Jumper wires
  • Breadboard
  • Visuino program: Download Visuino

Brought by PCBWay

2022-08-26_13-41-18.jpg

Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.

What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!

Go check them out here. They also offer a lot of other stuff in case you might need it like assembly3D printingCNC machining and a lot more.

The Circuit

2022-10-12_18-27-41.jpg
  • Connect Color Sensor pin VCC to Arduino pin 5V
  • Connect Color Sensor pin GND to Arduino pin GND
  • Connect Color Sensor pin SCL to Arduino pin SCL
  • Connect Color Sensor pin SDA to Arduino pin SDA
  • Connect First LedStrip pin VCC to Arduino pin 5V
  • Connect First LedStrip pin GND to Arduino pin GND
  • Connect First LedStrip pin DIN to Arduino Digital pin 6

Start Visuino, and Select the Arduino UNO Board Type

Visuino-Select-Board-UNO.jpg
F5ZAEMUK36U3RS2.LARGE.jpg

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

In Visuino Add Components

2022-10-12_18-37-11.jpg
2022-10-12_18-36-45.jpg
  • Add "Color Sensor TCS34725" component
  • Add "NeoPixels" component

In Visuino Set Components

2022-10-12_18-39-11.jpg
2022-10-12_18-39-28.jpg
  • Double click on the "NeoPixels1" and in the "PixelGroups" window drag "Single Color" to the left and in the properties window set the "Count Pixels" to 8 <<this is the number of LEDs on the LED Stripe in this case it is 8
  • Close the "PixelGroups" window

In Visuino Connect Components

2022-10-12_18-43-19.jpg
  • Connect "ColorSensor1" pin I2C [Control] to Arduino pin I2C [In]
  • Connect "ColorSensor1" pin [Color] to "NeoPixels1" > "Color1" pin [Color]
  • Connect "NeoPixels1" pin Out to Arduino Digital pin 6


Generate, Compile, and Upload the Arduino Code

Visuino-Compile-UNO.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

If you power the Arduino module, and put a colored paper over the sensor the Neopixels stripe will display the paper color.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it and open it in Visuino: https://www.visuino.eu