TCA9548A Mux and OLED's

Hi all!

New to the world of Arduino and new to the forums. I am really enjoying learning to program these board and making my own projects.
I have been working on a project for my car that will have 3 small oled's displaying weather information. As i need 3 oled's and 2 sensors i have chosen to use a multiplexer.

So i have watched a few video tutorials on using the TCA9548A and read a lot of information on it too.
But when i wire it up and run an I2C scanner i get the following:

I2C Scanner
Scanning...
Unknown error at address 0x01
Unknown error at address 0x02
Unknown error at address 0x03
Unknown error at address 0x04
Unknown error at address 0x05
Unknown error at address 0x06
Unknown error at address 0x07
Unknown error at address 0x08
Unknown error at address 0x09
Unknown error at address 0x0A
Unknown error at address 0x0B
Unknown error at address 0x0C
Unknown error at address 0x0D
Unknown error at address 0x0E
Unknown error at address 0x0F
Unknown error at address 0x10
Unknown error at address 0x11
Unknown error at address 0x12
Unknown error at address 0x13
Unknown error at address 0x14
Unknown error at address 0x15
Unknown error at address 0x16
Unknown error at address 0x17
Unknown error at address 0x18
Unknown error at address 0x19
Unknown error at address 0x1A
Unknown error at address 0x1B
Unknown error at address 0x1C
Unknown error at address 0x1D
Unknown error at address 0x1E
Unknown error at address 0x1F
Unknown error at address 0x20
Unknown error at address 0x21
Unknown error at address 0x22
Unknown error at address 0x23
Unknown error at address 0x24
Unknown error at address 0x25
Unknown error at address 0x26
Unknown error at address 0x27
Unknown error at address 0x28
Unknown error at address 0x29
Unknown error at address 0x2A
Unknown error at address 0x2B
Unknown error at address 0x2C
Unknown error at address 0x2D
Unknown error at address 0x2E
Unknown error at address 0x2F
Unknown error at address 0x30
Unknown error at address 0x31
Unknown error at address 0x32
Unknown error at address 0x33
Unknown error at address 0x34
Unknown error at address 0x35
Unknown error at address 0x36
Unknown error at address 0x37
Unknown error at address 0x38
Unknown error at address 0x39
Unknown error at address 0x3A
Unknown error at address 0x3B
Unknown error at address 0x3C
Unknown error at address 0x3D
Unknown error at address 0x3E
Unknown error at address 0x3F
Unknown error at address 0x40
Unknown error at address 0x41
Unknown error at address 0x42
Unknown error at address 0x43
Unknown error at address 0x44
Unknown error at address 0x45
Unknown error at address 0x46
Unknown error at address 0x47
Unknown error at address 0x48
Unknown error at address 0x49
Unknown error at address 0x4A
Unknown error at address 0x4B
Unknown error at address 0x4C
Unknown error at address 0x4D
Unknown error at address 0x4E
Unknown error at address 0x4F
Unknown error at address 0x50
Unknown error at address 0x51
Unknown error at address 0x52
Unknown error at address 0x53
Unknown error at address 0x54
Unknown error at address 0x55
Unknown error at address 0x56
Unknown error at address 0x57
Unknown error at address 0x58
Unknown error at address 0x59
Unknown error at address 0x5A
Unknown error at address 0x5B
Unknown error at address 0x5C
Unknown error at address 0x5D
Unknown error at address 0x5E
Unknown error at address 0x5F
Unknown error at address 0x60
Unknown error at address 0x61
Unknown error at address 0x62
Unknown error at address 0x63
Unknown error at address 0x64
Unknown error at address 0x65
Unknown error at address 0x66
Unknown error at address 0x67
Unknown error at address 0x68
Unknown error at address 0x69
Unknown error at address 0x6A
Unknown error at address 0x6B
Unknown error at address 0x6C
Unknown error at address 0x6D
Unknown error at address 0x6E
Unknown error at address 0x6F
Unknown error at address 0x70
Unknown error at address 0x71
Unknown error at address 0x72
Unknown error at address 0x73
Unknown error at address 0x74
Unknown error at address 0x75
Unknown error at address 0x76
Unknown error at address 0x77
Unknown error at address 0x78
Unknown error at address 0x79
Unknown error at address 0x7A
Unknown error at address 0x7B
Unknown error at address 0x7C
Unknown error at address 0x7D
Unknown error at address 0x7E
No I2C devices found

I have tried several different I2C scanners but get the same result every time. I read that the A0 A1 A2 pins can be put to ground to change the address of the Mux but this makes no difference.

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//
 
#include <Wire.h>
 
 
void setup()
{
  Wire.begin();
 
  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}
 
 
