I2C SDA and SCL pins on Pi-Pico

Hi PiicoDev Team,

Exploring PiicoDev on a Pi-Pico – and using the PiicoDev Expander with the i2c connector – where in the python code do SDA and SCL get assigned to Pico pins 8 and 9 using channel 0?

And as a follow-up query, how would one then set up a second i2c chain of sensors using the Pico’s channel 1?

(I have looked through the Python files for various sensors, and missed where this happens)

Thank You.


Hi Victor,

Excellent question!!
The code defining the default I2C pins is actually behind another layer (Behind PiicoDev Unified) and relies on the defaults being used in the machine.i2c libraries baked into the firmware already on the chip (the pins are different for other dev boards like the ESP32).

To configure a second bus you would have to feed through different I2C objects(Unified takes care of all of this for you). On the backend, this process starts in between lines 41-62 on the Pico.

To create your second string of devices it’s as easy as feeding different arguments through at initialisation (Here’s on taken from the BME280’s Git repo)

sensor = PiicoDev_BME280(bus=1, freq=100000, sda=sdaPin, scl=sclPin, address=0x77)

Keen to see what you come up with, and we’re all loving the discussion!


Hey Victor,

Liam’s post looks like it covers it (and he’s one of the core guys, so he’d know!) but FYI I did a bit of digging on this a little while back too, if you’re looking for some more detail:


Hey Oliver,

Really good dive into how I2C works on the Pico, those links will also be very handy for Victor from the looks of it!



Wasn’t too sure how to do this part to change pins, kept getting an error I didn’t understand.
Anyway, solved.

And this is another way from the link @Oliver33 posted. So much info on the forums.
i2c = I2C(1, scl=Pin(3), sda=Pin(2), freq=400_000)

Getting better at Python everyday.


Wow… Great level of detail…

When learning a new topic, especially in the early stages, there can be a problem with picking the right search terms, and then understanding what one finds… often very “hit and miss” with many rabbit holes!

So the Core Forum gives excellent support, at a level that helps new users, and is amazingly responsive – from both the Core Team and key users.

Thank you everyone!

[A forum that actually supports its customers is amazing – it is unfortunate many other suppliers don’t feel this to be important, often never replying to a query]


Yeah this forum is quite good. It’s definitely a lot more than just a place for people to get their problems solved. There’s a real community vibe to it with everyone helping each other out and sharing projects they’re working on.


When investigating a Micropython driver for the SparkFun Honeywell Micro-Pressure sensor with @James46717 Here

I did find an i2c bus sniffer using a Pi-Pico on GitHub Here that helped in getting working code.

As well as being an interesting project that dives into the Pico PIO state machines to run fast enough to capture the i2c bus traffic, one can also download a .uf2 file so it is easy to try if anyone is interested.

For testing another Pico…

With an example run…Thonny/Python(left) CoolTerm/Sniffer(right)

HMPR_i2c direct bus sniffer

Can also be used with an Arduino - with a 5V to 3V3 level shifter to the Sniffer Pico…

And an example of the data log…Thonny/Sniffer(left) Arduino/sensor.ino(right)