Tca9548a + tcs34725 + Arduino MEGA not identifying the sensors

I'm trying to use the arduino mega with a TCA9548A Multiplexer and two color sensors, but I'm not able to connect the arduino with the two sensors.
When I try to scan the TCA9548A it returns that there are no I2Cs connected.


/**
   TCA9548 I2CScanner.pde -- I2C bus scanner for Arduino
   Based on code c. 2009, Tod E. Kurt, http://todbot.com/blog/
*/

#include "Wire.h"

#define TCAADDR 0x70

void tcaselect(uint8_t i) {
  if (i > 7) return;

  Wire.beginTransmission(TCAADDR);
  Wire.write(1 << i);
  Wire.endTransmission();
}


// standard Arduino setup()
void setup()
{
  Wire.begin();
  Serial.begin(9600);
  Serial.println("\nTCA9548A Scanner ready!");

  for (uint8_t t = 0; t < 8; t++) {
    tcaselect(t);
    Serial.print("TCA Port #"); Serial.println(t);

    for (uint8_t addr = 0; addr <= 127; addr++) {
      
      // Don't report on the TCA9548A itself!
      if (addr == TCAADDR) continue;

      // See whether a device is on this address
      Wire.beginTransmission(addr);

      // See if something acknowledged the transmission
      int response = Wire.endTransmission();
      if (response == 0) {
        Serial.print("Found I2C 0x");  Serial.println(addr, HEX);
      }
    }

    // Slow the loop scanner down a bit
    delay(1000);
  }
  Serial.println("\nScan completed.");
}

void loop()
{
}

I've tried in several different ways and I'm not able to use this TCA9548A.

These first logs are with the tcs34725 (color sensor) connected to the arduino without the tca9548a.
The second is with the tca9548a connected to the arduino and the color sensors connected to it.

Post data following the forum guidelines. I have a 36" monitor and I'm having problems reading your output data. Post a schematic as you have wired it, not a frizzy picture with links to "Technical" information on your hardware devices. I think the problem is fairly simple but I do not know what you have so I cannot answer it with any conficance my answer would be correct.


sadasas

Red -> sensors' SDAs.
Orange -> sensors' SCLs.
The purple cable goes to the Arduino SDA and the blue cable goes to the Arduino SCL.

Do you need any more information ?
When I connect the sensors directly to the arduino they work normally.

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