Arduino Midi Foot Pedal

11K413

Intro: Arduino Midi Foot Pedal

If you're like me and play in a 3 piece band (bass, drums, guitar), you know sometimes it would be great to add a little "oomph" to your songs by triggering a stereo sample and really fill out the sound. Problem is there isn't much off the shelf that you can buy for a reasonable amount of cash. With a gig coming up I decided to go ahead and build this project.

What you need for this project:

An appropriately sized stompable enclosure (in my case an old non-working guitar pedal case in this pic)
An Arduino Uno or similar board or Mega328 on a PCB/Breadboard
10k ohm Resistor
220k ohm Resistor
Midi Female Socket
Sturdy two-pin button of your choice (remember, you'll be stomping on this)
Power source (9-volt or adapter)

We'll be connecting this to a midi capable sequencer (software or hardware). In my case my sound generator will be an iPhone with Garageband and a midi adapter.

STEP 1: Building and Wiring the Board

Basically what we're doing here is simple... using the first available digital out for the Midi connector and the first available analog in for the button. The green LED is simply there to indicate power up.

As you can see in the picture, I'm using a breadboard with a Mega328 chip. I have a 9volt connector with all the appropriate power conditioning (won't cover this here) to power the chip. But you can just use a standard out of the box Arduino Uno if you want. I didn't want to commit a prototype board to this not to mention it didn't really fit in the case I had.

STEP 2: Programing

Okay, we're all wired up but now we need to program the chip to listen for the button press as well as fire off a Midi Note (in this case Middle C). To program my board, I'd actually hook it up to my Uno, download, and then move to my breadboard.The actual Arduino Sketch is here for download but here is the gist of the main function with comments:

void loop() {

    // assign midi note
    int Cnote = 0x30;

    // read the state of the pushbutton value:
    buttonState = digitalRead(buttonPin);

    // check if the pushbutton is pressed.
    // if it is, the buttonState is HIGH:
    if (buttonState == HIGH) {    
      // Play midi note: Note on channel 1 (0x90), some note variable in this case (Cnote), middle velocity (0x45):
      noteOn(0x90, Cnote, 0x45);
      // turn LED on to indicate successful button press:
      digitalWrite(ledPin, HIGH);
     // delay to supress stuttering
      delay(1000);
    }
    else {
      // turn LED off:
      digitalWrite(ledPin, LOW); 
    }
}

STEP 3: Testing It Out

So now you're ready to plug your midi connector to a tone-genereator, keyboard, PC, etc... In my case I'm using an iPhone with an iRig Midi interface. When you plug the pedal in you should here your midi note play from whatever you're using (I ended up using GarageBand but you can use any sequencer you like). From here, I just assigned this note to play a sample of my choice. Good part is between songs I can change programs and assign different samples as I choose. This makes the pedal much more scalable.

STEP 4: Mounting the Case

With a little drilling and wrestling I as able to get my board seated properly. Since the pedal case was already built for stomping it's sturdy and seems solid enough to get thrown in my gig bag with my other stuff. Cool part is that I have a small and compact sequencer option when I need it without bringing a ton of gear.

Some cool mods to extend this idea would be to add LED's to indicate a button press, or adding multiple buttons so you could have more samples at the tip of your foot ;).

3 Comments

does it matter what V your push button is?

can we see a video of the prototype?

cool, do you have any video/audio of this this working?