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
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
- 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
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 assembly, 3D printing, CNC machining and a lot more.
The Circuit
- 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
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
- Add "Color Sensor TCS34725" component
- Add "NeoPixels" component
In Visuino Set Components
- 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
- 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
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