Contact Icon LIMITED OFFER: 1-year free setup for FAST Channels!
Contact us icon action

Adafruit_i2cdevice !!hot!! Jun 2026

Technically, adafruit_i2cdevice is a CircuitPython/Python helper library. It does not represent a specific piece of hardware; rather, it provides a generic class, I2CDevice , that wraps the standard busio.I2C or machine.I2C interfaces.

Its primary goal is to encapsulate the device's I2C address and lock/unlock mechanisms. Instead of passing the I2C bus object and the address every time you want to read or write, you create an I2CDevice object once and interact with it. adafruit_i2cdevice

# Define the device address SENSOR_ADDRESS = 0x48 Instead of passing the I2C bus object and

# Configure the sensor (e.g., set gain) # buffer: [Register, MSB, LSB] config_data = bytearray([self._REGISTER_CONFIG, 0x84, 0x03]) self.i2c_device.write(config_data) Notice the with device as i2c_dev: block

Notice how the main code ( adc.value ) is extremely clean? All the messy bytearray manipulation is hidden inside the class, powered by I2CDevice .

Notice the with device as i2c_dev: block. This is the . It explicitly locks the I2C bus for the duration of the block, ensuring that no other part of your code (like an interrupt or another thread) tries to use the I2C bus while you are in the middle of this transaction.

Download the latest library bundle from the Adafruit website. Find adafruit_i2cdevice.mpy and copy it to the lib folder on your CIRCUITPY drive.