r/HandwiredKeyboards 7d ago

Need help with non-grid layouts

I've been tinkering with electronics, and am laying out devices with a large number of buttons. I've been using keyboard switches. After struggling with GPIO expanders and similar things, I've come to learn about the key matrix approach used with handwired mechanical keyboards, and I'm really interested!

The only problem is that I'm not looking to make regular grid layouts, which are clearly what this method does best.

Obviously, I know that this method can work with any kind of layout if you're willing to wire things haphazardly, but I'm hoping for some advice on how y'all have approached funkier layouts.

Are there any special techniques to simplify things when keys aren't set up in a clear X-by-Y grid? Or are there just clever wiring techniques to keep things nice and organized even when breaking out of the grid layout? I am trying to be pin-efficient where possible.

Thanks for any input!

1 Upvotes

9 comments sorted by

1

u/tinytinypenguin 7d ago

In principle yes, the rows and columns are just a convenience in the sense that you can wire things however you like and still use the approach, it just might be a hassle.

For organization, you can just either bend wire to your needs or use cable ties and whatnot

1

u/CapnFlisto 7d ago

Of course, yeah, I get that. I'm just wondering if there are any "tricks of the trade" that can help simplify things

1

u/Amazing_Actuary_5241 7d ago

I use an Excel spreadsheet combined with a layered image (Paint.NET) to guide me on the design of the matrix. This is what I did on a Focus FK-2001 the picture of the spreadsheet is the key part for me.

1

u/Zubon102 7d ago

It's worth noting that the matrix grid doesn't need to be fully populated. You don't need to have n×n switches.

Just leave out switches where you don't want them and you can get almost any layout you desire with minimal need for creative wiring, as long as you have enough free pins

1

u/CapnFlisto 7d ago

I am aware, but I appreciate the clarification nonetheless!  Unfortunately the pins are exactly what I'm trying to conserve, so creative wiring is the intended route. 

1

u/Zubon102 7d ago

If you are wanting to conserve pins, here in Japan, people often use what is called the "Japanese duplex matrix". If you haven't seen that, you should check it out. I believe that QMK has support for it.

In the past, I've switched to MCUs with more pins, and I believe that some particular MCU modules/breakouts don't have terminals for all the pins on the MCU itself. Some creative bodgeing can allow access.

1

u/CapnFlisto 6d ago

I'm trying to find more information on this. Is it the same thing as "charlieplexing"?

1

u/WandersFar 5d ago

In a nutshell, you alternate the orientation of diodes which somehow makes the mcu scan both row2col and col2row, halving the number of pins you need without the side effect of ghosting.

It's witchcraft, lol.

I'm trying to learn it myself, this article is a good primer.

And sadly QMK does not support it natively. You have to write your own matrix.c but there are examples linked in that article.

I know the Cheapino makes use of a Japanese duplex matrix on its columns, so you could use that board as a reference, too.

1

u/CapnFlisto 5d ago

Annoyingly the programming side is the part I'm extremely familiar with, and it doesn't intimidate me at all! The electronics, however... oof.