Simple TCS34725 code to AMBIENT Color Temperature

Hi, i got a Tcs34725 module to measure ambient temperature (to adjust led temperature to match ambient) and testing sample codes (adafruit and others) seems all of them are to measure the reflected color from the build-in led.

but i'm looking to measure AMBIENT light temperature, not reflected color. using the sample codes provided by the modules the kelvin values are way way off.

anyone using it to measure ambient temperature can help out? sample code or how to change the math behind the kelvin value measurements?

Thanks in advance!

Color temperature is the temperature of an ideal black-body radiator that radiates light of a color comparable to that of a single light source.

So, the concept of "ambient", which usually refers to light from multiple sources, very likely reflected from surfaces as well, does not apply.

You can turn off the white LED in the TCS34725.

well, lets replace "ambient" by a "source of light"

the led is already off, but the temperature color value the sensor gives is based on the reflection of that led, not a direct light source on the sensor, that is the problem

No, it is not, and it makes no sense to calculate color temperature for reflected light.

The color temperature approximation is based on the readings of the three or four photodiodes (depending on which algorithm you use), assuming that they are pointed at a single light source.

Consider reading up on the topic, perhaps starting here: Color temperature - Wikipedia

but the sensor examples are made to detect the color of objects based on the led reflected light, so if the led is 3200k or 6500k the result would be very different, no?

Correct, but it is meaningless to calculate color temperature from those readings.

if the led is 3200k or 6500k the result would be very different

Yes, of course! Object "color" is relative to illumination and background.

Unfortunately, RGB values from photodiodes are not closely related to how humans perceive color, especially under different lighting conditions and local color contrast.