I2C multiplexer library?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Posts: 1
Joined: Mon Apr 15, 2019 10:01 am

I2C multiplexer library?

Post by asuagar » Mon Apr 15, 2019 10:16 am


Is there a Micropython library for the TCA9548A or another multiplexer device? There is a library for the TCA9548A in CircuitPython. However, I am afraid that it will not work in MicroPython. Is there other way for multilplexing using MicroPython?

Thanks & regards!

User avatar
Posts: 1459
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: I2C multiplexer library?

Post by Roberthh » Mon Apr 15, 2019 2:00 pm

Circuitpython is a Micropython variant. The only thing to adapt is typcially the way it speaks to I2C. There are minor differences in the I2C API. I have sucessfully ported Adafruit libraries, and it was usually easy.

Posts: 23
Joined: Mon Jul 02, 2018 11:09 pm

Re: I2C multiplexer library?

Post by doublevee » Sun Apr 21, 2019 10:50 am

I have been using this mutliplexer in a product I am building and it is very easy to use. I'm not sure it needs a library at all? You select the I2C address for the mux using 3 external pins (can be IO driven or just hard wired). You then just write a single command to that address to select the output channel of the mux. The mux remains on that channel until either a power cycle or you issue a new channel command.

In brief, once you have your mux setup, it's a very small amount of code to add to select a particular device - almost a single line depending on your use case.

Happy to help further if needs be. I'm no expert at all but happy to try and help if needed.

Post Reply