void loop()
{
  byte error, address;
  int nDevices;
 
  Serial.println("Scanning...");
 
  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("Unknown error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
 
  delay(5000);           // wait 5 seconds for next scan
}

I hope i have provided sufficient information. Really appreciate any help i get with this.

Cheers! :slight_smile:

I don't think any of the i2c scanner sketches out there that I have seen will work with a multiplexer. Certainly that one above will not.

The A0/1/2 pins set the address of the multiplexer itself. You have a choice of 8 addresses so you can avoid clashing with other devices or use up to 8 multiplexers.

By default, the multiplexer will "hide" all devices attached to it, until you instruct it which of the multiplexed buses to select.

For devices attached directly to the Arduino, pull-up resistors are often not needed because the Arduino's internal pull-ups are enabled. But that's probably not true for the multiplexed bus channels, so you may need to use external pull-ups there. However, many i2c modules have built-in pull-ups, so you may not need to add any external ones..

Do those displays even respond to i2c scanner? I have read that some models do not send ACK messages, which the scanner sketch needs. Try connecting one directly to the Arduino, disconnecting everything else including the multiplexer. Does the scanner see the display? If not, try some other i2c device like a sensor instead of the display.

Thank you for the reply Paul.

I attached each oled directly to the arduino (one at a time) as suggested and all 3 can be found by the scanner. 0x3C

Just tried the scanner found here - Adafruit scanner link

with the same result as above.

You seem to have no pull up resistors on the I2C lines. Are you sure you have A4 (SDA), A5 (SCL) the right way round?

How are you connecting the reset line on the TCA9548A the data sheet says

Active-low reset input. Connect to VCC or VDPUM(1) through a pull-up resistor, if not used

It is best to post a real schematic, hand drawn so we can see what you have.

Ironhide:
Just tried the scanner found here - Adafruit scanner link

Good find, that should be suitable.

So something else is wrong. Post that schematic as Mike suggests.

Grumpy_Mike:
How are you connecting the reset line on the TCA9548A the data sheet says

The AdaFruit module schematic shows 10K pull-up on reset. Also 3 X 10K pull-downs on A0,1,2.

Ironhide:
I attached each oled directly to the arduino (one at a time) as suggested and all 3 can be found by the scanner. 0x3C

Just tried the scanner found here... with the same result as above.

Oh, wait. When you say "above" did you mean above in the same post, detecting the displays at 0x3C, so everything is working? Or did above mean post #0, so not working?

PaulRB:
The AdaFruit module schematic shows 10K pull-up on reset. Also 3 X 10K pull-downs on A0,1,2.

Oh dear that dosn't bode well. I thought I would order a couple to play with from Farnell and the page had this warning on it:-

Device has limited built-in ESD protection. The leads should be shorted together or the device placed in conductive foam during storage or handling to prevent electrostatic damage to the MOS gates.

From the schematic there is no ESD protection on that board.

Thanks for the help so far, i have managed to get the scanner working:

TCAScanner ready!
TCA Port #0
TCA Port #1
TCA Port #2
TCA Port #3
TCA Port #4
TCA Port #5
TCA Port #6
TCA Port #7

done

Although i can not get it to find anything on the ports. i have tried oled's and 2 different sensors as well as another mux. I tried the 10k p/up and p/down resistors on the reset and address changing ports as suggested above but still nothing.

i will attempt to make a schematic (have not made one before).

hoping both boards aren't damaged from no ESD protection...

i will attempt to make a schematic (have not made one before).

It constantly amazes me that anyone can think of making something without first drawing a schematic. A very rookie mistake. I have been doing electronics for over 50 years and it is something I can't do. You should not even try.

Grumpy_Mike:
It constantly amazes me that anyone can think of making something without first drawing a schematic. A very rookie mistake. I have been doing electronics for over 50 years and it is something I can't do. You should not even try.

Two people asked me for a schematic. And you tell me not to even try and make one? :confused:

Either way, here is my attempt. hope it's somewhat helpful.

Two people asked me for a schematic. And you tell me not to even try and make one?

What on earth makes you think I am telling you not to make a schematic. I said:-

Grumpy_Mike:
It constantly amazes me that anyone can think of making something without first drawing a schematic.

Can you read? I was telling NEVER to make anything without first making a schematic.

Like I said a long time ago. YOU HAVE NO PULLUP RESISTORS. You need them, what makes you think you know enough to ignore this advice.

The OP schematic.

And while you are at it add some decoupling capacitors.

Grumpy_Mike:
What on earth makes you think I am telling you not to make a schematic. Can you read? I was telling NEVER to make anything without first making a schematic.

Like I said a long time ago. YOU HAVE NO PULLUP RESISTORS. You need them, what makes you think you know enough to ignore this advice.

And while you are at it add some decoupling capacitors.

Apologies, i did misunderstand what you wrote about the schematic. It's probably bad practice, but i had studied what others have done with this mux. hence no schematic.

I have not ignored your advice, tried them on the clock and data lines too. but not at the same time as having them on the address and reset lines of the mux.

Example video 1
Example video 2

This is why my circuit had no pullups originally.

You don’t need them on the address line. But you do need them on both clock and data lines. What is more you also need them on every I2C is that you create with that multiplexer. That is because when a device is not switched into the the main bus, it has its I2C lines floating and this can cause problems with how your displays work.