Colorimeter with tcs34725 - Page 1
Forum section: electronics / beginners

author: seyedsaeed
author_rank: Regular Contributor
timestamp: April 02, 2020, 05:51:45 pm
content: HiI made a colorimeter with tcs34725I'm going to test the oil according to the standardstandard file ==>https://gofile.io/?c=rEi4qqAccording to color standard No. 2, the ratio of red, green and blue should be as followsR=552,G=442,B=6But the results of my experimentR=516.5058405G=343.829355B=139.6648045The light source is an 1 watt LED

author: Zero999
author_rank: Super Contributor
timestamp: April 03, 2020, 08:05:46 am
content: I haven't read that big arse PDF, but you have to take the spectrum of the light source into account. Different light sources will give different results. A cold white LED will have a lot of blue, which is probably why you measured more blue.

author: Siwastaja
author_rank: Super Contributor
timestamp: April 03, 2020, 08:22:14 am
content: Yes, the light source is critical, but you can calibrate the light source spectrum out of equation by measuring the light source directly, and calling that the baseline.Do note that TCS34725 is designed for entertainment devices, not for chemical analysis, and the spectral sensitivity curves are all over the place, for example the red seems to have a 10% relative value peak over the blue region, this is huge. You may want to play around with extra filters.

author: seyedsaeed
author_rank: Regular Contributor
timestamp: April 03, 2020, 04:45:32 pm
content: Yes, I know the light spectrum is importantBut it is said to be between 6400 and 7000 KelvinThe LED in the experiment was 6600 Kelvin

author: seyedsaeed
author_rank: Regular Contributor
timestamp: April 03, 2020, 04:52:31 pm
content: How do I calibrate the light source?Previously this device was made by someone else with tcs34725 , Unfortunately I do not have access to its information

author: Kleinstein
author_rank: Super Contributor
timestamp: April 03, 2020, 04:59:53 pm
content: The light spectrum has more to it than just the color temperature. Especially white LEDs usually have a relatively strong peak of red light and often more red and less yellow and green than normal sun light. They can still have a comparable color temperature. With the white LED one also has to specify the exact LED type. The color rendering index CRI can give an indication how much the LED spectrum is off the normal one.The more reproducible way would be using colored LEDs to define the wavelengths and than use a more normal photo-detector to record all wavelengths. One may not be limited to just the base colors for the eye.

author: seyedsaeed
author_rank: Regular Contributor
timestamp: April 03, 2020, 05:32:39 pm
content: All I know is that tcs34725 detects it 6600 Kelvin

author: Siwastaja
author_rank: Super Contributor
timestamp: April 04, 2020, 06:37:21 am
content: Kelvins are meaningless. You need to do a bit of homework on this.

author: seyedsaeed
author_rank: Regular Contributor
timestamp: April 04, 2020, 07:32:36 am
content: What do you mean?Do you have a suggestion or sensor for my work?

author: Siwastaja
author_rank: Super Contributor
timestamp: April 04, 2020, 08:30:55 am
content: Start here:https://en.wikipedia.org/wiki/Visible_spectrum

author: seyedsaeed
author_rank: Regular Contributor
timestamp: April 04, 2020, 09:08:13 am
content: The amount of Kelvin is proportional to the amount of red, green and bluekelvin_table = {1000: (255, 56, 0),1100: (255, 71, 0),1200: (255, 83, 0),1300: (255, 93, 0),1400: (255, 101, 0),1500: (255, 109, 0),1600: (255, 115, 0),1700: (255, 121, 0),1800: (255, 126, 0),1900: (255, 131, 0),2000: (255, 138, 18),2100: (255, 142, 33),2200: (255, 147, 44),2300: (255, 152, 54),2400: (255, 157, 63),2500: (255, 161, 72),2600: (255, 165, 79),2700: (255, 169, 87),2800: (255, 173, 94),2900: (255, 177, 101),3000: (255, 180, 107),3100: (255, 184, 114),3200: (255, 187, 120),3300: (255, 190, 126),3400: (255, 193, 132),3500: (255, 196, 137),3600: (255, 199, 143),3700: (255, 201, 148),3800: (255, 204, 153),3900: (255, 206, 159),4000: (255, 209, 163),4100: (255, 211, 168),4200: (255, 213, 173),4300: (255, 215, 177),4400: (255, 217, 182),4500: (255, 219, 186),4600: (255, 221, 190),4700: (255, 223, 194),4800: (255, 225, 198),4900: (255, 227, 202),5000: (255, 228, 206),5100: (255, 230, 210),5200: (255, 232, 213),5300: (255, 233, 217),5400: (255, 235, 220),5500: (255, 236, 224),5600: (255, 238, 227),5700: (255, 239, 230),5800: (255, 240, 233),5900: (255, 242, 236),6000: (255, 243, 239),6100: (255, 244, 242),6200: (255, 245, 245),6300: (255, 246, 247),6400: (255, 248, 251),6500: (255, 249, 253),6600: (254, 249, 255),6700: (252, 247, 255),6800: (249, 246, 255),6900: (247, 245, 255),7000: (245, 243, 255),.....}this Linkhttps://andi-siess.de/rgb-to-color-temperature/

