Color Sensor TCS230

Has anyone ever got this working, I picked one up a few days ago, and used the example code from http://www.geeetech.com/wiki/index.php/Arduino_TCS230_Color_Recognition_Sensor_module

I tested the code but could not get it working correct, it would not see red at any point, and could not see the reading correct from the green and blue.
ALSO ... Some how, without changing a thing I killed my Duemilanove. It started to stop talking via USB/serial back to the PC then it would start again, and so on.
Then it just stopped and I can not get it to work at all now, I get a power light, but will not let me upload anything to it from the PC.
Lucky for me, I got another one, "but not to hand" but I do have a Mega to hand but do not want to take the chance of braking that too.

So any advice/help would be great on the sensor, I'll ask in the correct place about seeing if I can pull my Duemilanove back from the dead.

Thanks

Hello

I have written the driver for this device. Here on my github: GitHub - dalmirdasilva/ArduinoColorRecognitionDriver: ColorRecognition driver for Arduino.

I'm still adjusting it, but you can clone the repository and test it.

There is a example inside the library.

To install just type sudo make install (or copy into the correct "libraries" folder if you want).

To see the doc, type make doc. It uses doxygen to generate the documentation and will create a folder called "doc" inside the library.

Cheers!

This is the same sensor as used in the ColorHug, which is an open hardware colorimeter for PC screen calibration (see this interview where Richard mentions the chip used).

You should note that the sensor is very sensitive to infrared, so you may need a sharp IR cut filter if you want to measure visible light only.

You should note that the sensor is very sensitive to infrared, so you may need a sharp IR cut filter if you want to measure visible light only.

I are right.

My sensor is this one Recommendations For You - DealeXtreme; these 4 led on the top of the board cannot be turned off! It becomes hard to test it with black objects. I don't recommend this one.

Using the same reference you're written, my TCS230 just print unknown character in port windows, and I try using another example code, posted in http://www.elecfreaks.com/wiki/index.php?title=Color_Sensor_Module, it work well.
Note: by using the example download from http://elecfreaks.com/store/download/datasheet/sensor/TCS230/TCS230.zip as mention in the text of the given link, the color sensor didn't work. So you better follow the code written in the text, it has a little different wiring configuration, but I think this is important, for the "out" pin of TCS230

hello,
I am so new at Arduino and I got one TCS230. exactly this one https://www.kartalotomasyon.com.tr/modules/catalog/products/pr_01_10006_max.jpg . I downloaded your library now trying to get some results but couldnt get anything on screen. Can you tell me the pic connections with arduino and TCS230 please? :frowning:

You meant 'pin', right?

If yes:

Sensor -> Arduino UNO

pin OUT -> pin 2
pin S2 -> pin 3
pin S3 -> pin 4

ColorRecognitionTCS230PI tcs230(2, 3, 4);

1 Like

Thanks so much. it worked well now I got values for example:
Red: 255
Green:34
Blue:127

but when i put something totally red, it must be Red:255 Green:0 Blue:0 but it is not like this in results. what should i do for accurate results? Cover around the LEDs to protect them from outside light sources?

It is almost impossible to get values 100% accurate. But protecting the sensor from infrared light is one thing you can do to minimize the problem. Also, when it is adjusting the white and the black frequencies, is difficult to point it to something really white or black. My experience: it will never be totally accurate!

1 Like

but when i put something totally red, it must be Red:255 Green:0 Blue:0 but it is not like this in results. what should i do for accurate results?

This belief is mistaken. there is nothing you can put in front of it, which is "totally red".

The sensors need to be calibrated in your software. If you look at the pdf that comes with a library that I wrote for the sensor, you can see an explanation of how you can do that. The library is in my code repository (link below in the signature). Once calibrated they are pretty good at discriminating colors.

I already did it but couldnt get any result. when i start the Calibrate_TCS230 example, I am getting this weird result ''eanIé?*?VEÎoB² ''...and result for ColorMatch_TCS230 example is ''ãBèôºáê±?)¿1Iÿ''...I have this one, https://www.kartalotomasyon.com.tr/modules/catalog/products/pr_01_10006_max.jpg
Mine seems a bit different from yours. Problem could be pin connections? how should i do the connections according to mine?

If the result is what you see on the serial output then you need to make sure that the bit per second are the same as what the serial .begin is setting.

Oh yes! I set 57600 now and started to get results but I always read 0 for RED. I think there is a problem with connections. How can i do the pin connections?

Pin connections do not matter as long as they match what you tell the library when you start. The only pin that is important is the frequency pin, so make sure you are using the right pin as per the header file table.

The problem is I dont know so much about this stuff. How can i know this from library? What are the pin connections according to this library as original?

You pick some pins and connect them to the sensor. Then you tell the library which pins you have picked for s0, s1, etc. there is a PDF that explains the library, have you read it?

yes! right now my connections are : OUT-D5 GND-GND VCC-5V S0-D6 S1-D7 S2-12 S3-D13 OE-D8
Can you tell me this is proper connections for the original version of the lib? Because I havent changed anything in lib yet.

So now look at the example program you are running and check that the object is created with the same Pin numbers.

// Pin definitions
#define S2_OUT 12
#define S3_OUT 13
#define OE_OUT 8 // LOW = ENABLED
It is written like that in code. I did the same but I am reading 0 for RED always. Where can i find where to connect S0, S1 in the code?