Set-up of Keybow 2040

Noob here. I just bought keybow 2040, and I can’t get it to work. I’ve followed the steps on this tutorial a couple times (CircuitPython and Keybow 2040), but it doesn’t work. Please help!

I’m sure people would be willing to help but we’re going to need a bit more details of what is happening, how it isn’t working.

For example, these are areas I could see from that page:

  • getting CircuitPython setup and the lib folder
  • the Keybow 2040 library setup
  • runnning the example.

Or something about the physical keys or LEDs not working as expected that might suggest a faulty device which you would be better contacting Pimoroni support about.

If you see any error message at any point, that would be useful to include here too. Then people can try and help with something specific either about CircuitPython or if they have a Keybow 2040 as well.

I was looking at the Keybow, I wouldn’t need the 4x4 keys but like the 3 key version but not that it uses a Raspberry Pi Zero, it seems overkill to run a Linux OS for 3 keys :). Maybe they will eventually make a Keybow 2040 kit with 3 keys.

Good luck getting this working.

So with the drivers installed, it doesn’t look like my PC is reading as a mass storage device.

I have the rainbow.py example code in the code.py file.

Here’s the example code sitting in code.py.

`# SPDX-FileCopyrightText: 2021 Sandy Macdonald

SPDX-License-Identifier: MIT

This example displays a rainbow animation on Keybow 2040’s keys.

Drop the keybow2040.py file and keybow_hardware folder

into your lib folder on your CIRCUITPY drive.

import math
from keybow2040 import Keybow2040, number_to_xy, hsv_to_rgb
from keybow_hardware.pim56x import PIM56X as Hardware # for Keybow 2040
#from keybow_hardware.pim551 import PIM551 as Hardware # for Pico RGB Keypad Base

Set up Keybow

keybow = Keybow2040(Hardware())
keys = keybow.keys

Increment step to shift animation across keys.

step = 0

while True:
# Always remember to call keybow.update() on every iteration of your loop!
keybow.update()

step += 1

for i in range(16):
    # Convert the key number to an x/y coordinate to calculate the hue
    # in a matrix style-y.
    x, y = number_to_xy(i)

    # Calculate the hue.
    hue = (x + y + (step / 20)) / 8
    hue = hue - int(hue)
    hue = hue - math.floor(hue)

    # Convert the hue to RGB values.
    r, g, b = hsv_to_rgb(hue, 1, 1)

    # Display it on the key!
    keys[i].set_led(r, g, b)

`

Is the issue that the keybow2040 library is a .mpy file instead of a .py file?

I’m just shooting in the dark here.

