Pi Zero W with bare metal CircuitPython + Keybow Mini

Hi there,

I’m trying to get the Keybow Mini working with a Pi Zero W which has bare metal CircuitPython on it. I’m currently using a 9.0.0 beta of CircuitPython but have the same issues with the latest stable version 8.2.5 also so that shouldn’t be the problem.

According to Keybow Mini at Raspberry Pi GPIO Pinout the GPIO pins used for the keys are 6, 17 and 22. In the first step I just want the keys working but I only managed to make Key 3 (Pin 6) working as expected.

This is my code I used for testing the keys:

import board, digitalio, time

button = digitalio.DigitalInOut(board.D6) #works
#button = digitalio.DigitalInOut(board.D17) #doesn't work
#button = digitalio.DigitalInOut(board.D22) #doesn't work
print("initial value: " + button.value)

while True:
    if (not button.value):
        print("button pressed")
        print("button not pressed")

When I tried the different buttons/pins I realized that the initial value for pin 6 is “True” and for 17 + 22 is “False” so I tried switching the pull-mode from UP to DOWN but this didn’t work either for these two pins. On the other side for pin 6 both pull-modes work so I guess this isn’t the problem either.

I also switched the mechanical switches around to eliminate any possible faults there.

I’m scratching my head for a while now and I just have no idea what I’m missing here to get all keys functioning. Does anyone have any idea what I need to do?

Thank you!

I’m thinking that should maybe be?

button_3 = digitalio.DigitalInOut(board.D6)
button_1 = digitalio.DigitalInOut(board.D17)
button_2 = digitalio.DigitalInOut(board.D22)

As this code was just for testing I just used one variable and commented out the buttons I don’t wanted to use in that run.

Ah, OK, I see that now. I have no idea why one works and the others don’t?

Yes, key 3 (pin 6) works great and the others doesn’t… Thanks for dealing with my problem anyway…

Did you solder the header on the pi zero, or did it come pre installed?

It was presoldered. There may be an issue in loose connections but I think chances are pretty small.

It doesn’t hurt to remove and reattach the Hat / Keybow.
And make sure its firmly pressed in place.

I reattached the HAT a couple of times also. I only thing I didn’t do was using another pi. But as I used this one in other projects recently I don’t think it is damaged or something.

Might be time to e-mail Pimoroni Tech support.
Contact Us for Raspberry Pi Technical Support - Pimoroni

When you say a button does not work, can you give us the error-message? Or does it just not do what it should do?

I don’t get any error message at all there is just nothing happening.

Have you verified that the keybow is working fine if you install the standard software from Pimoroni? Just to rule out hardware-problems on the keybow.

Bare-metal CircuitPython is afaik still very experimental. So if the hardware performs fine, I would not rule out problems with CP here.

This didn’t cross my mind yet to be honest. I will give this a try and use the KeybowOS for testing the board itself.

I now tried using the KeybowOS and… It worked! The keys are working and the LEDs also. I set up some keybindings and macros and everything worked as expected.

On one hand this is great news as the board itself is totally fine but on the other side this is some kind of bummer as I still don’t know whether my code is faulty and I’m missing something or if CircuitPython itself is the problem here… :(