# OLED in Keybow 2040?

**URL:** <https://forums.pimoroni.com/t/oled-in-keybow-2040/19276>\
**Category:** Support\
**Created:** [April 9, 2022, 7:47am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276 "2022-04-09T07:47:20Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![manelto](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@manelto](https://forums.pimoroni.com/u/manelto)\
**Post date:** [April 9, 2022, 7:47am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/1 "2022-04-09T07:47:20Z")

</div>

Hello,

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?

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [April 9, 2022, 10:45am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/2 "2022-04-09T10:45:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![manelto](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@manelto](https://forums.pimoroni.com/u/manelto)\
**Post date:** [April 11, 2022, 6:20pm UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/3 "2022-04-11T18:20:37Z")

</div>

this keybow: [Assembling Keybow 2040](https://learn.pimoroni.com/article/assembling-keybow-2040)

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

 ![](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/7/704e9ea68d2e391fa687df8d5bac88bc90317e80.jpeg)

```auto

```

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [April 11, 2022, 6:48pm UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/4 "2022-04-11T18:48:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![manelto](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@manelto](https://forums.pimoroni.com/u/manelto)\
**Post date:** [April 11, 2022, 8:23pm UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/5 "2022-04-11T20:23:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [April 11, 2022, 8:27pm UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/6 "2022-04-11T20:27:18Z")

</div>

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)](https://cdn.shopify.com/s/files/1/0174/1800/files/keybow_2040_schematic.pdf?v=1629994431)

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [April 12, 2022, 8:22am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/7 "2022-04-12T08:22:27Z")

</div>

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

```auto
import board
dir(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).

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [April 12, 2022, 8:30am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/8 "2022-04-12T08:30:52Z")

</div>

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

```auto
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 !")
else:
  print('i2c devices found:',len(devices))
 
  for device in devices:  
    print("Decimal address: ",device," | Hex address: ",hex(device))

```

---

<div class="post-metadata">

**Author:** ![manelto](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@manelto](https://forums.pimoroni.com/u/manelto)\
**Post date:** [April 12, 2022, 10:05am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/9 "2022-04-12T10:05:41Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![manelto](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@manelto](https://forums.pimoroni.com/u/manelto)\
**Post date:** [April 12, 2022, 10:16am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/10 "2022-04-12T10:16:15Z")

</div>

if I add this line:  
…  
i2c2 = busio.I2C (scl=board.GP5, sda=board.GP4)  
…

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

---

<div class="post-metadata">

**Author:** ![manelto](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@manelto](https://forums.pimoroni.com/u/manelto)\
**Post date:** [April 12, 2022, 10:21am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/11 "2022-04-12T10:21:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [April 13, 2022, 8:47am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/12 "2022-04-13T08:47:05Z")

</div>

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)](https://github.com/adafruit/Adafruit_CircuitPython_Bundle)

---

<div class="post-metadata">

**Author:** ![manelto](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@manelto](https://forums.pimoroni.com/u/manelto)\
**Post date:** [April 16, 2022, 11:24am UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/13 "2022-04-16T11:24:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [April 16, 2022, 4:20pm UTC](https://forums.pimoroni.com/t/oled-in-keybow-2040/19276/14 "2022-04-16T16:20:34Z")

</div>

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](https://www.adafruit.com/product/5128)
