In this tutorial we will learn how to connect multiple I2C modules on the TCA9548A I2C Multiplexer Modules.
For this project we will use 3 TCA9548A I2C Multiplexer Modules and 3 I2C Displays.
Watch the Video!
Also check out this tutorials:
Arduino Connect Multiple I2C Devices
Adafruit TCA9548A 1-to-8 I2C Multiplexer Breakout
TCA9548A I2C Multiplexer Module – With Arduino and NodeMCU
Step 1: What You Will Need
- Arduino Mega 2560 or any other Arduino board
Note: We are using Arduino Mega in this case because OLED Displays consume more memory and Aruino UNO would not be able to handle that.
So choose your board according to your modules.8-Channel I2C module
- 3X TCA9548A4
- 2X OLED Displays (or any number of other I2C modules)
- 1X I2C LCD
- Breadboard
- Jumper wires
- Visuino software: Download here
Step 2: The Circuit
- Connect All TCA9548 modules pin SDA to Arduino pin SDA
- Connect All TCA9548 modules pin SCL to Arduino pin SCL
- Connect All TCA9548 modules pin VIN to Arduino pin 5V
- Connect All TCA9548 modulesTCA9548A pin GND to Arduino pin GND
Set the I2C Address:
- 0x70 (In Visuino 112) Connect Arduino pin GND to First TCA9548A pin A0,A1,A2
- 0x71 (In Visuino 113) Connect Arduino pin GND to Second TCA9548A pin A1,A2 and Arduino pin 5V to Second TCA9548A pin A0
- 0x72 (In Visuino 114) Connect Arduino pin GND to Third TCA9548A pin A0,A2 and Arduino pin 5V to Third TCA9548A pin A1
- Connect LCD Display pin VCC to Arduino pin 5V
- Connect LCD Display pin GND to Arduino pin GND
- Connect LCD Display pin SDA to First TCA9548A pin SD0
- Connect LCD Display pin SCL to First TCA9548A pin SC0
- Connect OLED Display1 pin VCC to Arduino pin 5V
- Connect OLED Display1 pin GND to Arduino pin GND
- Connect OLED Display1 pin SDA to Second TCA9548A pin SD0
- Connect OLED Display1 pin SCL to Second TCA9548A pin SC0
- Connect OLED Display2 pin VCC to Arduino pin 5V
- Connect OLED Display2 pin GND to Arduino pin GND
- Connect OLED Display2 pin SDA to Third TCA9548A pin SD0
- Connect OLED Display2 pin SCL to Third TCA9548A pin SC0
Step 3: Start Visuino, and Select the Arduino MEGA Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the “Tools” button on the Arduino component (Picture 1) in Visuino When the dialog appears, select “Arduino Mega 2560” as shown on Picture 2
Step 4: in Visuino Add & Set Components
- Add “Liquid Crystal Display (LCD) – I2C” component
- Add 2X “OLED” component
- Add 3X “8-Channel I2C Switch TCA9548A” component
- Select “I2CSwitch1” and in the properties window set “Address” to 112
- Select “I2CSwitch2” and in the properties window set “Address” to 113
- Select “I2CSwitch3” and in the properties window set “Address” to 114
(You can use this online tool to convert Hexadecimal to Decimal)
- Double click on the “LiquidCrystalDisplay1” and in the Elements window drag “Text Field” to the left side and in the properties window set “Initial Value” to I2C-1
- Double click on the “DisplayOLED1” and in the Elements window drag “Draw Text” to the left side and in the properties window set “Size” to 3 and “Text” to I2C-2
- Double click on the “DisplayOLED2” and in the Elements window drag “Draw Text” to the left side and in the properties window set “Size” to 3 and “Text” to I2C-3
Step 5: in Visuino Connect Components
- Connect “LiquidCrystalDisplay1” pin I2C Out to “I2CSwitch1” pin I2C 0
- Connect “DisplayOLED1” pin I2C Out to “I2CSwitch2” pin I2C 0.
- Connect “DisplayOLED2” pin I2C Out to “I2CSwitch3” pin I2C 0
Note: In case you are using others modules/sensors as well then just connect their I2C pins the same way.
- Connect “I2CSwitch1” pin I2C Control to Arduino pun I2C In
- Connect “I2CSwitch2” pin I2C Control to Arduino pun I2C In
- Connect “I2CSwitch3” pin I2C Control to Arduino pun I2C In
Step 6: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the “Build” Tab, make sure the correct port is selected, then click on the “Compile/Build and Upload” button.
Step 7: Play
If you power the Arduino Mega module, the Displays will start to show the text.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it and open it in Visuino: https://www.visuino.eu
Download Multiple-I2CX3.zip