TCS34725 color sensor issue

Let me lead off by saying I am completely new to electronics in general, so please be understanding that I may not have terms memorized just yet. I'm learning, doing my best.

So I'm trying to start a project that will eventually use multiple color sensors, but for now I'm starting with just one. I have chosen a TCS34725 model (did not order the Adafruit brand, got a couple of generic multipacks from Amazon).

To describe the matter, I soldered the header pins onto one of the sensors, and decided to test what I'd done. And to put it bluntly, something isn't working. It's not just a matter of Arduinos not detecting the sensor, but the onboard white LED does not come on and after being plugged in for less than a minute, the sensor chip becomes very hot to the touch.

I have tested using both an Arduino Uno and a Nano, including trying the I2C detector sketch, which does not detect the sensor using any of the likely addresses I've found online.

I speculate since I am new to soldering that it could be a soldering issue, but no matter how closely I examine the joints, I cannot detect any bridging, and the joints appear to my somewhat-untrained eye to be okay. But if the soldering isn't wrong, I don't understand why the LED doesn't illuminate when powered, and why it gets ridiculously hot to the touch. I hesitate to solder up any more of my stock for fear of ruining them before I identify what went wonky with this first one.

Obviously something is wrong. I'm attaching a couple of pics of the chip and the solder joints. Wiring to the Arduinos seems secondary at the moment, but if that seems necessary I will add that too. I was following the many nigh-identical guides so I am very confident I was using the correct pins.

Any possibility I just had bad luck with my first chip and got a faulty one, and should solder header pins to others? Or was this my rookie mistake? Pics here (as close as my phone would take without getting blurry):


Your solder job looks ok. What we need to see is outlined in the Pinned post you should have read first called 'How to get the most from the forum'.
In this case, take a picture of a hand-drawn wiring diagram so we can tell where every wire and pin goes. Post that along with all your code in code tags. You can either use the icon when you reply or in the IDE, select all, then Edit / Copy for Forum (Markdown)

That usually indicates that the power was applied with reverse polarity, or the voltage is too high. The chip is probably fried.

Please post a link to the seller's product page, a wiring diagram with all pins, parts and connections clearly labeled, and photo of the actual setup.

If you are completely new, I strongly recommend buying modules from Adafruit as they have high quality, superbly engineered products and support their products with excellent getting started tutorials and professional advice.

An I2C scanner will TELL you the address of the device, you put that value in your sketch.

As I did note above, I wanted to ensure there wasn't anything amiss with the soldering, since all wiring and code was taken from the plethora of articles describing this sensor. I still can/will update my post with the request (though I didn't hand-draw anything, I just wired up according to what I found online), just noting that I was trying to start from the most obvious stuff first, not cluttering the post up with detail that wouldn't be necessary or helpful to my particular problem.

We need to see how you wired the device, do NOT replicate the instructions, draw your ACTUAL wiring.
Do NOT update, post as a reply your code, and your drawing.

The most obvious cause of the heating is you are connecting a 5V UNO or NANO to a 3.3V sensor. It is likely fried now.

That usually indicates that the power was applied with reverse polarity, or the voltage is too high. The chip is probably fried.

I know you only have my word on this but I 100% promise you I ONLY ever connected GND to one of the ground ports on the Arduinos. The data sheet for this sensor claims it can work with either 3.3V or 5V, and I tested both, with the exact same result.

Please post a link to the seller's product page, a wiring diagram with all pins, parts and connections clearly labeled, and photo of the actual setup.

The specific listing we purchased was: Amazon.com

As I mentioned in a previous reply, I'll have to update with the diagram, though, for yet another time, I'll swear up and down all I did was follow the exact wiring/pinout that's all over the internet for how to use this model of sensor.

If you are completely new, I strongly recommend buying modules from Adafruit

This is a project for my job and I was starting out with a cost-savings mindset. If these sensors I ended up with are just crap, I at least can pester my boss to to go direct to Adafruit. Although, to be fair to us, we didn't know Adafruit had these sensors at time of purchase, we just searched the model number in Amazon and got multipacks to fulfill the amount of sensors we needed.

The most obvious cause of the heating is you are connecting a 5V UNO or NANO to a 3.3V sensor. It is likely fried now.

