Grove - 8 Channel I2C Hub (TCA9548A)

https://newbrand.botshop.co.za/web/image/product.template/923/image_1920?unique=31b10ed
(0 review)

This product is no longer available.


Internal Reference: SS-013

Description

Introducing Grove - GPS (Air530), a revolutionary new tool for hobbyists. This device features 8 Grove I2C ports and can support multiple devices with the same I2C address, along with 3.3V/5V systems.

We've already released the Grove - I2C Hub (4 Port) and the Grove - I2C Hub (6 Port). Wait, still not enough? Well well, we know you are seeking more. Here you are, we present you the Grove - 8 Channel I2C Hub.

More importantly, this is more than just a superposition of port quantities. As we all know, I2C devices must use different addresses in the same bus system, even use the Grove I2C Hub (4 or 6 ports), the rule is still the rule. However, with the help of Grove - 8 Channel I2C Hub, you can plug up to 8 same-address I2C devices into the same Grove I2C system. All thanks to the TCA9548A I2C Multiplexer Chip. It adopts time-division multiplexing technology so that the same controller can control 8 I2C devices with the same address. No more worrying about address conflicts.

We have developed more than 400 Grove modules, covering a wide range of applications that can fulfill various needs. Click to explore the Grove Sensor family and get started to Grove your Idea. For all Grove users (especially beginners), we provide you with guidance PDF documents. Please download and read through Preface - Getting Started and Introduction to Grove before your use of the product.

Features

  • 8 Grove I2C Port
  • Support multiple devices with the same I2C address
  • Support 3.3V/5V System

Application

  • I2C device interface extension

Hardware connection

Connect the I2C Hub with Seeeduino XIAO's I2C interface, and connect each I2C device with each hub.

Step 1 Download the library from the resource and add the "zip" library to your Arduino IDE. Please refer to How to Install an Arduino Library.

Step 2 Find the example code and upload it to your board. Please refer to How to upload code.

Step 3 After uploading the code, you will see the I2C address of each device from the serial monitor. The address 0x70 is the I2C address of the I2C Hub.


#include "TCA9548A.h"
 
// if you use the software I2C to drive, you can uncommnet the define SOFTWAREWIRE which in TCA9548A.h. 
#ifdef SOFTWAREWIRE
  #include <SoftwareWIRE.h>
  SoftwareWire myWIRE(3, 2);
  TCA9548A<SoftwareWire> TCA;
  #define WIRE myWIRE
#else   
  #include <Wire.h>
  TCA9548A<TwoWire> TCA;
  #define WIRE Wire
#endif
 
#define SERIAL Serial
 
void setup()
{
  SERIAL.begin(115200);
  while(!SERIAL){};
 
  //WIRE.begin();
  TCA.begin(WIRE);
  //defaut all channel was closed
  //TCA.openAll();
  //TCA.closeAll();
 
  // Select the channels you want to open. You can open as many channels as you want
  TCA.openChannel(TCA_CHANNEL_0);   //TCA.closeChannel(TCA_CHANNEL_0);
  TCA.openChannel(TCA_CHANNEL_1); //TCA.closeChannel(TCA_CHANNEL_1);
  TCA.openChannel(TCA_CHANNEL_2); //TCA.closeChannel(TCA_CHANNEL_2);
  TCA.openChannel(TCA_CHANNEL_3); //TCA.closeChannel(TCA_CHANNEL_3);
  TCA.openChannel(TCA_CHANNEL_4); //TCA.closeChannel(TCA_CHANNEL_4);
  TCA.openChannel(TCA_CHANNEL_5); //TCA.closeChannel(TCA_CHANNEL_5);
  TCA.openChannel(TCA_CHANNEL_6); //TCA.closeChannel(TCA_CHANNEL_6);
  TCA.openChannel(TCA_CHANNEL_7); //TCA.closeChannel(TCA_CHANNEL_7); 
 
}
 
void loop()
{
 
  uint8_t error, i2cAddress, devCount, unCount;
 
  SERIAL.println("Scanning...");
 
  devCount = 0;
  unCount = 0;
  for(i2cAddress = 1; i2cAddress < 127; i2cAddress++ )
  {
    WIRE.beginTransmission(i2cAddress);
    error = WIRE.endTransmission();
 
    if (error == 0)
    {
      SERIAL.print("I2C device found at 0x");
      if (i2cAddress<16) SERIAL.print("0");
      SERIAL.println(i2cAddress,HEX);
      devCount++;
    }
    else if (error==4)
    {
      SERIAL.print("Unknow error at 0x");
      if (i2cAddress<16) SERIAL.print("0");
      SERIAL.println(i2cAddress,HEX);
      unCount++;
    }    
  }
 
  if (devCount + unCount == 0)
    SERIAL.println("No I2C devices found\n");
  else {
    SERIAL.print(devCount);
    SERIAL.print(" device(s) found");
    if (unCount > 0) {
      SERIAL.print(", and unknown error in ");
      SERIAL.print(unCount);
      SERIAL.print(" address");
    }
    SERIAL.println();
  }
  SERIAL.println();
  delay(1000); 
}


0