MIDI over USB Pedalboard Project

Greetings. This is my first posting and I’m relative new to Arduino, electronics (no real background) and programming (really only web programming) so please forgive any misuse of terms.

I’m looking for feasibility and practical application advice on a project to create a 13 pedal MIDI over USB device that I intend to use in live performance situations. The device will send 13 notes of an octave + 1 (say from a C1 to C2.) It will also have a 1/4" TS input for a commercial sustain pedal and a 1/4" TRS input for a commercial continuous foot controller.

I have in fact already successfully created a device with just the sustain pedal and foot controller inputs which was an exceedingly simple variation of the work done by Arturo Guadalupi a.guadalupi@arduino.cc in his MIDI device tutorial, http://www.arduino.cc/en/Tutorial/MidiDevice (thank you!) using an Arduino Zero. It will use an arduino board with native USB functionality as I never quite could get my head around some of the directions to alter an Uno board to do both. It doesn’t need any serial MIDI connections in or out although in a completely deluxe version it’d be nice to have a 5 pin DIN MIDI in connector (or 2) and merge those incoming MIDI streams with the device’s.

For the most part adding the 13 notes I think will be very straightforward though I do have some programming, electronics and electro-mechanical things I’m unsure of which is what this post is about. The main issues are 1) how best to deal with the 13 note triggers, 2) whether to attempt to include some MIDI velocity sensitivity and 3) the electro-mechanical handling of the note triggers.

Re: 13 digital note inputs. My Zero doesn’t quite have enough inputs, especially if velocity is included, so I wondered about using a static shift register to handle that. From what I understand from looking at the ShiftIn tutorial (https://www.arduino.cc/en/tutorial/ShiftIn) I think I understand how to do that linking either 2 CD4021B shift register ICs to get 13 inputs (or 4 to get 26 if my idea below for velocity sensitivity is feasible) but from looking at some other shift register related posts I’m wondering if there would be an unacceptable latency introduced by the electronics and code involved reading the shift register? Would it be significantly better to just get a USB native board with enough inputs like a Due and avoid the shift registers? It seems either way the program will have to cycle through reading 26 inputs and remember each note’s timing and state so is it any quicker with direct inputs to the board versus the IC’s?

Re: Velocity sensitivity. In it’s most basic design there’d just be a single switch and the MIDI velocity would be fixed as it is in reality with organ type interfaces but I’d also like to consider an approach that includes some sort of velocity sensitivity. My current thinking was to have two switches for each note and the mechanical set up would have one triggered before the other . The first would start a timer and a MIDI note on message would only be sent when the second was triggered with the MIDI velocity byte being calculated using the time difference between the first and second switch triggering. I haven’t yet got to the stage of testing that but obviously I’d expect a fair bit of trial an error (and likely compromises) to settle on a useable millisecond to velocity conversion. But is that a feasible approach or will the cycling involved around capturing the timing difference introduce some unacceptable latency?

Also if the shift registers are a feasible idea would it make much difference between having the 26 switches all together electronically and programatically versus having a separate shift register for the velocity timing trigger and another for the note-on trigger? And if running two separate 13 input shift registers would each each use the same clock and latch triggers from the Arduino and just have (obviously) separate data ins or do the clock and latch signals need to be separate?

Re: electro-mechanical switching. Base on researching a fair number of other organ pedalboard to MIDI conversion examples my current (but as yet untested) idea is to use reed switches and rare earth magnets to trigger the notes. Ideally there’d be one rare earth magnet epoxied to one end of a wooden pedal with a spring returning it to its off position and all pedals pivoting on a common rod. The magnet end would approach the two reed switches which would be physically situated (after trial and error) so as to be actuated separately by a discernible amount of time. I’ve had no experience with reed switches so I’m wondering from those that have if this is feasible? It’s certainly not out of the question to have a separate magnet for each switch if necessary but again I haven’t yet tested with the different magnet strengths available to me and I guess am looking for feedback before incurring the expense and waste for something other’s experience will know isn’t feasible. FWIW my research into full organ pedalboards and measurements of some commercial 13 note boards suggests these wooden pedals will be about 2.5" apart in case that helps with anyone’s knowledge of how neighbouring magnetic fields may interact.

If you’ve read this far thanks so much for hanging in and for your feedback.