diyfactory007.blogspot.com Open in urlscan Pro
2a00:1450:4001:80b::2001  Public Scan

URL: https://diyfactory007.blogspot.com/2018/11/tca9548a-i2c-multiplexer-module-with.html
Submission Tags: falconsandbox
Submission: On November 29 via api from US

Form analysis 1 forms found in the DOM

GET /search

<form action="/search" id="searchform" method="get">
  <input id="s" name="q" placeholder="Type and hit enter to search..." type="text">
</form>

Text Content

 * Home
 * Projects
   * Wooden Clock
   * AC Detector
   * Parking Assistant
   * Parking Assistant v2
   * YouTube Desktop Notifier
   * Automatic Garage Light
   * Solar Battery Charger
   * LAN Cable Tester
   * Birthday Surprise
 * All My Tutorials
   * 1: LDR
   * 2: Solar Charger
   * 3: Parking Assistant
   * 4: Relay
   * 5: PIR Sensor
   * 6: Garage Light
   * 7: OLED Display
   * 8: LAN Cable Tester
   * 9: TCA9548A I2C MUX
   * 10: PCF8574 GPIO Extender
   * 11: YouTube Desktop Notifier
   * 12: Birthday Surprise
   * 13. Parking Assistant v2
 * Other DIY Projects

 * Home
 * Projects
   * Wooden Clock
   * AC Detector
   * Parking Assistant
   * Parking Assistant v2
   * YouTube Desktop Notifier
   * Automatic Garage Light
   * Solar Battery Charger
   * LAN Cable Tester
   * Birthday Surprise
 * All My Tutorials
   * 1: LDR
   * 2: Solar Charger
   * 3: Parking Assistant
   * 4: Relay
   * 5: PIR Sensor
   * 6: Garage Light
   * 7: OLED Display
   * 8: LAN Cable Tester
   * 9: TCA9548A I2C MUX
   * 10: PCF8574 GPIO Extender
   * 11: YouTube Desktop Notifier
   * 12: Birthday Surprise
   * 13. Parking Assistant v2
 * Other DIY Projects



Home Tutorial TCA9548A I2C MULTIPLEXER MODULE - WITH ARDUINO AND NODEMCU


TCA9548A I2C MULTIPLEXER MODULE - WITH ARDUINO AND NODEMCU

http://diy-projects4u.blogspot.com November 09, 2018 1 comentários
Share:
 * Facebook
 * Twitter
 * Google+
 * Pinterest
 * Whatsapp






INTRO: TCA9548A I2C MULTIPLEXER MODULE - WITH ARDUINO AND NODEMCU

Did you ever get into a situation where you had to wire up two, three or more
I2C Sensors to your Arduino just to realize that the sensors have a fixed or
same I2C address. Moreover, you cannot have two devices with the same address on
the same SDA/SCL pins!
So, what are your options? Put them all on the TCA9548A 1-to-8 I2C multiplexer
to get them all talking to each other on the same bus! The TCA9548A Breakout
enables communication with multiple I2C devices that have the same address
making it simple to interface with them.




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


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

2 More Images
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

5 More Images
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 using external pull-up resistors to pull the bus up to the desired
voltage for the master and each slave channel.
If the micro-controller detects a bus conflict or other improper operation the
TCA9548A can be reset via asserting a low to the RESET pin.



TCA9548 allows a single micro-controller to communicate with up to '64 sensors'
all with the same or different I2C address by assigning a unique channel to each
sensor slave sub-bus.
When we talk about sending data over 2 wires to multiple devices we then need a
way to address them. Its same as the postman coming on a single road and
dropping the mail packets to different houses because they have different
addresses written on them.
You could have at the max 8 of these multiplexers connected together on
0x70-0x77 addresses in order to control 64 of the same I2C addressed parts. By
connecting the three address bits A0, A1 and A2 to VIN you 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. When it is high
(1), a read is selected, while a low (0) selects a write operation.




HOW THE MASTER SENDS & RECEIVES DATA


The following is the general procedure for a master to access a slave device:
1. If a master wants to send data to a slave (WRITES):
– Master-transmitter sends a START condition followed by the addresses of the
slave-receiver and R/W set to 0
– Master-transmitter sends data in the '8-bit control registers' to the
slave-receiver when the slave acknowledges that its ready
– Master-transmitter terminates the transfer with a STOP condition
2. If a master wants to receive or read data from a slave (READS):
– Master-receiver sends a START condition followed by the addresses of the
slave-receiver and R/W set to 1
– Master-receiver sends the requested register to read to slave-transmitter
– Master-receiver receives data from the slave-transmitter
- Once all bytes are received Master sends NACK signaling to the slave to halt
communications and release the bus
- Master-receiver terminates the transfer with a STOP condition
A bus is considered idle if both SDA and SCL lines are high after a STOP
condition.




CODE


Now, Int the code lets start by including the "Wire" library and by defining the
multiplexers address.
#include "Wire.h"
#include "U8glib.h"
#define MUX_Address 0x70 // TCA9548A Encoders address


