While searching for an expression pedal for controlling guitar VST effects in real-time in my DAW (Digital Audio Workstation), I found that there is no cheap solution. The options were to use an analog pedal connected into an external MIDI controller, use an analog to MIDI converter, or a standalone MIDI pedal which sends MIDI CC messages direct to the computer. All of these are quite expensive, so I decided to hack an analog pedal to make a self-contained MIDI expression pedal.
Many of the solutions online using Arduino or Raspberry PI send MIDI messages over serial or USB serial. The problem with this is that the device does not register in Windows as a MIDI device, i.e. it is not class-compliant. This means that an extra piece of software is required on the PC to route the serial MIDI input to a class-compliant software MIDI device (such as Hairless Midi), which then appears as a standard MIDI device which can be accessed by the DAW. I did not want this extra level of complexity.
I found that the USB port on some Teensy microcontrollers from PJRC (https://www.pjrc.com/teensy/) could be switched into a mode where the device acts as a class-compliant MIDI device. An added bonus is that the "LC" in Teensy LC stands for "Low Cost". Although inexpensive it has plenty of performance for this task. Other boards such as the Arduino Micro (or any other based on the ATmega32U4 microcontroller) have USB MIDI capability and could also be used, but these are more expensive and are larger so less easy to fit inside the pedal.
There is also an excellent software library by joshnishikawa (here) with example code that does everything necessary without requiring modification.
The M-Audio EX-P is a great value analog expression pedal - but obviously this modification will invalidate any warranty.
Remove unnecessary parts:The first thing to do is to remove the six screws from the bottom of the pedal and remove the base plate. There is a polarity switch mounted on the plate - we do not need this so it has to be removed.
Remove the mounting screws and put the plate to one side. You will see the switch PCB has four wires - two black ones going to the potentiometer, and a red and black from the cable. We need to cut the two black wires which go to the potentiometer. Cut them as close as possible to the switch - we need to keep the length of wires from the potentiometer to connect to the Teensy LC.
Also cut the white ground wire from the cable, again leaving plenty of wire inside the pedal to reconnect to the Teensy LC. The cable can then be removed along with the switch.
Install the microcontroller:Strip a small amount of insulation from the three wires which were cut to remove the switch and cable, and tin the ends. Solder these wires to the Teensy LC pins as follows:
- The white wire goes to the GND pin.
- The black wire nearest to the red on the potentiometer PCB (i.e. the middle wire on the PCB) goes to pin 14.
- The other black wire on the potentiometer PCB goes to the 3V pin.
Then plug the micro-USB cable into the Teensy's USB port, and route the cable out of the slot where the old cable was. I just used a cable tie to provide strain relief.
Next we can refit the base plate with the six screws, making sure the ring terminal on the black ground cable is secured under the correct screw. This is the hole in the plate which has the paint removed to allow a good ground connection. You can use a piece of tape to secure the terminal over the hole in the plate while refitting.
SoftwareMake sure the version of Arduino IDE you have installed is compatible with Teensyduino. Currently it is compatible with Arduino 1.8.13, and 1.8.14 support is in beta testing. It will not work with the browser version of Arduino IDE.
Download and install Teensyduino, this will install all the required support files for the Teensy. The "Teensy Loader" bootloader application is not required to be installed separately, it is installed along with Teensyduino and will run automatically as required. After installation, in Arduino IDE select "Tools>Board>Teensyduino>Teensy LC".
The next thing to do is plug in the Teensy LC and set the USB port mode to MIDI, to allow it to be recognised as a MIDI class-compliant device. This is done by selecting "Tools>USB Type>MIDI".
Download the libraries and MIDIpot example sketch. Open the MIDIpot sketch in Arduino IDE, and install the MIDIcontroller and Flicker libraries via "Sketch>Include Library>Add.ZIP Library...". The documentation states that the Bounce2 and Encoder libraries are also required, but they are for the other examples. For MIDIpot they are not needed.
Change the CC number on line 10 of the code to use the standard MIDI CC number for Expression, which is 11. I also changed the MIDI channel to 1 on line 3, but you can use whichever channel you want. The MIDIpot sketch can now be compiled and uploaded.
Full documentation and tutorials are provided on the PJRC website here.
DAW configurationI used Cakewalk by Bandlab for this example, which is an excellent full-feature DAW and is completely free. But you can use whichever is your favourite DAW and the configuration should be similar. I also used the Overloud TH-3 amplifier simulator VST add-on to receive the pedal input, but any VST which accepts MIDI control input can be used.
First plug in the USB cable from the pedal to the PC. If all is working as expected Windows will detect and install the standard MIDI drivers.
Next open Cakewalk, you should get a message saying a new MIDI device has been detected and asking if it should be installed. Select Yes.
Next go to "Edit>Preferences>MIDI>Devices" - you should see a new MIDI device called Teensy MIDI. Ensure the tick box is selected for input.
Now create a new project using the Basic.cwt template in Cakewalk. You should now have an Audio track and a MIDI track. Rename the Audio track to "Guitar" and the MIDI track to "Pedal". Change the audio track input to whichever input your guitar is connected to, and the MIDI input to "Teensy MIDI>MIDI Omni".
Now we will add the TH-3 amp sim VST add-on. Drag and drop it from the Overloud folder in the browser pane into the FX rack of the Guitar audio track, it should automatically open. Select "Enable MIDI Input" from the "VST3" drop-down in the toolbar.
Now that MIDI input is enabled we can select the TH-3 add-on as the destination for the MIDI control signals. In the MIDI track output, select "TH3 1"
Now open up TH-3 and drag in the "cry maybe" wah pedal from the right hand pane. Right click on it and select "Learn global MIDI". You will now be prompted to press the hardware pedal twice while the VST receives the input and assigns it to the cry maybe. You can instead attach the pedal input to many other controls such as amp volume or reverb level by right clicking on the relevant control and following the same procedure.
Hopefully now when you press the pedal you will see the corresponding control move in the VST. You can arm both the audio and MIDI tracks for recording, then when you play the guitar the pedal automation will be recorded at the same time. To hear the guitar with the effects in real-time while you play you will have to enable "Input Echo" on the audio track.
The range control knob on the side of the pedal still retains the same function; when you rotate the knob you can see the range of the CC values within the DAW changes, so you can make the pedal more or less responsive.
So there you are, a MIDI expression pedal for little more than £25. I hope this works for you!
Comments