I can accept it being fried, but I will reiterate that the datasheet for this sensor says it can accept either voltage, it has pins for both, and (again, you only have my word but I swear I'm being honest here) I ONLY ever connected 5V to 5V or 3.3V to 3.3V. I have read enough horror stories on forums like this one about voltage mismatches so I was meticulously careful to not do that.

OK, this actually touches on something I did wonder about. I found code to check a specific I2C address and tell me if it detected anything or not, but I haven't found code to actually just iterate through and output anything it found.

I found the code I mentioned in the Arduino IDE Examples under the Adafruit_TCS34725 library (i2c_address_detect). Is there scanner code in among the other example sketches as well?

Here is one I2C scanner. Your device should be 29 or 39 I think.

/* 
* i2c_port_address_scanner
* Scans ports D0 to D7 on an ESP8266 and searches for I2C device. based on the original code
* available on Arduino.cc and later improved by user Krodal and Nick Gammon (www.gammon.com.au/forum/?id=10896)
* D8 throws exceptions thus it has been left out
*
*/

#include <Wire.h>

void setup() {
  Serial.begin(115200);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\n\nI2C Scanner to scan for devices on each port pair D0 to D7");
  scanPorts();
}

uint8_t portArray[] = {16, 5, 4, 0, 2, 14, 12, 13};
//String portMap[] = {"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7"}; //for Wemos
String portMap[] = {"GPIO16", "GPIO5", "GPIO4", "GPIO0", "GPIO2", "GPIO14", "GPIO12", "GPIO13"};

void scanPorts() { 
  for (uint8_t i = 0; i < sizeof(portArray); i++) {
    for (uint8_t j = 0; j < sizeof(portArray); j++) {
      if (i != j){
        Serial.print("Scanning (SDA : SCL) - " + portMap[i] + " : " + portMap[j] + " - ");
        Wire.begin(portArray[i], portArray[j]);
        check_if_exist_I2C();
      }
    }
  }
}

void check_if_exist_I2C() {
  byte error, address;
  int nDevices;
  nDevices = 0;
  for (address = 1; address < 127; address++ )  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0){
      Serial.print("I2C device found at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.print(address, HEX);
      Serial.println("  !");

      nDevices++;
    } else if (error == 4) {
      Serial.print("Unknow error at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.println(address, HEX);
    }
  } //for loop
  if (nDevices == 0)
    Serial.println("No I2C devices found");
  else
    Serial.println("**********************************\n");
  //delay(1000);           // wait 1 seconds for next scan, did not find it necessary
}

void loop() {
}

We need to see how you wired the device, do NOT replicate the instructions, draw your ACTUAL wiring.

I have no formal training, I'm a beginner, I apologize but your request for me to hand-draw a wiring diagram just is not going to happen. I don't have the know-how to do what you want there. I don't know what to make of your insistence not to replicate instructions, as being a newbie I have nothing else I can do other than follow directions I find (such as the ones I found here: Interfacing a TCS34725 RGB Color Sensor With Arduino). Unless that's not what you meant here, but that's what it sounded like.

What I can do is add here the pics of the sensor and Arduino as I have it wired. And here is also my code, which, again, just nothing custom, it's literally the example sketch that comes with the library. But if it would be helpful...

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

/* Example code for the Adafruit TCS34725 breakout library */

/* Connect SCL    to analog 5
   Connect SDA    to analog 4
   Connect VDD    to 3.3V DC
   Connect GROUND to common ground */

/* Initialise with default values (int time = 2.4ms, gain = 1x) */
// Adafruit_TCS34725 tcs = Adafruit_TCS34725();

/* Initialise with specific int time and gain values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_614MS, TCS34725_GAIN_1X);

void setup(void) {
  Serial.begin(9600);

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

  // Now we're ready to get readings!
}

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

  tcs.getRawData(&r, &g, &b, &c);
  // colorTemp = tcs.calculateColorTemperature(r, g, b);
  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(" ");
}

Genuinely trying to work with everyone here, not be difficult, but you gotta work with what you've got, which is someone trying to self-educate without much guidance.


Here are a couple of screen grabs from the datasheet for the
TCS3472(5)



Notice the Recommended line 1 is for the TCS34725 and states that the I2C pins (SCL, SDA) MUST be 3VDC.
Both the UNO and NANO pins for SCL and SDA put out 5VDC.

Here is one I2C scanner. Your device should be 29 or 39 I think.

Awesome, thank you! Slight issue, though, in that when I tried to compile it, it threw an error:

C:\Users\Ando Valentine\AppData\Local\Temp\.arduinoIDE-unsaved2025629-28000-rqqyb.1ww1i\sketch_jul29a\sketch_jul29a.ino: In function 'void scanPorts()':
C:\Users\Ando Valentine\AppData\Local\Temp\.arduinoIDE-unsaved2025629-28000-rqqyb.1ww1i\sketch_jul29a\sketch_jul29a.ino:27:46: error: no matching function for call to 'TwoWire::begin(uint8_t&, uint8_t&)'
         Wire.begin(portArray[i], portArray[j]);
                                              ^
In file included from C:\Users\Ando Valentine\AppData\Local\Temp\.arduinoIDE-unsaved2025629-28000-rqqyb.1ww1i\sketch_jul29a\sketch_jul29a.ino:9:0:
C:\Users\Ando Valentine\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:53:10: note: candidate: void TwoWire::begin()
     void begin();
          ^~~~~
C:\Users\Ando Valentine\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:53:10: note:   candidate expects 0 arguments, 2 provided
C:\Users\Ando Valentine\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:54:10: note: candidate: void TwoWire::begin(uint8_t)
     void begin(uint8_t);
          ^~~~~
C:\Users\Ando Valentine\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:54:10: note:   candidate expects 1 argument, 2 provided
C:\Users\Ando Valentine\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:55:10: note: candidate: void TwoWire::begin(int)
     void begin(int);
          ^~~~~
C:\Users\Ando Valentine\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src/Wire.h:55:10: note:   candidate expects 1 argument, 2 provided
exit status 1

Compilation error: no matching function for call to 'TwoWire::begin(uint8_t&, uint8_t&)'

YEP, that will fry the sensor.

Please edit the error log so it is in code tags.

YEP, that will fry the sensor.

This then is not aimed at you, more of a shaking-fist-at-sky moment, but why is this the exact wiring layout literally every article I can find about this sensor demonstrates? Seriously, I've spent a few hours researching this sensor and I NEVER see anything other than this exact layout.

So if that's the problem, then, again understanding you're dealing with a newbie who's genuinely trying to learn and fix it, what kind of tweak will I need to connect to the SDA/SCL without frying it?

So does my other scanner. Never mind, the datasheet has the address for the type 5 and it is 0x29

First give me a reputable link to instructions that say it is ok to use a 5V UNO or NANO with a 3V device. Maybe there is something subtle you or I missed.

The product page does not state that the module is 5V tolerant. Here is what it states, which is incoherent:

Voltage Levels Compatible with VDD or 1.8 V Bus

If the chip overheated, assume it is dead, regardless.

1 Like