1
\$\begingroup\$

I'm looking to build a MIDI controller from some hardware I've salvaged, which includes 30 non-latching buttons and 30 LEDs. I'd like to base the system around an Arduino board (specific type TBD depending on IO requirements), and from looking at the specs of various boards I can see that I'm going to need to do some IO multiplexing or expansion in order to make use of all of the buttons and LEDs.

I'd like to be able to press multiple buttons at once, to enable things like holding down one button to change the function of other buttons, but I haven't managed to find any input multiplexing options which will support this. Could you point me towards some multiplexing methods or multiplexer/IO expander chips which would enable this sort of functionality?

As I'm very early on in the research/design process, I'm not wedded to any particular methodology. I'd just like to find out how feasible this is so I can point my design process and microcontroller selection in the right direction.

\$\endgroup\$
2
  • \$\begingroup\$ research matrix keypad diodes ... ask question here if something is unclear \$\endgroup\$ Commented Jul 27, 2023 at 20:23
  • \$\begingroup\$ change the function of other buttons ... that's not done in the keypad \$\endgroup\$ Commented Jul 27, 2023 at 20:24

3 Answers 3

1
\$\begingroup\$

A common strategy is to wire the buttons as a rectangular array and place a diode in series with each button so that each button connects one row to one column. Typically you’ll put pull-ups on each column and arrange the diodes so that an activated button will pull down its particular column if its corresponding row is low. Then you can scan the array by setting one row low at a time and reading the columns. This approach allows any number of keys to be operated simultaneously without interfering with each other.

\$\endgroup\$
2
  • \$\begingroup\$ With the limitation that you can't detect multiple key press simultaneously. \$\endgroup\$ Commented Jul 27, 2023 at 20:32
  • \$\begingroup\$ @Julien yes and no. Obviously not simultaneously, but you can scan the matrix at a speed which enables you to detect all buttons in some small time frame irrelevant to humans, and that's how nearly all MIDI keyboards etc have worked since the 80s. And that's why there are diodes to enable detection of more than two buttons being pressed simultaneously. \$\endgroup\$ Commented Jul 27, 2023 at 20:38
0
\$\begingroup\$

Does this chip suits your need? MCP23S17

You can do a google search for "IO multiplexer interrupt". You might find other solutions.

\$\endgroup\$
1
  • \$\begingroup\$ I have taken a brief look at the MCP2X17 and MCP2X18. I'm not specifically sure how I'd use them along with whatever micro I choose to use, but the number of IO and connectivity sounds like it'd probably suit my needs. I'll try and find some info online on how to use them and look into similar chips - thanks! \$\endgroup\$ Commented Jul 27, 2023 at 20:23
0
\$\begingroup\$

With only 30 input switches, you might consider a parallel-load chain of four 8-bit shift registers such as 74HCT165. Sometimes simplest is best.

enter image description here

It's not multiplexing: it has a load signal which makes sure you get the simultaneous sampling of all the switches, each of which has its own input. With this technique, you can detect absolutely every possible combination of button presses. If your switches are in a line such as a piano-style keyboard, perhaps it's more convenient for tracking than the multiplexing array and its associated diodes.

You can then clock all the 32 bits into the MCU serially at whatever speed you like.

An alternative is to feed 4 inputs into the MCU with the four shift register outputs; this has a faster load into the MCU at the price of using more inputs.

For 30 LEDs, it's usually straightforward in a 6x5 or 8x4 arrangement, without any diodes necessary.

Everything in engineering is a tradeoff. Comapared to the standard multiplexing-with-diodes, in this case you probably save on wires, and lose 30 diodes while gaining 4 chips.

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.