Do you have a question about the TCA9548A and is the answer not in the manual?
Questions and answers
Summary of Contents for AZ-Delivery TCA9548A
Page 1
Welcome! Thank you for purchasing our AZ-Delivery TCA9548A I2C Multiplexer Module. On the following pages, you will be introduced to how to use and set- up this handy device. Have fun!
Table of Contents Introduction....................3 Specifications....................4 The pinout.....................7 Connection schematic...................8 The connection schematic is shown on the following image:......8 How to set-up Arduino IDE................9 How to set-up the Raspberry Pi and Python..........13 Connecting the modules with Atmega328p..........14 Sketch examples..................16 Connecting the modules with Raspberry Pi..........18 Libraries and tools for Python..............20 Enabling the I2C interface................21 Python script....................23...
I2C devices to be controlled by a single host on single I2C bus. The TCA9548A chip has eight bidirectional translating switches that can be controlled through the I2C bus. The module can connect several different devices with a single microcontroller.
A0, A1 and A2 to VIN it can get different combination of the addresses. This is how an address byte of the TCA9548A looks like. First 7-bits combine to form the slave address. The last bit of the slave address defines the operation (read or write) to be performed.
Page 5
• I2C Bus and SMBus Compatible • Active-Low Reset Input • Three Address Pins, Allowing up to Eight TCA9548A Devices on the I2C • Channel Selection Through an I2C Bus, In Any Combination • Power Up With All Switch Channels Deselected • Low RON Switches •...
Page 6
Changing the I2C address of the TCA9548A The bus address of the TCA9548A is changed by using the connections to the A0, A1 and A2 pins. By default use of 0x70 address, by wiring A0-A2 to GND(LOW). Using the table below, it can be reconfigured to an address...
Connection schematic The connection schematic is shown on the following image: The schematic represents example of multiple devices connected to different channels. - 8 -...
How to set-up Arduino IDE If the Arduino IDE is not installed, follow the link and download the installation file for the operating system of choice. The Arduino IDE version used for this eBook is 1.8.13. For Windows users, double click on the downloaded .exe file and follow the instructions in the installation window.
Page 10
For Linux users, download a file with the extension .tar.xz, which has to be extracted. When it is extracted, go to the extracted directory and open the terminal in that directory. Two .sh scripts have to be executed, the first called arduino-linux-setup.sh and the second called install.sh.
Page 11
Almost all operating systems come with a text editor preinstalled (for example, Windows comes with Notepad, Linux Ubuntu comes with Gedit, Linux Raspbian comes with Leafpad, etc.). All of these text editors are perfectly fine for the purpose of the eBook. Next thing is to check if your PC can detect an Atmega328p board.
Page 12
If the Arduino IDE is used on Windows, port names are as follows: For Linux users, for example port name is /dev/ttyUSBx, where x represents integer number between 0 and 9. - 12 -...
How to set-up the Raspberry Pi and Python For the Raspberry Pi, first the operating system has to be installed, then everything has to be set-up so that it can be used in the Headless mode. The Headless mode enables remote connection to the Raspberry Pi, without the need for a PC screen Monitor, mouse or keyboard.
Connecting the modules with Atmega328p Connect the modules with the Atmega328p as shown on the following image: - 14 -...
Page 15
TCA9548A pin Wire color 5V (Atmega328p 5V) Red wire GND (Atmega328p Black wire GND) Blue wire Green wire TCA9548A pin Mc pin Wire color Red wire Black wire Blue wire Green wire OLED pin TCA9548A pin Wire color SD1 (CH1)
Connecting the modules with Raspberry Pi Connect the modules with the Raspberry Pi as shown on the following image: - 18 -...
Page 19
3.3V Red wire Black wire GPIO2 Green wire GPIO3 Blue wire A0, A1, A2 Black wire BME280(1) PIN TCA9548A pin Raspberry Pi pin Wire color Blue wire Green wire 3.3V (PIN1) Red wire GND (PIN14) Black wire BME280(2) PIN TCA9548A pin...
Libraries and tools for Python To use the module with the Raspberry Pi, the library RPi.GPIO has to be installed. If the library is already installed, running the installation command only updates the library to a newer version. To install the library, open the terminal and run the following commands, one by one: sudo apt-get update &&...
Enabling the I2C interface In order to use the module with Raspberry Pi, I2C interface has to be enabled. Open following menu: Application Menu > Preferences > Raspberry Pi Configuration In the new window, under the tab Interfaces, enable the I2C radio button, as on the following image: - 21 -...
Page 22
Before using any device connected to the I2C interface, I2C address has to be detected first. To detect the screen I2C address, following command should be run in the terminal: i2cdetect -y 1 The result should look like the following image: Where 0x70 is the I2C address of the multiplexer module.
Page 24
readdata(): bme280 = BME280(i2c_dev=smbus.SMBus(1)) print("readdata") temperature bme280.get_temperature() pressure bme280.get_pressure() humidity bme280.get_humidity() time.sleep(2) temperature bme280.get_temperature() pressure bme280.get_pressure() humidity bme280.get_humidity() print("Temperature: ",bme280.get_temperature()) print("Pressure: ",bme280.get_pressure()) print("Humidity: ",bme280.get_humidity()) return(temperature, pressure, humidity) __name__ '__main__': address 0x70 # A0 to A2 NC or GND, change as required plexer multiplex(bus) while...
Page 25
Save the script by the name tcamultiplex.py. To run the script open the terminal in the directory where the script is saved and run the following command: python3 tcamultiplex.py The result should look like on the following image: To stop the script press ‘CTRL + C’ on the keyboard. - 25 -...
Page 26
Internet. If you are looking for the high quality microelectronics and accessories, AZ-Delivery Vertriebs GmbH is the right company to get them from. You will be provided with numerous application examples, full installation guides, eBooks, libraries and assistance from our technical experts.
Need help?
Do you have a question about the TCA9548A and is the answer not in the manual?
Questions and answers