MIDI Controller with Arduino , button matrix circuit help with pullup pulldown resistors

Thread Starter

nt2ds

Joined Jun 2, 2022
17
I want to create a MIDI Controller with 40 buttons and 10 potentiometers, the Arduino Micro (MIDI Class compliant) only has 13 GPIO ports, I thought of using an I/O expander and creating a button matrix with 4 columns and each with 10 buttons (4 columns x 10 rows = 40 buttons). The program for the Arduino is one I got from a youtuber, the Arduino let's you choose how every GPIO pin behaves (OUTPUT, INPUT, INPUT_PULLUP, INPUT_PULLDOWN). The code is written so that all button inputs on the Arduino use the pullup resistor ( pinMode(pinwhatever, INPUT_PULLUP) ) because it won't work differently. Since the I/O Expander says on its documentation that is has weak input pullup resistor I came up with the schematic shown below, but it uses 80 diodes and the voltage drop from them can be quite big how can the circuit change and use pullup or pulldown resistors? because I've been confused a lot
 

Attachments

djsfantasi

Joined Apr 11, 2010
9,183
Instead of an IO Expander, you can roll your own with shift registers that are parallel in, serial out, like the 74HC165. With just a few pins on the Arduino (3 or 4), you can read many inputs at once. These chips are 8 bit (16 bit may be available) and with 5 chips and 3 GPIO PIND, you could read all 40 inputs.

To be honest, I’ve only used shift registers for output, but the principle is the same.
 

Thread Starter

nt2ds

Joined Jun 2, 2022
17

drjohsmith

Joined Dec 13, 2021
852
I read the entire thing thrice and didn't understand how it should be done. Where should the ground be connected to?
Where will I get the row output from if the ground is connected there?
If you could post a circuit even with a 3x3 matrix it would be really helpful
Also, as I mentioned the I/O expander has weak internal pullup resistors that I can use
Is this more detailed of use ?
https://osoyoo.com/2017/09/13/arduino-lesson-4x4-matrix-keypad/

There is no need for an "earth"
Key scan is as the tin says

toggle each of the wires on one side
and see what changes on the bottom wires,
 
Top