# Best approach for a 6x24 button matrix

**URL:** <https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607>\
**Category:** General Guidance\
**Created:** [April 30, 2023, 9:23pm UTC](https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607 "2023-04-30T21:23:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![xdfhbgfj](https://avatars.discourse-cdn.com/v4/letter/x/5f8ce5/32.png) [@xdfhbgfj](https://forum.arduino.cc/u/xdfhbgfj)\
**Post date:** [April 30, 2023, 9:23pm UTC](https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607/1 "2023-04-30T21:23:50Z")

</div>

Relatively new user here. I'm considering building a midi controller that would require a 6x24 button matrix (similar to a guitar fretboard). My question is would an Arduino MEGA be suitable for this job? From what I've read, I would just need 30 digital inputs, but my worry is that it would be too much information for the board to process at once, with minimal latency, especially if multiple switches are pressed at once. Any help or advice is appreciated!

---

<div class="post-metadata">

**Author:** ![kolaha](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kolaha/32/966427_2.png) [@kolaha](https://forum.arduino.cc/u/kolaha)\
**Post date:** [April 30, 2023, 9:30pm UTC](https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607/2 "2023-04-30T21:30:16Z")

</div>

Blue Pill STM32F103C8 is better then Arduino MEGA in any case

---

<div class="post-metadata">

**Author:** ![Railroader](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/railroader/32/274550_2.png) [@Railroader](https://forum.arduino.cc/u/Railroader)\
**Post date:** [April 30, 2023, 9:55pm UTC](https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607/3 "2023-04-30T21:55:12Z")

</div>

> [@xdfhbgfj](#):
>
> From what I've read, I would just need 30 digital inputs,

Where did You here that? 24 is enough if You connect them cleverly..

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [April 30, 2023, 9:58pm UTC](https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607/4 "2023-04-30T21:58:20Z")

</div>

> [@xdfhbgfj](#):
>
> too much information for the board to process at once

Very unlikely. Humans are _extremely_ slow at pressing keys.

But to save a lot of effort, consider using a keyboard controller chip that handles multiple key rollover.

---

<div class="post-metadata">

**Author:** ![johnwasser](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnwasser/32/214270_2.png) [@johnwasser](https://forum.arduino.cc/u/johnwasser)\
**Post date:** [April 30, 2023, 10:05pm UTC](https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607/5 "2023-04-30T22:05:42Z")

</div>

You can use the Keypad library but it is limited to 16 columns, and by default, 10 rows. You can adjust the rows to 24 in Keypad.h and use a 24x6 keypad. The Keypad library will give you Press, Held, Released, and Idle events for each key. By default it does 10-key roll-over but you can adjust for more in Keypad.h

---

<div class="post-metadata">

**Author:** ![david\_2018](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/david_2018/32/1013044_2.png) [@david\_2018](https://forum.arduino.cc/u/david_2018)\
**Post date:** [April 30, 2023, 10:51pm UTC](https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607/7 "2023-04-30T22:51:00Z")

</div>

As has been mentioned, a 12x12 matrix will give you the same number of buttons as a 6x24, and only require 24 digital pins. The amount of time needed to scan the matrix with the (modified) keypad library would be minimal compared to the time needed to transmit the midi data at the standard 31250 baud rate. Multiple buttons pressed simultaneously would requires diodes on each switch.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [October 27, 2023, 10:51pm UTC](https://forum.arduino.cc/t/best-approach-for-a-6x24-button-matrix/1121607/8 "2023-10-27T22:51:16Z")

</div>

Closed on October 27, 2023, 10:51pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
