Project with 64 knobs, 40 buttons, 70 leds, etc.


I want to built a drum sequencer and I'm currently already writing the code. My breadboard prototyp uses 32 buttons & 40 leds. They are connected via daisy chained 595s and 165s and I can't notice any lack. I'm using a mega2560

At the end I want to have 64 knobs, 40 buttons, 120 leds, 1 small oled display (via spi) and a micro sd card (via spi) . That are 15x 74HC595 (each 8 leds), 5x 74HC165 and 9x 4051 (each 8 knobs).

My questions: 1. Wouldn't so many knobs, buttons and leds slow down eveerything? If the user moves a knob arduino should instantaneously send midi cc… 2. Should I switch to an arduino due for more performance? Or won't I notice any performance problems? 3. Am I doing everything right with the 74HC595, 74HC165 and 4051 or should I use other (faster) alternatives?


What you are doing isn’t wrong, but not how I would do it. Driving the LEDs individually from 74HC595s, as well as the 15 x 74HC595 you will need 120 series resistors. If instead you arrange your LEDs in a 5x24 multiplexed matrix, then you will need:

  • 24 individually-switched outputs, for which I would use 3xTPIC6B595 shift registers (the 74HC595 is only good to 9mA per output, and we will need around 40mA to allow for the multiplexing)
  • 5 high-current exclusive outputs (PNP transistors + base resistors driven from output pins)
  • 24 series resistors

Your 40 buttons currently need 5x74HC165 and 40 pullup or pulldown resistors. You can use the same 5 pins supplying the LED drivers as multiplex pins for the push buttons, using 8 inputs and 40 small signal diodes (no shift registers needed).

So the component count would be reduced by 12 shift registers and 131 resistors, and increased by 5 transistors and 40 diodes. You would need more I/O pins, but you have plenty available on your mega2560.

120 LEDs corresponds to two MAX7219 chips, plus two resistors; using 3 control lines.

"Instantaneous" to the MCU means within a microsecond.

"Instantaneous" to you is measured in tens of milliseconds.

I would expand on Paul__B: Go with responsiveness. Human ear can detect 5mS lag easily. You don't want to push a button and then push a 2nd time thinking the first wasn't responded to.

LEDs - two MAX7219 with seperate slave select lines. Then a single register write can control 1 of 8 LEDs. Go with external Octal ADCs, such as or Very fast SPI access. That leaves buttons. 40 direct wired buttons with internal pullups. 3 for SCK-MISO-MOSI 2 for MAX7219 slave selects 8 for octal ADC Total 53 IO. Mega has 54. So go with 39 buttons to start so you can have Serial for debugging to start, when your code is less buggy can add the 40th button. If the buttons are just read from an array, or you are reading in entire ports at once, that should be pretty straightforward.