Python i2c library.

Is there a Python i2c library I could use instead of using a MicroPython file? I have xbee3 network setup but on each router module I am trying to make an i2c bus with a I/O port expander on the i2c bus.

My program so far consists of a couple Python files in a project. I dont want to start a Micropython script. Is there a regular Python i2c library I could use to interface with XBee3 i2c?


I’ve not seen any sign in the documentation that I2C can be used without a MicroPython script unless you bit-bang one using regular remote IO commands. That would be painfully slow and I’d imagine difficult to make reliable. Many i2C slaves would timeout too.

I’ve just been working on a MicroPython script to access an I2C device. My script also uses regular network communications. It’s really been pretty simple to use (other than wrapping my head around Python). You could send simple instructions as messages to the router node and have the MicroPython script perform that operation on the I2C connected device.

What is your main concern with using MicroPython?

hey, welcome.

my main concern is this project ive been working on lately.

I have this Python file that imports the tkinter library to make a GUI… in the GUI I have many buttons that turn on and off LEDS (pins on my XBee3 master router node).

The program is a couple of python files.

So where MicroPython comes in is I need more I/O. For many more inputs(sensors). I have this MCP23017 i2c I/O port expander device that I have attached to my router module’s pins. (SDA TO SDA, SCL TO SCL, VCC TO VCC, GND GND, pull up resisters).

I have written some MicroPython that scans and sees the i2c slave device. I sent some byte to some register address that turned some pin on and off but I havent been able to figure out how to specifiy which I/O pins to turn on and off consistently.

And then I am concerned that I wont be able to make a button in python file using tkinter library, and in the button when clicked would import/call a Micropython function/method that would send some byte to a register address on the I/O expander slave device, thereby turning a particular pin on or off.

Any reassurances much appreciated :smiley: