TCS3200 Color sensor Help

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

TCS3200 Color sensor Help

Post by Jordy101091 »

Hi Guys,

I need some help related to this sensor the TCS3200 from TAOS, its a RGB color/light to frequency sensor. The problem is that I have no idea how Im going to do this.
I think I have to count the pulses over a period of time but that doesn't ring a bell. And if I manage to count pulses correctly then what does that say. what does this tell me about the color intensity, I can't find my answer in the data sheet so I'm hoping that somebody can help me with this.

unfortunately I can test this until my Final PCB arrives, if it was a DIP packages then I could but its not.

Regards Jordy

Datasheet:http://www.produktinfo.conrad.com/daten ... _SOIC8.pdf
the will to learn, should not be stopped by any price

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: TCS3200 Color sensor Help

Post by JohnCrow »

Hi Jordy

Have a look on this site.
They sell various colour sensors.
Not the same type as you have, but the site has sample code, maybe it might give you some help.

http://proto-pic.co.uk/categories/Senso ... 6-Imaging/
1 in 10 people understand binary, the other one doesn't !

Gary Freegard
Posts: 45
Joined: Mon Nov 07, 2011 6:36 pm
Has thanked: 1 time
Been thanked: 30 times
Contact:

Re: TCS3200 Color sensor Help

Post by Gary Freegard »

Hi Jordy

The details of the output is on page 4, which shows the frequency for the clear sensor at different wavelengths, and then the percentage of this frequency for each individual colour sensor.

I have created a program to measure frequencies, which you can find here http://www.matrixmultimedia.com/mmforum ... 46&t=10800

This uses a timer interrupt to start and stop a timer in counter mode, this is used to count the number of pulses in a set time period.

Hope this helps.

Gary

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: TCS3200 Color sensor Help

Post by Enamul »

Hi jordy,
Try to make a circuit using PIC 16f877a with the following connections...
LCD> PORTB0-5 (Default FC)
Connection TCS3200:
Pin5 > Vdd
Pin4> GND
Pin3> GND
Pin2> Vdd // Pin2 & pin1 scales output freq. which scales to 100%
Pin1> Vdd
These two remaining pin is very important as they will control color frequency..
Pin7>S2>RB6
Pin8>S3>RB7

you need to know the light wavelength of your test condition. i mean need to know the wavelength of the light source you are using to test..for example u r using TCS3200 and test light wavelength = 640nm..in that case clear photodiode min freq = 13.1KHz..Typ=16.4Khz..Max freq= 19.7KHz.
so Blue = min 5% to max 21% of clear freq.
Green = min 0% to max 12% of clear freq.
Red = min 84% to max 105% of clear freq.

Let's move to program design to measure color....
Program logic:
Step1: S2=H,S3=L by RB6 & 7...then measure output frequency (using FC v5 example Frequency Counter..ask me if you don't know where to find).
This will give you clear freq in test light in KHz.
Step2: S2=L,S3=H...then measure output frequency. Calculate the % value for blue in respect to clear freq.
Step3: S2=H,S3=H...then measure output frequency. Calculate the % value green in respect to clear freq.
Step3: S2=L,S3=L...then measure output frequency. Calculate the % value red in respect to clear freq.
After three different percentage you have to compute the color of test light..
You have to make a Lookup table for 255*255*255 RGB color combination using the following link..
http://www.rapidtables.com/web/color/RGB_Color.htm

what is R=255,G=255, B=255? you might think....
Blue:
0=5% freq, 255 = 21% freq
Similarly rest of the two color..

Hope this becomes clear now :)

Enamul
Attachments
imp.jpg
imp.jpg (55.13 KiB) Viewed 8821 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: TCS3200 Color sensor Help

Post by Jordy101091 »

Thanks guys for all the great comments,

I will definitely try your concept Enamul. But one thing is not clear for me, The goal is to use this sensor to determine the different colors of outdoor lighting, witch then translates into the lighting of my aquarium. I have no idea what the wavelength is of the outside light.

Unfortunately I have not received the parts or the PCB I have designed, some of them need to come from digikey USA. So hope that doesn't take to much time.

Again thanks for your concept I will let you know when the parts are here so I can start working.

Best Regards,
Jordy Kleian
the will to learn, should not be stopped by any price

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: TCS3200 Color sensor Help

Post by dazz »

