Output Readings

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
verisca
 
Posts: 3
Joined: Wed Jul 25, 2018 12:43 pm

Output Readings

Post by verisca »

Hi,

i'm doing project using TCS34725 to detect RGB color from flame. But I did not quite understand the relation between integration time, gain and the output. The code i'm using is : Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); and Uint_16.
The result that i get now is more than 255 for R, G, B color. How I convert the output into 0 - 255 scale?

Thanks

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Output Readings

Post by adafruit_support_bill »

It is a 16 bit sensor, so the R, G, B values are in the range of 0-65535. If you want to convert to 8-bit low-res RGB, you need to discard the lower 8-bits. You can do that by simply dividing R, G and B readings by 256.

User avatar
verisca
 
Posts: 3
Joined: Wed Jul 25, 2018 12:43 pm

Re: Output Readings

Post by verisca »

Thanks a lot, it helps.

I also have anotherquestion. I choose to use Uint_16_t because I see it in this link
https://learn.adafruit.com/adafruit-col ... -reference

can you explain why it suggest to use Uint_16 instead of Uint_8?

And I cannot get the 65535 value at the max when I used white light on the RGB sensor. Is it related with the integration time and gain I used?

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Output Readings

Post by adafruit_support_bill »

can you explain why it suggest to use Uint_16 instead of Uint_8?
Because it is a high-resolution sensor and returns 16-bit values for R, G, B and C.
And I cannot get the 65535 value at the max when I used white light on the RGB sensor. Is it related with the integration time and gain I used?
Yes. Increasing the gain and/or integration time will result in higher value readings.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”