TCS34725 with Boron - No I2C Devices Found

Hi,

Hoping someone might have an idea why my TCS34725 sensor is not found on my Boron board. I have 3 of the TCS34725, with headers soldered on, and none of them are found on the I2C bus of the device. The LED ligth on the TCS34725 is illuminated so I know I have power. I've tried the sample code from the particle library, Adafruit_TCS34725, and no luck. Hoping someone might have an idea, below is the code I am running - falls into the "No TCS34725 found ... check your connections" and the I2C scanner reports no device found.

#include "Particle.h"
#include "Adafruit_TCS34725.h"
#include <math.h>

boolean commonAnode = false;
char szInfo[128];
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);

// Let Device OS manage the connection to the Particle Cloud
SYSTEM_MODE(AUTOMATIC);

// Run the application and system concurrently in separate threads
SYSTEM_THREAD(ENABLED);

// Show system, cloud connectivity, and application logs over USB
// View logs with CLI using 'particle serial monitor --follow'
SerialLogHandler logHandler(LOG_LEVEL_INFO,
                            {
                                {"app", LOG_LEVEL_ALL},    // Logging level for non-application messages
                                {"wiring", LOG_LEVEL_NONE} // stop ERROR: recv error 128 on wiringß
                            });

void scanner()
{
    byte error, address; // variable for error and I2C address
    int nDevices;

    Wire.begin();
    Log.info("Scanning");
    nDevices = 0;
    for (address = 1; address < 127; address++)
        delay(10);
    {
        Wire.beginTransmission(address);
        error = Wire.endTransmission();
        if (error == 0)
        {
            Log.info("I2C device found at address 0x");

            if (address < 16)
                Log.info("0");
            Log.info("Found I2C 0x" + String(address, HEX));
            nDevices++;
        }
        else if (error == 4)
        {
            Log.info("Unknown error at address 0x");
            if (address < 16)
                Log.info("0");
            Log.info("Found I2C 0x" + String(address, HEX));
        }
    }
    if (nDevices == 0)
        Log.info("No I2C devices found");
    else
        Log.info("done");
    delay(5000);
}

// setup() runs once, when the device is first turned on
void setup()
{
    // Put initialization like pinMode and begin functions here
    // Serial.begin(9600);
    waitUntil(Particle.connected);
    scanner();

    // Initialize the TCS34725
    Log.info("Checking TCS34725...");
    if (tcs.begin())
    {
        Serial.println("Found sensor");
    }
    else
    {
        Serial.println("NO TCS34725 found ... check your connections");
        while (1)
            ;
    }
}

// loop() runs over and over again, as quickly as it can execute.
void loop()
{
    // The core of your code will likely live here.

    // Example: Publish event to cloud every 10 seconds. Uncomment the next 3 lines to try it!
    // Log.info("Sending Hello World to the cloud!");
    // Particle.publish("Hello world!");
    // delay( 10 * 1000 ); // milliseconds and blocking - see docs for more info!

    Log.info("loop");

    delay(10000);
}


@jdr2023 it might help if you call Wire.begin() before calling scanner().

I added the line to the code and it does not change anything. Updated the code sample above to reflect where I added Wire.begin();. Wire.begin() is also called in the Adafruit library.

For grins I also tried the configuration on a Photon 2, same result.

It should work. If the I2C scanner isn't returning anything there are a few possibilities:

  • Wiring issue (such as SDA and SCL reversed)
  • Power issue (not 3.3V compatible, for example)
  • Device is not 100 kHz I2C compatible
  • Incorrect or missing pull-ups on SDA and SCL

Breakout boards typically have 10K pull-ups to 3V3, but if for some reason yours do not, then you'd need to add external pull-ups. If you have a DMM you can tell by powering up the breakout board not connected to the Boron and if SDL and SCL are 3.3V then the board has pull-ups.

1 Like

Thanks Rick for the input. I tried reversing the SDA and SCL to confirm the board silkscreen is correct, no difference. Tried different wires on the breadboard, also no success. Board is supposed to work from 100-400kHZ, and the wiring diagram shows 10K pull-ups on the 3v3 side of the board - so as you pointed out it should work out of the box. I can only assume at this point I received 3 defective boards from Amazon.... Have ordered replacement breakout boards from another supplier for testing later this week.

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