MIDI Foot Controller And Expression Pedal With Arduino - GitHub

MIDI Foot Controller and Expression Pedal with Arduino

Here is a pretty hands-on but relatively straightforward MIDI project for Arduino! The board contains 6 3PDT switches, each with a dedicated LED and a quarter inch jack for an expression pedal. Each button sends a Note On message (C-1 to F-1 chromatically), and the pedal sends Control Change (CC) messages. These can be mapped to serve whatever purpose is desired within your DAW.

Image

Components

This project can be very adaptable to your specific needs, so some of these parts may be swapped out or left out.

  • Arduino Uno
  • 6x 3PDT Latching Footswitch (other types of buttons can be used, but use these for a satisfying, punchy click)
  • TRS 1/4" jack (also known as a stereo jack. A mono jack will not work for this purpose. Learned from experience)
  • MIDI Jack
  • Generic expression pedal with 1/4" output
  • MIDI Cable
  • (Optional) 6x LEDs
  • (Optional) 6x 220 ohm resistors

Plus, of course, all the usual suspects in Arduino projects. Power source, breadboard, hookup wire, soldering equipment, a drill, and an enclosure. I just used a spray painted cake pan and used a power drill to create holes which worked surprisingly well (most switches and jacks come with washers which allows them to easily be affixed to the drilled holes). As you can tell, I'm just using a MIDI cable. While MIDI-to-USB is convenient, this isn't possible on a stand-alone Arduino Uno, and it keeps things pretty simple.

Construction

Please excuse this absolute mess of wires, I am no electrical engineer

Image

The advantage of the 3PDT switches (more info here) is that we can hookup the LEDs without communicating with the Arduino at all. On the left most pole of each switch (from top to bottom) is the power source, the digital input to the Arduino, and ground. In the middle pole, the power source is soldered to the top lug and the middle lug is soldered to the positive lead of the LED (which of course must be grounded through a resistor). As for the expression pedal jack, connect the tip to positive, the ring to an analog input (I used pin A0), and the sleeve to ground. Image

Lastly is the hooking up the MIDI jack. We only need 3 of the 5 pins in a MIDI jack. Be sure to take note of the slightly odd way the pins are numbered. Pin 5 goes to the Arduino's serial communication port (1), pin 4 goes to the power source, and pin 2 goes to ground.

Image

It can get messy if you're not very good with your hands like me, but it's at least conceptually straightforward. Now onto the code...

Coding

The MIDI messages we're sending are simple, so this was easily coded without importing any MIDI libraries. The baud rate is set to 31250, as this is the rate MIDI communicates over. Unfortunately, the serial monitor built into the Arduino IDE doesn't support this rate at the moment, so if you attempt to use the serial monitor, you're going to see some bizarre output. If you're having trouble and need to debug, change the Serial.begin(31250) to any supported baud rate (you will be unable to send MIDI messages properly, but you can monitor the input the Arduino is getting which is a good start). I'm sending Note On messages over channel 11. To change this, replace A in 0x9A (A is 11 in decimal notation) to your desired channel. CC messages are sent over CC1, which is defined by the MIDI standard as a Mod Wheel. This is typical for generic modulation that doesn't have a dedicated purpose, but if you're simultaneously using a controller with a mod wheel, these may conflict. If you desire, change CCnum to 0x0E (this CC number is undefined, as are many others. Find the assignments of all CC numbers here). The code loops every 10ms, so that's the frequency at which messages are sent, which could be changed but shouldn't be necessary. Button 5 also acts as on On/Off switch for the expression pedal. This is because the analog input ranges from 0-1023, which means that even the slightest movements (or no movement at all) will send a MIDI message. This noise can make it difficult to assign buttons in DAWs like Ableton (which asks you to push/move the desired button/mod wheel/etc. to assign MIDI, and if the expression pedal is constantly sending messages, this will interfere with your assignments). This button also sends a Note On message like all the others, so you can enable the expression pedal and the corresponding digital effect in one click. You can remove the "&& lastButton5State==1" from the code if you'd like the expression pedal to always be on.

Feel free to reach out if you have any questions!

Nick Dombroski [email protected]

Demo

Click here to see a demo

Check out my music here

Tag » Arduino Midi Controller Pedal