{"id":13802310,"url":"https://github.com/mcauser/micropython-tca9548a","last_synced_at":"2025-07-28T05:32:45.688Z","repository":{"id":150620709,"uuid":"299020090","full_name":"mcauser/micropython-tca9548a","owner":"mcauser","description":"MicroPython examples using TCA9548A I2C multiplexer","archived":false,"fork":false,"pushed_at":"2020-09-27T11:47:51.000Z","size":3093,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T15:50:01.388Z","etag":null,"topics":["i2c","micropython","multiplexer","tca9548a"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcauser.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-09-27T11:46:11.000Z","updated_at":"2025-02-06T20:59:56.000Z","dependencies_parsed_at":"2023-05-06T09:33:15.583Z","dependency_job_id":null,"html_url":"https://github.com/mcauser/micropython-tca9548a","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcauser/micropython-tca9548a","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-tca9548a","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-tca9548a/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-tca9548a/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-tca9548a/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcauser","download_url":"https://codeload.github.com/mcauser/micropython-tca9548a/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcauser%2Fmicropython-tca9548a/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267468377,"owners_count":24092332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["i2c","micropython","multiplexer","tca9548a"],"created_at":"2024-08-04T00:01:41.747Z","updated_at":"2025-07-28T05:32:45.248Z","avatar_url":"https://github.com/mcauser.png","language":null,"readme":"# MicroPython TCA9548A 8-Channel I2C Multiplexer\n\nA MicroPython library for the CJMCU-9548 module, featuring the TCA9548A.\nThis module lets you run multiple I2C devices with the same address on the bus,\nby spreading the conflicting devices across 8 channels and toggling between them.\n\nThe module itself is present on the I2C bus with a configurable address of 0x70-0x77 using the A0,A1,A2 pins.\nThis lets you daisy chain them and have up to 64 devices on the bus with the same address.\n\nIt features a single 8-bit register, where each bit enables each of the 8 channels.\nI2C channel 0 is enabled with the LSB and channel 7 with the MSB.\nYou can also enable multiple channels at the same time.\n\n![demo](docs/demo.jpg)\n\n## Examples\n\n```python\nfrom machine import I2C, Pin\ni2c = I2C(scl=Pin(22), sda=Pin(21))\n\n# disable all 8 channels\ni2c.writeto(0x70, b'\\x00')\ni2c.scan()\n# [112] - the TCA9548A\n\n# enable channel 0 (SD0,SC0)\ni2c.writeto(0x70, b'\\x01')\ni2c.scan()\n# [60, 112] - Display 1 (SSD1306) \u0026 TCA9548A\n\n# enable channel 1 (SD1,SC1)\ni2c.writeto(0x70, b'\\x02')\ni2c.scan()\n# [60, 112] - Display 2 (SSD1306) \u0026 TCA9548A\n\n# enable channels 0 (SD0,SC0) \u0026 2 (SD2,SC2)\ni2c.writeto(0x70, b'\\x05')\ni2c.scan()\n# [60, 68, 112] - Display 1 (SSD1306) \u0026 SHT31 sensor \u0026 TCA9548A\n\n# read which channels are enabled?\ni2c.readfrom(0x70, 1)\n# b'\\x05' - channels 0 and 2 (0x05 == 0b_0000_0101)\n\n# enable all 8 channels\ni2c.writeto(0x70, b'\\xff')\n\n# disable all 8 channels\ni2c.writeto(0x70, b'\\x00')\n```\n\n![demo](docs/pins.jpg)\n\n## Two SSD1306 OLED displays\n\n```python\nfrom machine import I2C, Pin\ni2c = I2C(scl=Pin(22), sda=Pin(21))\ni2c.scan()\n# [112]\n\n# enable channel 0 (SD0,SC0)\ni2c.writeto(0x70, b'\\x01')\ni2c.scan()\n# [60, 112]\n\nimport ssd1306\noled = ssd1306.SSD1306_I2C(128, 64, i2c)\n\n# write to the first display\noled.fill(0)\noled.text('Display 1', 0, 0, 1)\noled.show()\n\n# enable channel 1 (SD1,SC1)\ni2c.writeto(0x70, b'\\x02')\n\n# init the second display\noled.init_display()\n\n# write to the second display\noled.fill(0)\noled.text('Display 2', 0, 0, 1)\noled.show()\n\n# enable channels 0 (SD0,SC0) \u0026 1 (SD1,SC1)\ni2c.writeto(0x70, b'\\x03')\n\n# write to the both displays\noled.fill(0)\noled.text('Hello', 0, 0, 1)\noled.show()\n```\n\n## I2C Address\n\nThere are three address select pins (A0,A1,A2) providing addresses 0x70-0x77 for up to 8 of these devices on the I2C bus.\n\nThe CJMCU-9548 module has pull-downs on the 3x address select pins, so you only need to connect them to VCC to change the address.\n\nA0  | A1  | A2  | I2C Address\n:---|:----|:----|:-----------\nGND | GND | GND | 0x70\n3V3 | GND | GND | 0x71\nGND | 3V3 | GND | 0x72\n3V3 | 3V3 | GND | 0x73\nGND | GND | 3V3 | 0x74\n3V3 | GND | 3V3 | 0x75\nGND | 3V3 | 3V3 | 0x76\n3V3 | 3V3 | 3V3 | 0x77\n\n## Parts\n\n* [TinyPICO](https://www.tinypico.com/) $20.00 USD\n* [TCA9548A CJMCU-9548](https://www.aliexpress.com/item/4000139869187.html) $1.23 AUD\n\n## Connections\n\n### TinyPICO ESP32\n\n```python\nfrom machine import Pin, I2C\ni2c = I2C(scl=Pin(22), sda=Pin(21))\n```\n\nTCA9548A | TinyPICO (ESP32)\n-------- | ----------------\nVIN      | 3V3\nGND      | GND\nSCL      | 22 (SCL)\nSDA      | 21 (SDA)\n\n## Links\n\n* [micropython.org](http://micropython.org)\n* [TCA9548A datasheet](docs/tca9548a.pdf)\n* [TinyPICO Getting Started](https://www.tinypico.com/gettingstarted)\n\n## License\n\nLicensed under the [MIT License](http://opensource.org/licenses/MIT).\n\nCopyright (c) 2020 Mike Causer\n","funding_links":[],"categories":["Libraries"],"sub_categories":["IO"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicropython-tca9548a","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcauser%2Fmicropython-tca9548a","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcauser%2Fmicropython-tca9548a/lists"}