author: iMo
author_rank: Super Contributor
timestamp: April 04, 2020, 09:40:07 am
content: Quote from: seyedsaeed on April 02, 2020, 05:51:45 pmWhat is your 1W LED? Part number?

author: Siwastaja
author_rank: Super Contributor
timestamp: April 04, 2020, 09:42:51 am
content: That table is for theoretical black body radiator, which you can't buy anywhere. In practice you can't buy a lighting product that actually has a color temperature at all (as expressed in Kelvin). Classic incandescent bulbs come fairly close, though.White LEDs or fluorescent tubesdo not have a color temperature; instead, they come with "color temperatureequivalent" also rated in Kelvins, but it only corresponds how the light kind-of-looks like on human eye. Such a table is meaningless; you need to look at the actual spectral curves for the LED you are considering.All this being said, you can calibrate the light source out of the equation. The poorly defined and overlapping filters on your chosen sensor are a bigger problem because you can't calibrate out the fact that some red light is indicated as "blue".There is another, simpler way; assuming your sample is not moving, why not use a simple photodiode or similar to just sense light, and use different wavelength LEDs (like red, green, blue, maybe yellow as well) as sources. Switch one on at a time, do a measurement. Spectrum of the LEDs is well defined and there are no extra spikes outside the main peak. This way you can easilly generate like 6-7 different samples along the spectrum, far better than just RGB.

author: seyedsaeed
author_rank: Regular Contributor
timestamp: April 04, 2020, 09:45:11 am
content: Quote from: imo on April 04, 2020, 09:40:07 amYes, but power limited with resistor

author: iMo
author_rank: Super Contributor
timestamp: April 04, 2020, 09:48:49 am
content: Your sensor has got R/G/B peaks at below wavelengths (datasheet). Try to find the LED diodes as below and use them instead of the white 1W one.Datasheet page 4.:QuoteAlso mind the "relative" response, you have to calibrate the R/G/B channels against it (see below).

author: Zero999
author_rank: Super Contributor
timestamp: April 04, 2020, 12:12:14 pm
content: The LED doesn't produce a continuous spectrum, but will have a strong peak in the blue region, hence the stronger than expected blue reading. You need to take some real samples to calibrate it properly, rather than relying on theoretical tables.https://www.cree.com/led-components/media/documents/XLampXML-11E.pdf

author: seyedsaeed
author_rank: Regular Contributor
timestamp: April 04, 2020, 05:54:43 pm
content: Quote from: Zero999 on April 04, 2020, 12:12:14 pmIf blue is more, why is this ratio of red, green, and blue without a test tube?R=339.7468354G=343.7974684B=316.4556962They are almost equal

author: Zero999
author_rank: Super Contributor
timestamp: April 04, 2020, 08:20:35 pm
content: Quote from: seyedsaeed on April 04, 2020, 05:54:43 pmBecause, according to the data sheet. the TCS34725 is the least sensitive to blue and is most sensitive to red?Note, the spectrum in my previous post is for the Cree® XLamp® XM-L range of LEDs. Your LED will might differ. Look at the data sheet.Your apparatus is totally different to what's listed in the report you linked to (for future reference please upload here, to make life easier for others). You have an LED with peaks and troughs in the spectrum and a colorimeter with an uneven response, whilst the report talks about an incandescent lamp and daylight filter and RGB values in chromaticity coordinates. Colour is a subjective phenomenon. The exact same perceived colour can be made in a variety of different ways. For example, a light with a single, sharp peak at 580nm will appear to be yellow, whilst a light with peaks both the red and green regions of the spectrum will also appear to be yellow and could actually match the apparent colour of the pure spectral yellow light, yet measure differently with the TCS34725.I don't think you should worry about the actual numbers. You have a range of samples right? So just calibrate it with each of them and do some interpolation if necessary.