Dear Arduino experts,
I am a Dutch art student.
For a project, I recently bought a color sensor module: TCS3200
My goal is to develop a box, that can only be opened by holding a specific color in front of the sensor module.
We connected the sensor module to an Arduino Uno, and used the following code:
This code is supposed to return a color: e.g. “Green”.
Instead, the serial monitor returns a sequence of numbers: 163,163,163, 163,163, etc.
What am I doing wrong?
Thank you for your advice, Conny
Conny_V02.ino (5.81 KB)
I've got this sensor yesterday too, but didn't run it yet.
A couple of points to consider -
on turning on/off - it takes some time, specified in datasheet to power up;
highest frequency goes beyond what arduino can detect (100% is at less than 10microseconds);
you might try freqcount library to get linear responce, I suspect you get log scale otherwise, because it's frequency not pulse length that is the information.
I have a library for the TCS230 which I think works in a similar way to the sensor you have. The library has some example code that allows it to 'recognize' colors which could be interesting for you. See the code repository link below to access the library if you are interested. If you do download, look for the PDF file that explains how to calibrate the sensor.