Go Down

Topic: Waveshare Color Sensor (Read 1 time) previous topic - next topic


Hey guys. First post, so bear with me. Time is of the essence, as my team will be leaving for Seattle in just over a week for a robotics competition. We are running into some problems with the color sensor.

The sensor must distinguish between: red, yellow, blue, and green "fish" (wood cutouts) to be able to correctly sort them.

We are using the Waveshare Color sensor found here. The relevant documents and User Guide are in the Wiki created by the company and the sample code is attached.

I cannot seem to get the code to distinguish between colors. Rather, if it is recognizing the colors, I do not know what I am looking at because the outputs in the Serial Monitor are not outputting RGB values between 0 and 255 (they can be much larger). I have verified that the hookup is correct to the arduino. I would also like to have the code only require white balance once at the beginning as this robot must operate on its own. Also attached is the sample of what the serial monitor is reading with a red fish in front of the sensor.

Any help is greatly appreciated.


Hi, welcome to the forum.

Sorry to disappoint you, but you should have bought a normal color sensor with a normal interface.
For example this one : http://www.adafruit.com/product/1334

Do you know if that code is any good ? Is someone else using that code ?

This uses a different way to read the sensor, it might be worth to try it : http://www.dfrobot.com/wiki/index.php/TCS3200_Color_Sensor_%28SKU:SEN0101%29

There are also libraries on Github, but it can be very tiresome to randomly try code from the internet.
It is best to find someone that has a working project with the TCS3200.

This seems to be a working project : http://www.himix.lt/?p=453
It uses yet another method, using "pulseIn()". Using "pulseIn()" is a good way to read the timing.


This code seems to do what I need it to and with some modification will give me what I need to accomplish the task at competition.

Thank you very much sir!

Go Up