# Keypad matrix for buttons

**URL:** <https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805>\
**Category:** Building Zynthian\
**Created:** [July 10, 2024, 5:26pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805 "2024-07-10T17:26:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 10, 2024, 5:26pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/1 "2024-07-10T17:26:54Z")

</div>

Hi,

I’m wondering if there would be a way to use these keypad matrix things?

Through MCP23017 would be fine for me.

Is anyone using something like this?

 ![H432a1cec6fd04224b666da12db0d53b7n.jpg](https://discourse.zynthian.org/uploads/default/original/2X/6/654775712361c230fdb724fd2ea31dd1668ea61f.webp)

Thank you

---

<div class="post-metadata">

**Author:** ![le51](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/le51/32/1706_2.png) [@le51](https://discourse.zynthian.org/u/le51)\
**Post date:** [July 10, 2024, 6:34pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/2 "2024-07-10T18:34:34Z")

</div>

Hey @Scabattoir welcome.

This kind of keypad doesn’t works like the Zynthian buttons.  
Zynthian use one mcp23017 GPIO per switch, this one use a matrix principle, with only 8 GPIOs for 16 buttons (4×4).  
Not impossible but some software driver has To be developped for this.

---

<div class="post-metadata">

**Author:** ![riban](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/riban/32/2331_2.png) [@riban](https://discourse.zynthian.org/u/riban)\
**Post date:** [July 10, 2024, 6:38pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/3 "2024-07-10T18:38:41Z")

</div>

But you could use a USB numeric keypad like this:

 ![image](https://discourse.zynthian.org/uploads/default/original/2X/5/59c6e8f548decc6e5678ed5b6081eb1876dc6e11.jpeg)

Key binding is included in Oram but can be remapped very easily in webconf.

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 10, 2024, 10:28pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/4 "2024-07-10T22:28:54Z")

</div>

Hi Riban, welcome here!

Yes, I’m aware of the option to use an USB keypad but that’s way bigger than the keypad I’ve shown and I’m aiming for minimal size.

Any idea how could the version I’ve shared work?

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 10, 2024, 10:31pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/5 "2024-07-10T22:31:02Z")

</div>

Thanks for the info though to my knowledge Zynthian use one MCP23017 per 16 buttons, and not per switch…  
Also I’m aware how a matrix keypad works.

The question is: how to make the matrix keypad work in Zynthian?

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 11, 2024, 1:32am UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/6 "2024-07-11T01:32:25Z")

</div>

I suppose it should be something like this:

> **[A Matrix Keypad on a Raspberry Pi done right – Subjektive Wahrnehmung](https://blog.geggus.net/2017/08/a-matrix-keypad-on-a-raspberry-pi-done-right/)**
>
> Ein Blog über Freie Software, (Netz-)politik und mehr

---

<div class="post-metadata">

**Author:** ![le51](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/le51/32/1706_2.png) [@le51](https://discourse.zynthian.org/u/le51)\
**Post date:** [July 11, 2024, 6:35am UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/7 "2024-07-11T06:35:40Z")

</div>

> [@Scabattoir](#):
>
> Zynthian use one MCP23017 per 16 buttons, and not per switch…

Sorry, I’m not an english native speaker.  
Are buttons and switches différent things?

---

<div class="post-metadata">

**Author:** ![stojos](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/stojos/32/10833_2.png) [@stojos](https://discourse.zynthian.org/u/stojos)\
**Post date:** [July 11, 2024, 6:43am UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/8 "2024-07-11T06:43:08Z")

</div>

Somebody would need to write a zyncontrol driver inside zyncoder directory and enhance webconfig to include a new wiring config that points to that driver.

It would be useful to support matrix type of wiring because we could also use it to connect foot keyboards such as [fatar pd/2](https://www.thomann.de/gb/doepfer_mbp25_electronic_with_2_pedal.htm?glp=1&gad_source=1&gbraid=0AAAAADuDMCWUl6A1iDJxOHDMhrmYvPYig) which is also matrix.

---

<div class="post-metadata">

**Author:** ![wyleu](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/wyleu/32/514_2.png) [@wyleu](https://discourse.zynthian.org/u/wyleu)\
**Post date:** [July 11, 2024, 12:24pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/9 "2024-07-11T12:24:37Z")

</div>

> [@stojos](#):
>
> It would be useful to support matrix type of wiring because we could also use it to connect foot keyboards such as [fatar pd/2](https://www.thomann.de/gb/doepfer_mbp25_electronic_with_2_pedal.htm?glp=1&gad_source=1&gbraid=0AAAAADuDMCWUl6A1iDJxOHDMhrmYvPYig) which is also matrix.

A zyn ctrldev possibly might be a solution?

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 11, 2024, 1:57pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/10 "2024-07-11T13:57:23Z")

</div>

No, buttons are a kind of switches. If you say momentary switches then it is the same.

But the key is that it’s not _ **one MCP23017 per switch** _ but _ **one MCP23017 per 16 switches** _.

I’m not native speaker either.

---

<div class="post-metadata">

**Author:** ![le51](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/le51/32/1706_2.png) [@le51](https://discourse.zynthian.org/u/le51)\
**Post date:** [July 11, 2024, 2:42pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/11 "2024-07-11T14:42:43Z")

</div>

Yeah !

> [@le51](#):
>
> Zynthian use one mcp23017 GPIO per switch,

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 11, 2024, 5:15pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/12 "2024-07-11T17:15:36Z")

</div>

Unfortunately I don’t even understand what “ctrldev” means… 😕  
I suppose it needs someone more experienced.

---

<div class="post-metadata">

**Author:** ![le51](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/le51/32/1706_2.png) [@le51](https://discourse.zynthian.org/u/le51)\
**Post date:** [July 11, 2024, 6:24pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/13 "2024-07-11T18:24:35Z")

</div>

see here:

> [@NEW: Control-device manager + controller device "drivers"](https://discourse.zynthian.org/t/new-control-device-manager-controller-device-drivers/8593):
>
> Hi @zynthianers! I’m proud of announcing the new control-device manager and driver subsystem is merged on testing branch. This is nice step forward in our road towards world domination grin The concept behind this is simple to explain with some examples: You plug your “Novation Launchpad Mini MK3” to zynthian, and it 's recognized and configured to manage the zynpad. The pads are colored like the zynpad ones. You can play/stop sequences, change scene, etc. LED feedback works great and you …

note that using this needs some coding skills

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 11, 2024, 11:39pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/14 "2024-07-11T23:39:11Z")

</div>

> [@le51](#):
>
> note that using this needs some coding skills

yeah I was afraid of that…

---

<div class="post-metadata">

**Author:** ![wyleu](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/wyleu/32/514_2.png) [@wyleu](https://discourse.zynthian.org/u/wyleu)\
**Post date:** [July 12, 2024, 10:33am UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/15 "2024-07-12T10:33:59Z")

</div>

> [@Scabattoir](#):
>
> Unfortunately I don’t even understand what “ctrldev” means

The search mechanism on this forum is a good place to answer most questions…

> [@NEW: Control-device manager + controller device "drivers"](https://discourse.zynthian.org/t/new-control-device-manager-controller-device-drivers/8593):
>
> Hi @zynthianers! I’m proud of announcing the new control-device manager and driver subsystem is merged on testing branch. This is nice step forward in our road towards world domination grin The concept behind this is simple to explain with some examples: You plug your “Novation Launchpad Mini MK3” to zynthian, and it 's recognized and configured to manage the zynpad. The pads are colored like the zynpad ones. You can play/stop sequences, change scene, etc. LED feedback works great and you …

---

<div class="post-metadata">

**Author:** ![properlypurple](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/properlypurple/32/10261_2.png) [@properlypurple](https://discourse.zynthian.org/u/properlypurple)\
**Post date:** [July 12, 2024, 11:34am UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/16 "2024-07-12T11:34:26Z")

</div>

You could probably take a shortcut, and wire this to a microcontroller like Arduino pro-micro, or Pico(with an appropriate keyboard firmware), basically turning this into a USB keypad.

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 12, 2024, 6:22pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/17 "2024-07-12T18:22:41Z")

</div>

That is exactly what I have been considering.  
Seems like the easiest route, also it is not too big in size.

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 12, 2024, 6:25pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/18 "2024-07-12T18:25:04Z")

</div>

> [@wyleu](#):
>
> The search mechanism on this forum is a good place to answer most questions…

True, as soon as you are aware what it is you are looking for. Not all of us are experienced in the details of Zynthian or coding.  
I got the link already from [le51](https://discourse.zynthian.org/u/le51), but thanks anyway.

---

<div class="post-metadata">

**Author:** ![Scabattoir](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scabattoir](https://discourse.zynthian.org/u/Scabattoir)\
**Post date:** [July 12, 2024, 9:19pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/19 "2024-07-12T21:19:03Z")

</div>

> [@Scabattoir](#):
>
> [A Matrix Keypad on a Raspberry Pi done right – Subjektive Wahrnehmung](https://blog.geggus.net/2017/08/a-matrix-keypad-on-a-raspberry-pi-done-right/)

Is there any reason not to do it exactly like in the article here?

Surprisingly I got no feedback on that, though I feel like that’s a full solution.  
Or maybe there’s something why it wouldn’t work?

---

<div class="post-metadata">

**Author:** ![wanthalf](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/w/ed655f/32.png) [@wanthalf](https://discourse.zynthian.org/u/wanthalf)\
**Post date:** [July 12, 2024, 10:16pm UTC](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805/20 "2024-07-12T22:16:03Z")

</div>

That looks like a super elegant solution!

[Next page](https://discourse.zynthian.org/t/keypad-matrix-for-buttons/9805.md?page=2)
