multiplexeur I2C - TCA9548A

Presentation

le multiplexeur I2C est utile lorsque l'on veut utiliser plusieurs capteurs identiques en I2C. En effet un capteur est reconnu par son adresse. Si on utilise des capteurs differents, il n'y a pas de souci, mais plusieurs capteurs identiques generent un conflit d'adressage.

 

Module multiplexeur basé sur un TCA9548A permettant de raccorder jusqu'à 8 modules I2C avec la même adresse sur le même bus I2C d'un microcontrôleur.

Il est possible de raccorder 8 multiplexeurs sur un seul microcontrôleur grâce à des adresses sélectionnables via pontets à souder ou via des niveaux logiques sur les broches dédiées. Un guide d'utilisation en anglais est disponible en fiche technique.

Remarque: ce module est livré avec deux connecteurs latéraux à souder soi-même pour une utilisation sur une plaque de montage rapide.

Caractéristiques:
Alimentation: 3 à 5 Vcc
Interface: I2C
Adresses I2C sélectionnables: 0x70 à 0x77
Dimensions: 31 x 18 x 3 mm
Poids: 1,8 g

 

Prix : 2,5 euros

 

https://www.aliexpress.com/item/1PCS-TCA9548A-I2C-Multiplexer-Breakout-board-for-chaining-Modules-NEW/32808950368.html?spm=2114.search0104.3.2.22374e3cAXJUXQ&ws_ab_test=searchweb0_0,searchweb201602_3_10152_10151_10701_10065_10344_10068_10342_10343_10340_10341_10696_10084_10083_10618_10305_10304_10307_10306_10302_10313_10059_10184_10534_100031_10103_10624_10623_10622_10621_10620-10701,searchweb201603_50,ppcSwitch_7&algo_expid=11c8f211-0c1e-4c3f-be14-1f908bae9644-0&algo_pvid=11c8f211-0c1e-4c3f-be14-1f908bae9644&priceBeautifyAB=0


datasheet

Télécharger
tca9548a.pdf
Document Adobe Acrobat 1.2 MB

exemples


codes

Source :

 

https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/wiring-and-test

 

 

 

The TCA9548A multiplexer is interesting in that it has an I2C address (0x70 by default) - and you basically send it a command to tell it which I2C multiplexed output you want to talk to, then you can address the board you want to address.

 

We suggest using this little helper to help you select the port

 

#define TCAADDR 0x70

 

void tcaselect(uint8_t i) {

if (i > 7) return;

Wire.beginTransmission(TCAADDR);

Wire.write(1 << i);

Wire.endTransmission();

}

 

You can then call tcaselect(0) thru tcaselect(7) to set up the multiplexer.

 

Note that you if you happen to have I2C devices with I2C address 0x70, you will need to short one of the Addr pins on the TCA9548 breakout to Vin in order to make it not conflict. Given that you can have 0x70 thru 0x77, just find one that's free and you're good to go!

 

 

Example Multiplexing

 

 

For example, say we want to talk to two HMC5883 breakouts. These magnetometers have a fixed address of 0x1E so you cannot have two on one I2C bus. Wire up the TCA9548 breakout so that:

 

Vin is connected to 5V (on a 3V logic Arduino/microcontroller, use 3.3V)

GND to ground

SCL to I2C clock

SDA to I2C data

 

 

 

Télécharger
code.pdf
Document Adobe Acrobat 20.0 KB