Adafruit TCS34725 showing very low values

Hi, a newbie here. I am trying to use TCS34725 for a color detection project. When connected to Arduino uno, my sensor shows very low values.
Values should be between 0-65536 right? I am trying to calibrate it with black and white but I am not happy with the readings I get.

When in normal light condition my values are Color Temp: 4599 K - Lux: 54 - R: 76 G: 80 B: 64 C: 229
When exposed to black, Color Temp: 4600 K - Lux: 213 - R: 298 G: 313 B: 251 C: 925
When exposed to white, Color Temp: 4661 K - Lux: 3169 - R: 4160 G: 4520 B: 3571 C: 13214
I check my connections between the sensor and Arduino, they are all correct.

What is wrong with my sensor?

Your values are between 0 and 65536.

You haven't said what integration time you have selected.
You haven't said what "normal light condition" means - indoor/outdoor? There's about a 500:1 ratio between bright sun and indoor lighting so it really matters what
you mean...
I see the readings for white much bigger than for black, looks entirely sensible.

Can you post your code?

I am sorry about that. I am using the tcs34725 code that is in the examples of the "Adafruit_TCS34725" library.

I tested the sensor indoor.
Even though my sensor readings for white is much bigger than readings for black, when I divide them by 256 to get values between 0-256, I get RGB values like (5, 6, 6) for white. Then it is a little hard to differentiate between colors when I do color detection right?

#include <Wire.h>
#include "Adafruit_TCS34725.h"

Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X);

void setup(void) {

  if (tcs.begin()) {
    Serial.println("Found sensor");
  } else {
    Serial.println("No TCS34725 found ... check your connections");
    while (1);

void loop(void) {
  uint16_t r, g, b, c, colorTemp, lux;

  tcs.getRawData(&r, &g, &b, &c);
  colorTemp = tcs.calculateColorTemperature_dn40(r, g, b, c);
  lux = tcs.calculateLux(r, g, b);

  Serial.print("Color Temp: "); Serial.print(colorTemp, DEC); Serial.print(" K - ");
  Serial.print("Lux: "); Serial.print(lux, DEC); Serial.print(" - ");
  Serial.print("R: "); Serial.print(r, DEC); Serial.print(" ");
  Serial.print("G: "); Serial.print(g, DEC); Serial.print(" ");
  Serial.print("B: "); Serial.print(b, DEC); Serial.print(" ");
  Serial.print("C: "); Serial.print(c, DEC); Serial.print(" ");
  Serial.println(" ");

Perhaps you should up the gain from the minimum value if you are using it indoors?

Divide by a smaller number, so that the maximum result you see in any color channel is 255.

Given these measurements:

When exposed to black, Color Temp: 4600 K - Lux: 213 - R: 298 G: 313 B: 251 C: 925
When exposed to white, Color Temp: 4661 K - Lux: 3169 - R: 4160 G: 4520 B: 3571 C: 13214

a good divisor could be 4520/255 (= 18, rounded up).

The integer division results are then:

Black R: 16 G: 17 B: 13
White R: 231 G: 251 B: 198

Hey, can you please explain to me what is meant by sensor gain? Why does setting it to 4X gives better readings?

Do you know what gain means? The sensor has a photo detector (or 3 of them I guess), and then a programmable-gain amplifier, then an ADC. Changing the gain swaps resolution for headroom in bright conditions.

Setting the gain to 4X should increase the values that you measure by a factor of roughly 4, all other things being equal.

The measurement noise (random variation between individual measurements) increases, too.

Lots of helpful and important information in the TCS34725 datasheet.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.