Hi Jordy
unfortunately your going to have to hit the books, and the internet and look at the required light spectrum for your application, i assume you have a marine tank as you included a ph meter in your original design, light requirement will vary depending on if it's reef only, reef and fish, fish only etc. if you are trying to simulate natural daylight in the tank you will need to be selective on what wavelengths you display as different organisms require different lighting, as you know you need to encourage things like plankton, beneficial algae, whilst at the same time starving other pest type algaes of specific light wavelengths, as you know if you have corals wtc they rely on a ready supply of light and plankton and other organisms to thrive too much light and you will bleach them, also you need to mimic the daily cycles of light intensity, i did a quick google and came across this http://www.efg2.com/Lab/ScienceAndEngin ... pectra.htm , i would start there for converting rgb to wavelengths, then look up on reef forums and scientific marine websites the lighting conditions of the region your trying to mimic, also be aware that the light in europe is different to the light in say asia.

Maybe im looking too deep into it but i use commercial led lighting on my marine tanks and have noticed they promote the growth of nuisance algae and im sure its becuase they add too much light at the specific wavelength that nuicence algae thrive on, as when i used fluorescent lighting algae was at a minimum but some of the corals did not thrive. Also download every datasheet you can for commercial aquarium led lighting as sometimes they tell you what wavelengths they use then look up user comments for those products and you will begin to see what conditions you need to achieve.

Other solutions for lighting include some very well written code freely available on the web which will mimic light intensitys to time of day and even simulate clouds randomly, my aquarays will simulate a storm.

What you are trying to do is acheiveable but its going to take a lot of research to get right, i would buy a nano tank and do all you testing on that, as i have crashed a tank through not changing bulbs at the correct time and that hurts.

if you were using it for a tropical or coldwater aquarium then you have a lot more leeway as natural conditions very greatly during a day, but with marine systems they are very stable in nature
i would set up your sensor and just take measurements as you will begin to see patterns develop then use the link above to try and see how intensity and specific wavelengths work together

hope this helps


Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: TCS3200 Color sensor Help

Post by Enamul »

Hi Jordy,
If you look at the picture I have attached from your datasheet, you can notice that the response of all 4 photo-diodes change with test condition (lamda p).
Jordy101091 wrote: But one thing is not clear for me, The goal is to use this sensor to determine the different colors of outdoor lighting, witch then translates into the lighting of my aquarium. I have no idea what the wavelength is of the outside light.
You can Google for lamda..I will check for whenever I have got some time.
Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: TCS3200 Color sensor Help

Post by Jordy101091 »

Hi Enamul,

Thanks for the helpfull and information youre providing love it ;)
But I dindt ment a sea life aquarium I ment a tropical aquarium but that doesnt matter for the lighting and wavelengt that is required.
Im now soldering up my controller board if I have some time a will look into it to find a possible workaround.

I like been challanged, this problem is perfect LOL

Anyway Thanks again for your support,

Best Regards Jordy

PS. I will let you know what I have found so far.
the will to learn, should not be stopped by any price

User avatar
Jordy101091
Posts: 519
Joined: Sat Jan 08, 2011 4:02 pm
Location: The Netherlands
Has thanked: 25 times
Been thanked: 188 times
Contact:

Re: TCS3200 Color sensor Help

Post by Jordy101091 »

Enamul,

Im currently building my circuits to be proffessional made Only I have one question, in you frequency counting program your using PORTA.0 I tought that this needed to be a interupt capable pin.

If not can I use PORTA.0 Pin ???

Im going to use this controller PIC16F1938SO
This controller needs to interface the light and color sensor an LDR and the Alpha Transmitter module. The whole board is going to be battery powerd Lithium Ion cell 3.7V 2200mAh togheter with a Li-ion charger and step up boost converter.

I will upload a image of the schematic so you can have a look,

Regards Jordy
the will to learn, should not be stopped by any price

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: TCS3200 Color sensor Help

Post by Enamul »

Hi Jordy,
If you use the example frequency counter in that case you can use general purpose I/o like porta<0> as frequency source...but I have posted frequency counter using INT as clock source ...
http://www.matrixmultimedia.com/mmforum ... 49&t=11043
Enamul
University of Nottingham
enamul4mm@gmail.com

kalmar79
Posts: 45
Joined: Sun Aug 20, 2017 8:18 pm
Been thanked: 4 times
Contact:

Re: TCS3200 Color sensor Help

Post by kalmar79 »

Hello from Costa Rica, Central america. I want to learn about how to make the flowchart for a sensor color TCS3200 with a pic 16F88 and 4Mhz crystal, is possible this??
color-sensor-tcs3200.jpg
color-sensor-tcs3200.jpg (54.22 KiB) Viewed 6940 times

Post Reply