I looked at the page you linked to (Installing CircuitPython on Keybow 2040. It looks like you’ve done the first two parts but still need to copy the Keybow2040 library over, at least based on screenshots so far, please correct me if I have that wrong.

You need to copy the files from the GitHub page (PMK - Pimoroni Mechanical/Mushy Keypad - CircuitPython) into the folder F:\

That repository has a folder named lib/pmk, you need to copy that whole pmk folder into F:\lib if you have not done so already. This is different to the code for the rainbow.py file you have which includes the filenames from the old Github page. It might still work if you use the old page but it is probably a good idea to swap to the new one.

Hopefully that helps, if not please let us know what else you have in F:\lib on the CIRCUITPY drive. There are a lot of parts to get in the right place to get these things working, I feel for the people at Pimoroni and Adafruit who are responsible creating the instructions in the first place, they are doing a good job with a complicated topic, I think the pmk page does improve the clarity of the guide a bit but maybe they should include a short summary of the steps before the main info.

Looking at this is almost tempting me to buy a Keybow 2040, which type of keys version did you buy? Clicky, Linear (quiet) or Tactile? I have a Razer Ornata V2 keyboard that is quite clicky but it’s their own so called Mecha-Membrane design so a bit of a mix. I’m not sure which I would get.

Some extra bits:
I think these are the steps you have done:

  1. Copying the CircuitPython UF2 file to the RPI-RP2 drive, after it restarts that gets the CIRCUIT drive
  2. Downloaded the Adafruit IS31FL3731 library and copied that folder into the lib folder (F:\lib for the CIRCUITPY drive from your screenshot)

The tutorial links to the old GitHub page: https://github.com/pimoroni/keybow2040-circuitpython but that a warning of “This repository has been archived by the owner. It is now read-only.” it does include a link to the new GitHub page:

I love the Pimoroni gadgets. Like the OP, I am unfamiliar with CircuitPython and did not know its simple pattern of the device presenting a CIRCUITPY folder upon USB connection with a code.py file ready to run, libraries in a lib folder and examples in an examples folder. Somehow imagining greater complexity I fell off the happy path and had a hard time getting back on. I found this thread trying to get my Keybow 2040 to work and it helped me figure out that I just needed to rebuild the CIRCUITPY drive from scratch.

My Keybow 2040 functioned after I received it and when I first plugged it into my computer. That is, I could press a key lit the LED while pressed. I did not really realize that all I had to do was edit CIRCUITPY/code.py or drag examples from the CIRCUITPY/examples folder and looked for a Getting Started guide.

I found myself at the Pimoroni pmk-circuitpython GitHub repo following “Getting Started Quickly” but after dragging the CircuitPython 7.2.5 UF2 file into the RPI-RP2 folder per the instructions it pointed to at Keybow 2040 Download, the keybow no longer changed colors when the keys were pressed.

I kept reading the repo’s readme and attempted dragging the various CircuitPython libraries manually into the lib folder which left both the preinstalled .mpy and newly installed .py files in those folders. To get the device working again it dawned on me to delete the contents of CIRCUITPY to remove the shipped files and the files I added, reinstall the .UF2 file, reinstall all libraries, and chose one example as code.py. This is how I proceeded (for the benefit of someone else; hope I remembered these steps correctly.)

  1. Plugged the device into my computer; the computer mounted the CIRCUITPY drive
  2. Deleted everything on the CIRCUITPY drive
  3. Holding BOOTSEL, tapped RESET to get the device to mount as RPI-RP2
  4. Downloaded the UF2 file from Keybow 2040 Download to my PC
  5. Dragged the UF2 file from my PC’s downloads folder to the RPI-RP2 folder
  6. After the UF2 file finished copying, the device rebooted and the CIRCUITPY drive mounted
  7. Cloned the Github repository pimoroni/pmk-circuitpython to my local machine
  8. Dragged the repository’s lib and examples folders to the CIRCUITPY drive
  9. Cloned the Github repository adafruit/Adafruit_CircuitPython_BusDevice to my local machine
  10. Dragged the repository’s adafruit_bus_device folder to the CIRCUITPY/lib folder
  11. Cloned the Github repository adafruit/Adafruit_CircuitPython_MIDI to my local machine
  12. Dragged the repository’s adafruit_midi folder to the CIRCUITPY/lib folder
  13. Cloned the Github repository adafruit/Adafruit_CircuitPython_HID to my local machine
  14. Dragged the repository’s adafruit_hid folder to the CIRCUITPY/lib folder
  15. Cloned the Github repository adafruit/Adafruit_CircuitPython_IS31FL3731 to my local machine
  16. Dragged the repository’s adafruit_is31fl3731 folder to the CIRCUITPY/lib folder
  17. Choose the rainbow example found at CIRCUITPY/examples/rainbow.py, copied it to the root CIRCUITPY/ folder, and renamed it code.py, so that it is now CIRCUITPY/code.py. The rainbow appeared automagically after a few seconds.

This is roughly what the CIRCUITPY drive contents looked like after this:

Other comments:

The Readme at the Pimoroni pmk-cuircuitpython GitHub repo might benefit from the following change:

Unplug your Keybow 2040’s USB-C cable, press and hold the button on the top edge of Keybow 2040 while plugging the USB-C cable back into your computer to mount it as a drive (it should show up as RPI-RP2 or something similar).

→ since there are two buttons, change to and with the keypad facing up and the USB C cable on top, press and hold the button on the top edge to the right of the USB-C cable. (Yes, I really am a noob. Since the rear plate hides the button labels, printing “BOOTSEL” and “RESET” on the top of the back of the plate as a reminder which is which might be helpful. A link to a Getting Started wiki page could appear on the back plate, perhaps on one side so it can be visible or not per customer preference.)

A troubleshooting section might describe how to rebuild the CIRCUITPY folder.

Again, this noob to CircuitPython hopes this is useful or works for someone else, and is looking forward to making great use of CircuitPython and this nifty keypad. Thanks for the hard work!

Thanks for the feedback and glad to hear you got going! I’ve made a few tweaks to the Learn article - CircuitPython and Keybow 2040 and to the Github readme.

The Github docs only mention one button as the first iteration of Keybow didn’t have a RESET button - they should hopefully be a bit more helpful now :)