A guitarist friend of mine has been gigging for years with a set of Moog Taurus I pedals. While great sounding, they are heavy, fragile and getting to be too valuable to take on club gigs. What he needed was some foot pedals which generated MIDI which could be plugged in to his rack. I had been wanting to do something with an Arduino for a while (I mostly do tube amps these days), so this project seemed a good place to start.

Interestingly, while there is a lot of discussion of this kind of thing on the 'net, when I started this project, I was unable to find anyone who had fully implemented it. As of this writing several have appeared, but in any case hopefully this will be of some use to the next folks who try it.

Step 1: Finding Pedals

The first thing we needed were some pedals. A brief search of Ebay yielded some pedals from an old hammond organ, the kind your grandma had in her living room, which had 13 pedals with normally open switches and a series of sturdy and easy to solder to copper strips. Because the pedals were designed to be bolted on to the bottom of an organ a little casing work had to be done. Some aluminum stock was added to get the pedals up off the floor and make them playable. Then a box to keep things neat and contained. What I wound up with looked like this.

Step 2: ​Getting Switch Closure Info Into the Arduino, Which Ports ?

The next issue was to figure out how to get 13 switch closures into an Arduino with enough additional information to make a MIDI message. After some poking around the web I found the Spikenzie Labs 64 button shield (http://www.spikenzielabs.com/SpikenzieLabs/Button64Shield.html) which sends numbers to an Arduino in response to switch openings and closures via Serial or SPI. After looking at various code, Serial seemed to be the best way to go.

Generally speaking, the 64 button shield works reasonably well. However to get serial working it is necessary to change out a 1K resistor for a lower value of 220 or 100 ohms. Down side is that this information can take a while to find. http://www.spikenzielabs.com/forum/viewtopic.php?f=18&t=51

Which Ports ?

Using serial communication to talk to the Arduino from the Button 64 Shield ties up the serial ports on the Arduino which are generally used for MIDI out. An additional problem is that the Button 64 Shield communicates at 57600 while MIDI communicates at 31250. This was solved by using the SoftwareSerial library which allows serial communication on other digital pins of the Arduino at a variety of rates. In this project MIDI RX and MIDI TX are on pins 2 and 3 (SoftwareSerial midiSerial(2, 3); in the code).

Old Arduino hands probably know all about this. For me it took a while to figure out.

Step 3: ​Implementing MIDI


The ins and outs of MIDI are very well documented elsewhere, but for this project we're really only concerned with three of them: "command-channel", "note number" and "velocity".

Command-channel are hard coded to the two commands we need, “note on, channel 1” and “note off, channel 1”. In the code this appears as:

int noteON = 144; (note on channel 1)

and int noteOFF = 128; (note off channel 1)

“Note number” requires a small amount of calculation. In SERIAL mode the 64 Button Shield sends out serial data for button presses or releases, from 1 to 64 for release and from 129 to 192 for press. MIDI starts at zero so note on for pressing the bottom button (assuming your starting at the bottom of the scale) must be decremented by 129. Note off must be decremented by 1. If this is too low (MIDI note “zero” is REALLY low), adding 12 to these numbers will bring up the pitch an octave.

Velocity is hard coded to 100, as we are dealing with switch closures with no touch sensitivity. If you want it louder or softer, this variable can range from 0-127.

Here is the complete code, with many thanks to Josh Boughey

/** MIDIstomp Read incoming serial stream to get button input, and respond with MIDI output ** written by Tim Halle & Josh Boughey, April 2015 **/


volatile uint8_t Button = 0; // button set up

int velocity = 100; // velocity of MIDI notes, must be between 0 and 127

int noteON = 144; // 144 = 10010000 in binary, note on channel 1command

int noteOFF = 128; // 128 = 10000000 in binary, note off channel 1 command

int NoteNumber = 0;

//software serial

SoftwareSerial midiSerial(2, 3); // digital pins that we'll use for soft serial RX & TX

void setup() // Set button and MIDI baud rate:





void loop()

{ // beginning of main loop

if (Serial.available() > 0) // Check if serial data is received, if not just loop again


Button = Serial.read(); // which button was pressed?

if(Button > 128) // This tells us its a note on


NoteNumber=(Button-129); // set MIDI note VALUE

MidiOn(); // plays a MIDI note.



{ // Otherwise it's a note off

NoteNumber=(Button-1); // set MIDI note VALUE

MidiOff(); // Turns off a MIDI note.

} // else end


} // End of main loop

void MidiOn()


midiSerial.write(noteON); // Note on channel 1

midiSerial.write(NoteNumber); // Which note should = button

midiSerial.write(velocity); // Velocity set to 100

Serial.print (" NOTE ON "); // Prints value to serial monitor










void MidiOff()


midiSerial.write(noteOFF); // Note off channel 1

midiSerial.write(NoteNumber); // Which note should = button

midiSerial.write(velocity); // Velocity set to 100

Serial.print (" NOTE OFF "); // Prints value to serial monitor










Step 4: ​Wiring

To make everything, work you must wire the buttons to the Button 64 Shield and a midi jack to the Arduino.

The Button 64 Shield is an 8x8 matrix giving 64 total inputs. Each Row (1-8) provides a single common contact for the columns (1-8) so:

row 1, column 1 = button 1

row 1 column 2 = button 2

row 2 column 1 = button 9

row 2 column 2 = button 10

And so on.

For ease of service I wired the Button 64 Shield to a barrier strip so I could pull things apart for trouble shooting, and, as always, there was a significant amount of trouble shooting. The absolute key thing to remember is to insert a diode after the switch with the positive connection towards the “row” input.

Instructions for wiring the MIDI jack are here (and many other places):


The only difference will be that because the Button 64 Shield is taking up the usual RX and TX pins, RX and TX are assigned for pins 2 and 3, and since we are only interested in TX, Pin 5 on the Midi jack is wired to Pin 3 on the Arduino.

Step 5: ​Wrap Up and Credits

So the short story is that once I figured out where the diodes went and the need to change a resistor on the Button 64 Shield, this has worked flawlessly (so far). Well enough that I haven't had to implement “all notes off” which back in the day used to be vital to prevent “stuck keys” (this is the silver push switch on top of the cover). It is worth mentioning that this system is polyphonic, ie can play more than one note at a time. While this isnt all that useful for bass pedals, unless you have extra feet, this system can be easily adapted to other instruments, accordian comes to mind.

For me, most of the work in this project was research, largely understanding the ins and outs of Arduino programming. Information on MIDI is not hard to find and it is well covered on the Arduino site itself, for example: https://www.arduino.cc/en/Tutorial/Midi

Probably the single best resource is Tom Igoe's page at NYU ITP: https://itp.nyu.edu/physcomp/labs/labs-serial-communication/lab-midi-output-using-an-arduino/

Thanks to Josh Boughey for the Coding and Sean Dwyer for the carpentry.

<p>Correction !!!!<br>Just re-doing this for the original client and discovered an error<br>first line should be <br>#include &lt;SoftwareSerial.h&gt;</p>
<p>Very nicely done! </p><p>I think a lot of people will find this useful. Thanks for sharing your process, and the results! </p>
<p>Thank you sir (or madame) !</p><p>Next up is a microtonal keyboard using some of the same tricks.</p>
<p>Definitely a sir ;)</p><p>Nice! Can't see more great projects from you. Good stuff!</p>

About This Instructable




More by AllstonMa:Easy MIDI Bass pedals 
Add instructable to: