OLED in Keybow 2040?


I would like to connect an I2C OLED display (ssd1306) to the Keybow 2040 keyboard connections. When I do that, circuitpython tells me there is no display at that address (0x3C or 0x3D). Is what I want to do not possible?

How and where exactly are you connecting it to the Keybow?
And which Keybow is it?

this keybow: Assembling Keybow 2040

In the plate saying Venus Dust you can see a pad with connections

Are you using gpio 4 and 5 for i2c in your code?

Why the gpio 4 and 5?
Why not use the other SDA/SCL pins on the Raspberry Pico?

I used this:

i2c = board.I2C()
import adafruit_displayio_ssd1306
from adafruit_display_text import label
display_bus = displayio.I2CDisplay(i2c, device_address=0x3D) #or =0x3C
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64)

If you check the schematic, the PICO is using GP4, pin 6 for SDA and GP 5, pin 7 for SCL. That’s the pins those pads connect too, physically.
rp2040-keybow.sch (shopify.com)

I don’t think board.I2C() will work on Pico/RP2040 as there’s more than one set of pins you can use for I2C - you’ll probably need to specify which pins you’re using.

With CircuitPython you can always do

import board

to see what friendly names we’ve given the pins in the bindings (I don’t have a Keybow to hand to check but I suspect there’ll be something like board.SDA and board.SCL that you can use).

Give this a try. If it works you’ll know what pins are used and that they are functional.

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))

Well, in the Keybow2040 examples directory there is a file (hid-keys-simple.py) with this code and it works!

import board
from keybow2040 import Keybow2040

import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode

# Set up Keybow
i2c = board.I2C()
keybow = Keybow2040(i2c)
keys = keybow.keys

# Set up the keyboard and layout
keyboard = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(keyboard)

if I add this line:

i2c2 = busio.I2C (scl=board.GP5, sda=board.GP4)

the code say:
AttributeError: object ‘module’ has no attribute ‘GP5’

I am thinking that maybe the problem is the uf2 file that corresponds to the Keybow 2040 ( https:/ /circuitpython.org/board/pimoroni_keybow2040/ ) and that it does not have all the characteristics of the raspberry pico equal to that of the raspberry pico (https:/ /circuitpython.org/board/raspberry_pi_pico/)

You might be on to something. I forget sometimes that the Keybow and RGB Keypad use Circuit Python not Micro Python. That reminded me that my RGB Keypad uses the basic Adafruit Circuit Python image not the custom Keybow package. I add lib files to that image to get it working.
Might want to have a look at this, and or contact Adafruit tech support.
adafruit/Adafruit_CircuitPython_Bundle: A bundle of useful CircuitPython libraries ready to use from the filesystem. (github.com)

Thank you for your attention. I’ll try asking the developer of the PMK library on github: GitHub - pimoroni/pmk-circuitpython

Might be worth looking at how this does it.
Adafruit MacroPad RP2040 Starter Kit - 3x4 Keys + Encoder + OLED [ADABOX019 Essentials] : ID 5128 : $49.95 : Adafruit Industries, Unique & fun DIY electronics and kits