Then we need to select the port we want to communicate to and send the data on
it using this function:
void selectI2CChannels(uint8_t i) {
if (i > 7) return;
Wire.beginTransmission(MUX_Address);
Wire.write(1 << i);
Wire.endTransmission();
}
Next we will initialize the display in the setup section by calling
"u8g.begin();" for each display attached to the MUX "tcaselect(i);"
Once initialized, we can then do whatever we want just by calling the function
"tcaselect(i);" where "i" is the value of the multiplexed bus and then sending
the data and clock accordingly.

ATTACHMENTS

 * Code.zip
   





I2C SCANNER


Just in case if you are not sure about the device address of your I2C shield,
then run the attached 'I2C Scanner' code to find the hex address of your device.
When loaded to an Arduino, the sketch will scan the I2C network, showing the
addresses that are responding.

ATTACHMENTS

 * I2CScanner.zip
   Download





STEP 9: WIRING AND DEMO


Wiring:
Lets start by connecting the multiplexer to a NodeMCU board. Connect:
VIN to 5V (or 3.3V)
GND to ground
SDA to D2 and
SCL to D1 pins respectively
For an Arduino board connect:
VIN to 5V (or 3.3V)
GND to ground
SDA to A4 and
SCL to A5 pins respectively
Once the MUX is hooked up to the micro-controller, you just need to connect the
sensors to the SCn / SDn pairs.
Now, lets check out this quick demo in which I have connected 8 OLED displays to
the TCA9548A Multiplexer. As these displays use I2C communication, they
communicate with the Arduino using just 2 pins.




ADVANTAGES AND DISADVANTAGES


ADVANTAGES
* Communication requires only two bus lines (wires)
* A simple master/slave relationships exist between all components
* No strict baud rate requirements like for instance with RS232, the master
generates a bus clock
* Hardware is less complicated than UARTs
* Supports multiple masters and multiple slaves
* ACK/NACK bit gives confirmation that each frame is successfully transferred
* I2C is a 'true multi-master bus' providing arbitration and collision detection
* Each device connected to the bus is software-addressable by a unique address
* Most I2C devices can communicate at 100kHz or 400kHz
* I²C is appropriate for peripherals where simplicity and low manufacturing cost
are more important than speed
* Well known and widely used protocol
DISADVANTAGES
* Slower data transfer rate than SPI
* The size of the data frame is limited to 8 bits
* More complicated hardware needed to implement than the SPI technology




THANKS




Marcadores:
0.91 oled arduino 0.96 oled arduino 128x32 OLED 128x64 OLED Arduino arduino
ssd1306 TCA9548A I2C multiplexer Tutorial

Share:
 * Facebook
 * Twitter
 * Google+
 * Pinterest
 * Whatsapp




YOU MIGHT ALSO LIKE


 * DIY - WOODEN CLOCK
   
   February 22, 2019


 * YOUTUBE DESKTOP NOTIFIER
   
   January 15, 2019


 * PCF8574 GPIO EXTENDER - WITH ARDUINO AND NODEMCU
   
   December 18, 2018




POST A COMMENT



1 COMMENT:

 1. AnonymousJanuary 1, 2019 at 4:13 AM
    
    I love this project
    
    ReplyDelete
    Replies
    Reply
    
    

Add comment

Load more...








Subscribe to: Post Comments ( Atom )


INFORMATION


TOTAL TUTORIALS: 21






POPULAR

 * DIY - ARDUINO BASED CAR PARKING ASSISTANT
   April 01, 2018
   
 * DIY - SOLAR BATTERY CHARGER
   April 01, 2018
   
 * Using an LDR Sensor with Arduino
   March 31, 2018
   
 * DIY - AUTOMATIC GARAGE LIGHT
   May 24, 2018
   
 * DRIVING A RELAY WITH AN ARDUINO
   April 01, 2018
   




ABOUT ME

Hi There!

My name is Ashish Adhikari. I am an engineer, artist & a photographer. Join me
as I share great projects, amazing photos, incredible travel life and awesome
tips for people who love the world of paintings, microcontrollers and amazing
DIY stuff!





BLOG ARCHIVE

 * ►  2020 (7)
   * ►  October (1)
   * ►  September (1)
   * ►  August (2)
   * ►  July (1)
   * ►  May (1)
   * ►  March (1)

 * ►  2019 (5)
   * ►  December (1)
   * ►  October (1)
   * ►  March (1)
   * ►  February (1)
   * ►  January (1)

 * ▼  2018 (10)
   * ►  December (1)
   * ▼  November (1)
     * TCA9548A I2C MULTIPLEXER MODULE - WITH ARDUINO AND...
   * ►  September (1)
   * ►  July (1)
   * ►  May (1)
   * ►  April (4)
   * ►  March (1)




183,100



 * 
 * 
 * 
 * 
 * 

Created By SoraTemplates | Distributed By Gooyaabi Templates

Diese Website verwendet Cookies von Google, um Dienste anzubieten und Zugriffe
zu analysieren. Deine IP-Adresse und dein User-Agent werden zusammen mit
Messwerten zur Leistung und Sicherheit für Google freigegeben. So können
Nutzungsstatistiken generiert, Missbrauchsfälle erkannt und behoben und die
Qualität des Dienstes gewährleistet werden.Weitere InformationenOK