Hardware Requirement

Picture of Hardware Requirement

For this tutorial we need:
- Breadboard
- TCA9548A I2C Multiplexer
- Arduino Uno/Nano whatever is handy
- NodeMCU
- Few 0.91 & 0.96 I2C OLED displays
- Jumper Cables, and
- USB Cable to upload the code

Topics Covered

Picture of Topics Covered

We will start our discussion by understanding the basics of the I2C technology
Then we will learn about the TCA9548A Multiplexer and how the master and slave sends and receives data using the I2C technology Then we will check out how we can program and use the multiplexer in our project using Arduino and NodeMCU Next, I will show you a quick demo using 8 I2C OLED displays and finally we'll finish the tutorial by discussing the advantages and disadvantages of the TCA9548A Multiplexer

Basics of I2C Bus

Picture of Basics of I2C Bus

Picture of Basics of I2C Bus

Picture of Basics of I2C Bus

Inter-integrated Circuit pronounced I-squared-C (I²C) or I2C is a two wire bus technology (well actually 4 wires because you also need the VCC and Ground) that is used for communication between multiple processors and sensors.
The two wires are:
* SDA - Serial Data (data line) and
* SCL - Serial Clock (clock line)
Remember, both these lines are 'synchronous' 'bidirectional' 'open-drain' and are 'pulled-up with resistors'.
The I2C bus technology was originally designed by Philips Semiconductors in the early ’80s to allow easy communication between components which reside on the same circuit board.
With I2C, you can connect multiple slaves to a single master (like SPI) or you can have multiple masters controlling single, or multiple slaves. Both masters and slaves can transmit and receive data. So, a device on I2C bus can be in one of these four states:
* Master transmit – master node is sending data to a slave
* Master receive – master node is receiving data from a slave
* Slave transmit – slave node is sending data to the master
* Slave receive – slave node is receiving data from the master
I2C is a 'short distance' 'serial communication protocol', so data is transferred 'bit-by-bit' along the single wire or the SDA line. The output of bits is synchronized to the sampling of bits by a clock signal 'shared' between the master and the slave. The clock signal is always controlled by the master. The Master generates the clock and initiates communication with slaves.
So, to sum it up>
Number of Wires used: 2
Synchronous or Asynchronous: Synchronous
Serial or Parallel: Serial
Clock Signal controlled by: Master Node
Voltages used: +5 V or +3.3 V
Maximum number of Masters: Unlimited
Maximum number of Slaves: 1008
Maximum Speed: Standard Mode = 100kbps
Fast Mode = 400kbps
High Speed Mode = 3.4 Mbps
Ultra Fast Mode = 5 Mbps

TCA9548A I2C Multiplexer Module

Picture of TCA9548A I2C Multiplexer Module

Picture of TCA9548A I2C Multiplexer Module

Picture of TCA9548A I2C Multiplexer Module

TCA9548A is an eight-channel (bidirectional) I2C multiplexer which allows eight separate I2C devices to be controlled by a single host I2C bus. You just need to wire up the I2C sensors to the SCn / SDn multiplexed buses. For example, if eight identical OLED displays are needed in an application, one of each display can be connected at each of these channels: 0-7.
The Multiplexer connects to VIN, GND, SDA and SCL lines of the micro-controller. The breakout board accepts VIN from 1.65v to 5.5v. Both input SDA and SCL lines are connected to VCC through a 10K pull-up resistor (The size of the pull-up resistor is determined by the amount of capacitance on the I2C lines). The multiplexer supports both normal (100 kHz) and fast (400 kHz) I2C protocols. All I/O pins of TCA9548A are 5-volt tolerant and can also be used to translate from high to low or low to high voltages.
It is a good idea to put pull-up resistors on all channels of TCA9548A, even if the voltages are the same. The reason for this is because of the internal NMOS switch. It does not transmit high voltage very well, on the other hand it does transmits low voltages very well. The TCA9548A may also be used for Voltage Translation, allowing the use of different bus voltages on each SCn/SDn pair such that 1.8-V, 2.5-V, or 3.3-V parts can communicate with 5-V parts. This is achieved by...

Read more »