tca9548a_diagram.jpg pca9548a-1.jpg

Supplier info

If you need to control more than one device that uses the same I2C bus, then you need the TCA9548A I2C Multiplexer 1-to-8 Breakout Board from PMD Way (with free delivery, worldwide).

With a little simple coding the TCA9548A can direct your host microcontroller to one of eight separate I2C buses.

Furthermore, the TCA9548A can also act as a level converter, so you can have varying device bus and operating voltages between 1.8 and 5V DC.

Finally, the TCA9548A supports I2C hot-swap of bus devices, and supports the usual 400 kHz operating mode used by the majority of I2C bus devices.

Inline header pins are included, but not soldered to the board.

  • 1-to-8 Bidirectional Translating Switches
  • I2C Bus and SMBus Compatible
  • Active-Low Reset Input
  • Three Address Pins, Allowing up to Eight TCA9548A Devices on the I2C Bus
  • Channel Selection Through an I2C Bus, In Any Combination
  • Power Up With All Switch Channels Deselected
  • Low RON Switches
  • Allows Voltage-Level Translation Between 1.8-V, 2.5-V, 3.3-V, and 5-V Buses
  • No Glitch on Power Up
  • Supports Hot Insertion
  • Low Standby Current
  • Operating Power-Supply Voltage Range of 1.65 V to 5.5 V
  • 5V Tolerant Inputs
  • 0- to 400-kHz Clock Frequency
  • Latch-Up Performance Exceeds 100 mA Per JESD 78, Class II
  • ESD Protection Exceeds JESD 22
    • 2000-V Human-Body Model (A114-A)
    • 200-V Machine Model (A115-A)
    • 1000-V Charged-Device Model (C101)
board.jpg

Board description

2717_Adafruit.pdf

Connections

The electrical connections are as follows (Module --- Arduino):

Arduino TCA9548A module
5V Vin
GND GND
GND A0
GND A1
GND A2
A4 SDA
A5 SCL

Using the wiring setup shown above, the the I2C bus address for the TCA9548A is set to 0x70.

tca9548a_address_table_large.jpg

Software

Use this constructor:

#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

Example code

The following is an example of using two sensors:

// Display - https://pmdway.com/collections/oled-displays/products/0-49-64-x-32-white-graphic-oled-i2c
// Guide - https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-the-0-49-64-x-32-graphic-i2c-oled-display-with-arduino
// TCA9548A - https://pmdway.com/blogs/product-guides-for-arduino/using-the-tca9548a-1-to-8-i2c-multiplexer-breakout-with-arduino
// BMP180 - https://pmdway.com/collections/altitude-sensors/products/bmp180-barometric-pressure-sensor-board
// BMP180 library - https://github.com/adafruit/Adafruit-BMP085-Library

#include <Arduino.h>
#include <U8g2lib.h>
#include <Adafruit_BMP085.h>
#include <Wire.h>

U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

Adafruit_BMP085 bmp;

int temperature;

void TCA9548A(uint8_t bus)
{
Wire.beginTransmission(0x70);  // TCA9548A address is 0x70
Wire.write(1 << bus);          // send byte to select bus
Wire.endTransmission();
}

void setup()
{
Wire.begin();
u8g2.begin();
TCA9548A(7);    // select I2C bus 7 for the BMP180
if (!bmp.begin())
{
    Serial.println("Could not find a valid BMP085 sensor, check wiring!");
    while (1) {}
}
}

void loop()
{
// first, get the temperature from the BMP180
TCA9548A(7);    // select I2C bus 7 for the BMP180
temperature = int(bmp.readTemperature());

// next, display the temperature on the OLED
TCA9548A(0); // select I2C bus 0 for the OLED
u8g2.clearBuffer();          // clear the internal memory
u8g2.setFont(u8g2_font_inb24_mr );  // choose a suitable font
u8g2.setCursor(0, 24);
u8g2.print(temperature);
u8g2.sendBuffer();
delay(100);
}
Comments: