Badger 2040; i2c pins


I’m hoping to use an ICP10125 breakout with my Badger 2040, but I’m not sure what pins I should pass when initializing the PimoroniI2C library

In the example here:

It says

Breakout Garden uses pins 4 & 5 and Pico Explorer uses pins 20 & 21.

… but no mention of the Badger.

I should say my plan is to connect the ICP10125 via the QW/ST connector.

Looking at the badger schematic and comparing with the explorer hat schematic I think what is wanted is the GPIO pins for the 2040 controller with SDA as first argument and SCL as second argument. If that’s the case then I think as per the example GPIO 4 and GPIO 5 are the right pin numbers.

import pimoroni_i2c
i2c = pimoroni_i2c.PimoroniI2C(_sda_gpio_pin_here_maybe, scl_gpio_pin_here_maybe)

Can anyone confirm that is right? Or better still, teach me how to find out for myself?

Many thanks,


GPIO 4 is SDA and GPIO 5 is SCL
The following code should confirm it. Run it with the ICP10125 connected.

import machine
sda=machine.Pin(4) # Explorer 20 Breakout 4
scl=machine.Pin(5) # Explorer 21 Breakout 5
i2c=machine.I2C(0,sda=sda, scl=scl, freq=400000)
print('Scan i2c bus...')
devices = i2c.scan()
if len(devices) == 0:
  print("No i2c device !")
  print('i2c devices found:',len(devices))
  for device in devices:  
    print("Decimal address: ",device," | Hex address: ",hex(device))

The above works with the Pimoroni uf2 file. It did for me anyway on a PICO and Pico Lipo, and Tiny 2040.

The following should be what you need to use with the Pimoroni i2c library.

from pimoroni_i2c import PimoroniI2C

PINS_BREAKOUT_GARDEN = {"sda": 4, "scl": 5}
PINS_PICO_EXPLORER = {"sda": 20, "scl": 21}

Thank you.
Will confirm once the ICP10125 has arrived.
That’s a neat trick to use the PINS_BREAKOUT_GARDEN constant too.

I Have a Pico Breakout Garden, and had a Pico Explorer. It was convenient to put it that way in my code. Works with my Pico Omnibus too.

Anytime I breadboard or Proto Board I purposely use GPIO 4 and 5 for i2c. It lets me use the Pimoroni i2c library. I’m almost always using their custom uf2, with their breakouts. Why complicate things.

The following can be used,
i2c = PimoroniI2C(sda=(4), scl=(5))
in place of

There are other options to change the baud rate and specify the i2c0 or i2c1. You have to look at the pimoroni_i2c.cpp file, and do some guess work. Not something I have had to do just yet.

Thanks for this. Good to know i2c1 is an option too, although I doubt I’ll add more sensors to this particular project (want to keep it still looking like a badge).

To confirm, yes your scan code shows the device as follows.

Scan i2c bus…
i2c devices found: 1
Decimal address: 99 | Hex address: 0x63

You can have multiple devices on i2c, as long as no two devices have the same address all is good.