Every device with an integrated i2c protocol has an address associated with it. Many devices such as OLED i2C display screen usually utilize the default address of 0x27 where 0x shows the hex format of the numbers. But the address can be different in some cases. This address depends on the position of pins correlated with A0, A1, and A2 on the I2C controller on this device.

The Raspberry Pi PICO i2C

The Raspberry Pi integrates i2C controller this controller is accessible through GPIO pins of RPI-PICO. See the below schematics for the pin location. However, this connection of the master controller can be configured through multiple GPIO pins set by your code, and each i2c device that attaches to the GPIO pins should have a unique communication address, using the code below we can search and look which i2c address communicates to our i2c master controller

Scanning the i2C address with MicoPython

You just have to copy the code below and upload it to your favorite development board that supports MicroPython make sure that your i2c-supported devices and modules are already hooked to your development board such Raspberry Pi PICO. The code will scan all any i2c supported devices connected to your development board and it will determine the number of devices utilizing an i2C address on the console.

Source Code



How to Identify i2C Address in MicroPython
Tagged on:                     

Leave a Reply

Your email address will not be published. Required fields are marked *