Arduino MIDI Volume-Expression
Arduino MIDI Volume-Expression
Introduction
This is a simple MIDI project that anyone can do easily. The goal is to have a very basic yet functional
way of sending MIDI Control Change (CC) messages to host devices such as Mod Devices Mod Duo, DuoX
and Mod Dwarf.
This project makes use of the USB port to carry the MIDI events but can be adapted to regular 5 pins DIN
if required.
To achieve this, the Arduino Pro Micro is used. This microcontroller has already a built in USB compliant
port that is viewed as a normal USB device by the hosts computer or device.
What’s required?
Materials:
Tools:
The final assembled project can be fitted into a small plastic or metal project box and the Arduino board
held inside with a dab of glue from a glue gun. Any other arrangement is also fine, and I will leave that
part to your discretion.
Simon Girouard
Jan. 2022 page 1
Compatible volume pedals
This project uses potentiometers (variable resistor) to determine the value that will be eventually sent
to the host.
Basically, any analog volume pedals with “Input” and “Output” jacks and no electronic parts aside from a
potentiometer will work. This is the case for some Ernie Ball volume pedals.
This type of pedal will require a “Y” adapter in order to work with this project. The schematic and
instructions to build such an adapter are available at the end of this document in the appendix.
Other volume pedals such as the Roland EV-5 are already designed to be used with hosts equipped with
an expression connector. As seen in the diagram below, the cable out of the pedal has a “TRS”
connector instead of the “Input/Output” pair seen in fully analog volume pedals mentioned above.
Note: The Roland EV-5 and other pedals have a 2nd potentiometer on the side to limit the range.
Although not tested in this project, it should work in the same manner as it would if connected to any
other commercial device.
WARNING: If your volume pedal already has electronic circuitry and/or requires a 9v battery to operate,
it is NOT usable with this project and it may even be damaged if you attempt to do so.
Simon Girouard
Jan. 2022 page 2
Arduino connections
Only 3 pins from the Arduino are required to connect our ¼” TRS jack:
It is possible to have up to 4 expression pedals with this project because there are 4 analog pins on this
Arduino. Slight changes to the code will be required if more than one expression pedal will be used.
The Arduino IDE is used to edit the code and send the compiled version of that code to the Arduino.
Once you have downloaded the installer, install and launch the Arduino IDE (Integrated Development
Editor).
In a new “Sketch” (editor window), copy and paste the code below:
Potentiometer wiring:
- Right pole to Arduino GND pin.
Simon Girouard
Jan. 2022 page 3
- Left pole to Arduino VCC pin
- Center pole to Arduino analog input pin (Ex: A0)
For this version, MIDI Channel and CC number are hardcoded in the initialization command (see
"setup" function).
void setup() {
Expression1.init(A0, 0, 7); // Initialize the expression pedal (Arduino Analog Pin,
MIDI channel, CC Number)
//Expression2.init(A1, 0, 11); /* Un-comment this line if you want a 2nd expression pedal */
//Expression3.init(A2, 0, 13); /* Un-comment this line if you want a 3rd expression pedal */
//Expression4.init(A3, 0, 15); /* Un-comment this line if you want a 4th expression pedal */
}
void loop() {
Expression1.DoProcess(); // Process Expression Pedal 1
//Expression2.DoProcess(); /* Un-comment this line if you want a 2nd expression pedal */
//Expression3.DoProcess(); /* Un-comment this line if you want a 3rd expression pedal */
//Expression4.DoProcess(); /* Un-comment this line if you want a 4th expression pedal */
}
Simon Girouard
Jan. 2022 page 4
This code can be edited to allow for up to 4 expression pedals with each their own ¼” TRS jack.
To do so, remove the “//” (comment tag) at the beginning of the lines with the text “Un-comment this
line if you want…”
Ex:
Current line:
Other changes you may want to do is the CC message number and MIDI channel you want each
expression pedal to be configured with.
To change these values, edit the parameters of the “init” command for each of the pedal objects in the
code:
In the example above, “A0” corresponds to the first analog pin on the Arduino board where the signal
wire to the TRS jack is connected.
The second parameter is the MIDI channel (0 to 15) you want this pedal to use to send the CC.
The third parameter is the actual CC number (control identifier) of the control in your host device. In the
code above, the identifier “7” is the standard for a “Volume” control and “11” for an “Expression”
control.
Simon Girouard
Jan. 2022 page 5
Note: Upon powering the Arduino, the default value sent in a CC message is “0” (off) to prevent your
ears and/or speakers to be damaged. In the next version of this project, it may be possible to set a
default value so controls other than “Volume” would not have to be restricted by this.
Before compiling and uploading the code to the Arduino, you must tell the Arduino IDE which
microcontroller you are using. You will find the selection in “Tools-> Board: ….” and select the
appropriate board you re using. In the case of the Arduino Pro Micro, select “Arduino Micro”.
Then you must select the USB port onto which the Arduino is connected to your computer. This port
may not be the same from one computer to another so you may have to try other listed ports to find the
right one.
Simon Girouard
Jan. 2022 page 6
You can test the port by selecting “Get Board Info”. If there is no error and the model of the
microcontroller is displayed, you have the proper port. Else, try another port.
Once the code is edited to your liking, start the compilation and upload process to the Arduino by
clicking on the “Upload” button (circled in red):
When the upload is completed, the status bar will indicate “Done uploading”.
Simon Girouard
Jan. 2022 page 7
If there are errors, revise the code to make sure you did not change something other than removing
some “//” for additional expression pedals or modified the parameters in the “init” command of each
pedal objects.
To test that the pedal is working, unplug the Arduino USB cable from your computer and then connect it
to the device you want to control.
If all is well, the host’s control should react to the pedal being used.
Here are the additions and changes I will do to this project soon:
- Allow for a default value chosen by the user instead of defaulting to “0” at power up.
- Replace hardcoded values with a dynamic configuration Windows and/or Mac utility (instead of
compiling and uploading code to the Arduino every time you want to change pedal parameters).
- Introduction of “Stomps” (foot switches) that can be either “Momentary” or “Latch”.
- Introduction of PC messages (Program Change).
- Ability to send “Notes”.
Simon Girouard
Jan. 2022 page 8
Appendix
Normally, using an analog volume pedal with “Input” and “Output” jacks would require a modification of
the wiring in the pedal. This would make it useless for normal analog use.
The following “Y” adapter (Fig 2.) will allow you to use your volume pedal without any modifications.
Simply connect the two ¼” male plugs into their respective “Input” and “output” jacks on your pedal.
IMPORTANT: Make sure that the plug marked with “To volume pedal input” actually is plugged into
the “Input” jack of your volume pedal. Reversing these 2 plugs will cause the GND and +5V to short
and this may cause damage to the Arduino.
Simon Girouard
Jan. 2022 page 9