USB MIDI
Expression Pedal
Arduino

Ordinary expression pedals are passive analog devices that receive electrical input from, for example a synth, attenuate the current via a potentiometer, and then return the signal to the instrument. I own several MIDI keyboards, a control surface, a hardware synthesizer and, although they all have 1/4" TS sustain sockets (2-wire on/off), none of them is equipped with a 1/4" TRS port (3-wire) to connect an expression pedal.

Project: Transform an analog expression pedal into a USB MIDI digital device.

Parts

Tools: soldering iron, solder wire, screwdriver, scissors.

Software

On Arch Linux
$ paru -S teensyduino


Tools > Board: "Teensy LC"
Tools > USB Type: "MIDI"
Tools > Port: "/dev/hidraw4 MIDI (Teensy LC)"


https://github.com/joshnishikawa/MIDIcontroller
https://github.com/joshnishikawa/Flicker (only needed to compile)

I used MIDIcontroller version 2.5.4. Features included: stable analog to MIDI conversion for potentiometers and other sensors.


Sketch > Include Library > Add .ZIP Library...


File > Examples > Examples from Custom Libraries > MIDIcontroller > MIDIpot


line 3: MIDI channel = 1, but can be any valid number from 1-16.

byte MIDIchannel = 1;

line 10: CC (Control Change) = 11 for expression, or CC = 1 for mod wheel, or something else.

MIDIpot myPot(potPin, 11, KILL);



File > Examples > Built-in Examples > Teensy > USB_MIDI > MIDI_name


#define MIDI_NAME {'N','X','-','P'}
#define MIDI_NAME_LEN 4

MIDI_NAME_LEN must be an integer corresponding to the number of characters used in the name, including spaces.



Sketch > Verify/Compile


This should build the program, then automatically upload it and reboot the board. There is no need to press the button on the board itself to enter Program Mode. (The physical pushbutton is provided to allow recovery from bad code.)

If more code changes are made, in Arduino IDE, compile again and then manually upload.

Sketch > Verify/Compile
Sketch > Upload


Hardware


The USB MIDI Expression Pedal is now ready to use with DAW software without any additional device drivers.

Project inspired by Mick Nilsson. Thank you to Tanya Grabarnik for editing.