Old 11-02-2016, 10:10 AM   #1
shift838
Human being with feelings
 
Join Date: Sep 2016
Posts: 7
Default USB MIDI Foot Controller Completed [used with Reaper]

All,

I thought I would share this little project that has made my recording life easier with Reaper.

I am a guitar player and decided I wanted to start recording some of my songs and tried multiple DAW programs and settled on Reaper because of price and the sheer amount of features this program has. Not to mention, it's easy to use, it is updated quite frequently and the support from Reaper and the community is great.

Once I started recording, I quickly realized how much I hated using the mouse or keyboard for pretty much anything. I wanted to be able to control Reaper with the touch of a foot (since that how all of us guitarist like to control effects).

So I started researching of what I could use. Well I found a little gadget that allowed me to assign MIDI Control Codes to momentary stomp switches (there were only 3). I figured that would be plenty. Start, Stop, Record.. Should be good right? So I bought it.

Well after purchasing it and using it for a few months I quickly realized that I was using other transaction commands, Arm Track, Remove Item, etc quite frequently and the 3 button version just was not cutting it. I then started my search for one that had more. I settled on 8 switches is what I could use. I found out that these little Programmable USB MIDI Foot Controllers with 8 switches were indeed pricey and I did not want to dish out the coin for that, especially since I know how to program.

So... I built my own.

I used a Teensy 3.2 Micro Controller (Arduino code), panel mount USB extension, SPDT toggle, 2 x LEDs and 8 SPST Momentary (soft touch) switches and an old 3U Raised Rack Space cover(for enclosure) and 4 adjustable feet.

The controller is coded in 'C' language and is 2 controllers in one. If the Toggle is off it will send MIDI Note Codes while pressed (note on) and send the 'note off' code when released. When the toggle is engaged it will send the MIDI Control Code, this is the type I needed to do so I could send MIDI CC to Reaper to control Transaction commands like Record, Play, Stop, Arm, etc. (the controller will work with other DAW programs but Reaper in my book wins hands down)

Now I have a completely functional 8 switch (can have more if you want) Programmable MIDI USB Foot Controller that i use with Reaper. It's easy to build and code and not to mention I did the whole thing for under $70 USD and a few hours.

It even works on Windows 10 with no drivers needed they are already there.

For a high resolution pictures in the below link

https://www.dropbox.com/sh/uh9b2ux15...t5FRJfNda?dl=0


Video:
https://www.youtube.com/watch?v=Kq9DME06KDI

It can even have a MIDI IN/OUT 5pin DIN connected to it so it can send CC codes to an actual guitar rack effect if i wanted to wire that in.

For more informatino on the Teensy 3.2 used you can go to:

https://www.pjrc.com/store/teensy32.html


If you would like more information of how I did it contact me.

Last edited by shift838; 11-02-2016 at 03:39 PM.
shift838 is offline   Reply With Quote
Old 11-02-2016, 12:05 PM   #2
ivansc
Human being with feelings
 
Join Date: Aug 2007
Location: Near Cambridge UK and Near Questembert, France
Posts: 15,972
Default

You clever little bugger you!
I currently use a combination of a MIDI footswitch with ONE function and TouchOSC on my tablet.
This is rather elegant.
Wish I was up to date with current electronics but I quit having much to do with it when surface ount components reared their ugly little heads.
If I had a schematic I suppose I could get my bro in Florida to make me one....

(He is the family nerd)
__________________
UK and USA: Our leaders MAY be buffoons but they are still dangerous buffoons.
ivansc is offline   Reply With Quote
Old 11-02-2016, 12:29 PM   #3
lolilol1975
Human being with feelings
 
Join Date: Dec 2015
Posts: 1,191
Default

Justin will like this.
lolilol1975 is offline   Reply With Quote
Old 11-02-2016, 01:29 PM   #4
shift838
Human being with feelings
 
Join Date: Sep 2016
Posts: 7
Default

The Teensy is a very handy little unit. You can mount it to most any basic circuit board to design and connect the appropriate pins.

the USB provides the necessary voltage to the board.

Teensy pins:

0 = Toggle
pins 1-8 hook up to the momentary switches
pin 14 to LED #1
Pin 15 to LED #2

All grounds are shared and hook up to ground pin on the Teensy 3.2

I even created a VB .NET program that can run and test when the buttons and pressed and released and will display the MIDI CC or Note Code

I did make a video of it working and have added it to the original post.

Last edited by shift838; 11-02-2016 at 01:35 PM.
shift838 is offline   Reply With Quote
Old 11-02-2016, 01:43 PM   #5
cyrano
Human being with feelings
 
cyrano's Avatar
 
Join Date: Jun 2011
Location: Belgium
Posts: 2,550
Default

Quote:
Originally Posted by ivansc View Post
Wish I was up to date with current electronics but I quit having much to do with it when surface ount components reared their ugly little heads.
That's a no-good excuse, Ivan.

The Teensy is available as 16 pin DIL and as a readymade board. Just need to add some wiring, power and program the thing. Hardly any external components needed. And programming is as simple as running the editor on your PC and uploading the firmware. You've probably done that several times for your audio interface...

The hardest part is making the case, really.

Quote:
If I had a schematic I suppose I could get my bro in Florida to make me one....

(He is the family nerd)
Schematics are available on the net, as this is a fairly standard application for Teensies. And for a couple of other cheap microcontrollers out there too.
__________________
Next thing on the todo list: introduce your paranoia to your imagination.

Last edited by cyrano; 11-02-2016 at 02:01 PM.
cyrano is offline   Reply With Quote
Old 11-02-2016, 01:54 PM   #6
memyselfandus
Human being with feelings
 
memyselfandus's Avatar
 
Join Date: Oct 2008
Posts: 1,598
Default

Yes!!
memyselfandus is offline   Reply With Quote
Old 11-02-2016, 02:13 PM   #7
shift838
Human being with feelings
 
Join Date: Sep 2016
Posts: 7
Default

The code was simple. I kept it real simple at first. I know I can add arrays to make it leaner but the below code works good. My next version will include arrays and support for a small 128x64 LCD screen.

#include <Bounce.h>

// the MIDI channel number to send messages
const int channel = 1;
const int DT = 10; // Debounce time
const int cc = 127;
const int note = 110;

const int MIDI_MODE_NOTES = 0;
const int MIDI_MODE_CCS = 1;

// MIDI CC Messages based by button
const int cc1 = 24;
const int cc2 = 25;
const int cc3 = 26;
const int cc4 = 27;
const int cc5 = 20;
const int cc6 = 21;
const int cc7 = 22;
const int cc8 = 23;

//MIDI Notes Messages based by button
const int nc1 = 40;
const int nc2 = 41;
const int nc3 = 42;
const int nc4 = 43;
const int nc5 = 36;
const int nc6 = 37;
const int nc7 = 38;
const int nc8 = 39;

//Set's Pin numbers that LEDs are connected to
int bluePin = 14;
int greenPin = 15;
int PIN_C0 = 0;
int midiMode = MIDI_MODE_NOTES;

// Create Bounce objects for each button. The Bounce object
// automatically deals with contact chatter or "bounce", and
// it makes detecting changes very simple.
Bounce button0 = Bounce(0, DT);
Bounce button1 = Bounce(1, DT);
Bounce button2 = Bounce(2, DT); // which is appropriate for good
Bounce button3 = Bounce(3, DT); // quality mechanical pushbuttons
Bounce button4 = Bounce(4, DT);
Bounce button5 = Bounce(5, DT); // if a button is too "sensitive"
Bounce button6 = Bounce(6, DT); // to rapid touch, you can
Bounce button7 = Bounce(7, DT); // increase this time.
Bounce button8 = Bounce(8, DT);
// Bounce button9 = Bounce(9, DT);
// Bounce button10 = Bounce(10, DT);
// Bounce button11 = Bounce(11, DT);

void setup() {
// Configure the pins for input mode with pullup resistors.
// The pushbuttons connect from each pin to ground. When
// the button is pressed, the pin reads LOW because the button
// shorts it to ground. When released, the pin reads HIGH
// because the pullup resistor connects to +5 volts inside
// the chip. LOW for "on", and HIGH for "off" may seem
// backwards, but using the on-chip pullup resistors is very
// convenient. The scheme is called "active low", and it's
// very commonly used in electronics... so much that the chip
// has built-in pullup resistors!

pinMode(bluePin, OUTPUT);
pinMode(greenPin,OUTPUT);
pinMode(PIN_C0,INPUT);

pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP); // Teensy++ 2.0 LED, may need 1k resistor pullup
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
//pinMode(9, INPUT_PULLUP);
//pinMode(10, INPUT_PULLUP);
//pinMode(11, INPUT_PULLUP); // Teensy 2.0 LED, may need 1k resistor pullup
// Check the status of the toggle switch, and set the MIDI mode based on this.

if (digitalRead(PIN_C0)) {
digitalWrite(bluePin,HIGH);
midiMode = MIDI_MODE_NOTES;
} else {
digitalWrite(greenPin,HIGH);
midiMode = MIDI_MODE_CCS;
}
}


void loop() {
// Update all the buttons. There should not be any long
// delays in loop(), so this runs repetitively at a rate
// faster than the buttons could be pressed and released.

button0.update();
button1.update();
button2.update();
button3.update();
button4.update();
button5.update();
button6.update();
button7.update();
button8.update();
//button9.update();
//button10.update();
//button11.update();

// Check each button for "falling" edge.
// Send a MIDI Note On message when each button presses
// Update the Joystick buttons only upon changes.
// falling = high (not pressed - voltage from pullup resistor)
// to low (pressed - button connects pin to ground)


if (button1.fallingEdge()) {
if (midiMode == MIDI_MODE_CCS)
usbMIDI.sendControlChange(cc1, cc, channel);
else
usbMIDI.sendNoteOn(nc1, note, channel);
}
if (button2.fallingEdge()) {
if (midiMode == MIDI_MODE_CCS)
usbMIDI.sendControlChange(cc2, cc, channel);
else
usbMIDI.sendNoteOn(nc2, note, channel);
}
if (button3.fallingEdge()) {
if (midiMode == MIDI_MODE_CCS)
usbMIDI.sendControlChange(cc3, cc, channel);
else
usbMIDI.sendNoteOn(nc3, note, channel);
}
if (button4.fallingEdge()) {
if (midiMode == MIDI_MODE_CCS)
usbMIDI.sendControlChange(cc4, cc, channel);
else
usbMIDI.sendNoteOn(nc4, note, channel);
}
if (button5.fallingEdge()) {
if (midiMode == MIDI_MODE_CCS)
usbMIDI.sendControlChange(cc5, cc, channel);
else
usbMIDI.sendNoteOn(nc5, note, channel);
}
if (button6.fallingEdge()) {
if (midiMode == MIDI_MODE_CCS)
usbMIDI.sendControlChange(cc6, cc, channel);
else
usbMIDI.sendNoteOn(nc6, note, channel);
}
if (button7.fallingEdge()) {
if (midiMode == MIDI_MODE_CCS)
usbMIDI.sendControlChange(cc7, cc, channel);
else
usbMIDI.sendNoteOn(nc7, note, channel);
}
if (button8.fallingEdge()) {
if (midiMode == MIDI_MODE_CCS)
usbMIDI.sendControlChange(cc8, cc, channel);
else
usbMIDI.sendNoteOn(nc8, note, channel);
}

// If in note mode send note off commands
if (button1.fallingEdge()) {
if (midiMode == MIDI_MODE_NOTES)
usbMIDI.sendNoteOff(nc1, note, channel);
}
if (button2.fallingEdge()) {
if (midiMode == MIDI_MODE_NOTES)
usbMIDI.sendNoteOn(nc2, note, channel);
}
if (button3.fallingEdge()) {
if (midiMode == MIDI_MODE_NOTES)
usbMIDI.sendNoteOn(nc3, note, channel);
}
if (button4.fallingEdge()) {
if (midiMode == MIDI_MODE_NOTES)
usbMIDI.sendNoteOn(nc4, note, channel);
}
if (button5.fallingEdge()) {
if (midiMode == MIDI_MODE_NOTES)
usbMIDI.sendNoteOn(nc5, note, channel);
}
if (button6.fallingEdge()) {
if (midiMode == MIDI_MODE_NOTES)
usbMIDI.sendNoteOn(nc6, note, channel);
}
if (button7.fallingEdge()) {
if (midiMode == MIDI_MODE_NOTES)
usbMIDI.sendNoteOn(nc7, note, channel);
}
if (button8.fallingEdge()) {
if (midiMode == MIDI_MODE_NOTES)
usbMIDI.sendNoteOn(nc8, note, channel);
}


// Check the status of the toggle switch, and set the MIDI mode based on this.
if (button0.fallingEdge())
{
midiMode = MIDI_MODE_CCS;
digitalWrite(bluePin, LOW);
digitalWrite(greenPin,HIGH);
}
else if (button0.risingEdge())
{
midiMode = MIDI_MODE_NOTES;
digitalWrite(bluePin, HIGH);
digitalWrite(greenPin,LOW);
}
// MIDI Controllers should discard incoming MIDI messages.

while (usbMIDI.read()) {
// ignore incoming messages
}
delay(10);
}
shift838 is offline   Reply With Quote
Old 11-02-2016, 02:23 PM   #8
Softsynth
Human being with feelings
 
Softsynth's Avatar
 
Join Date: Jun 2015
Posts: 3,572
Default

Well done shift838,
Hopes went up when I saw the title. I recently ordered an Audiofront widget for expression pedal to USB after having looked and failed to find a satisfactory DIY project. I have a MIDI keyboard up the creek and a digital piano lacking expression input.

I would like a USB input for expression pedal, or better still multiple expression pedals and/or piano pedals. Anyone know of such a diy project?
Softsynth is offline   Reply With Quote
Old 11-02-2016, 02:39 PM   #9
shift838
Human being with feelings
 
Join Date: Sep 2016
Posts: 7
Default

Quote:
Originally Posted by Softsynth View Post
Well done shift838,
Hopes went up when I saw the title. I recently ordered an Audiofront widget for expression pedal to USB after having looked and failed to find a satisfactory DIY project. I have a MIDI keyboard up the creek and a digital piano lacking expression input.

I would like a USB input for expression pedal, or better still multiple expression pedals and/or piano pedals. Anyone know of such a diy project?
Check this one out. This is a DIY expression pedal. Should get you in the right direction. I would think since the Teensy is Arduino compatible you could use the same code with very little modifications.

http://imajji.net/topic/watch/vid01Tp3aONkvUP8
shift838 is offline   Reply With Quote
Old 11-02-2016, 02:43 PM   #10
Softsynth
Human being with feelings
 
Softsynth's Avatar
 
Join Date: Jun 2015
Posts: 3,572
Default

Quote:
Originally Posted by shift838 View Post
Check this one out. This is a DIY expression pedal. Should get you in the right direction. I would think since the Teensy is Arduino compatible you could use the same code with very little modifications.

http://imajji.net/topic/watch/vid01Tp3aONkvUP8
That page comes with virus infection warning. Claiming to be from Microsoft.
Softsynth is offline   Reply With Quote
Old 11-02-2016, 02:51 PM   #11
shift838
Human being with feelings
 
Join Date: Sep 2016
Posts: 7
Default

Quote:
Originally Posted by Softsynth View Post
That page comes with virus infection warning. Claiming to be from Microsoft.
pulls up fine on my Windows 10 with McAfee no problem.
shift838 is offline   Reply With Quote
Old 11-02-2016, 02:57 PM   #12
Softsynth
Human being with feelings
 
Softsynth's Avatar
 
Join Date: Jun 2015
Posts: 3,572
Default

Quote:
Originally Posted by shift838 View Post
pulls up fine on my Windows 10 with McAfee no problem.
Page opened fine. Win 10.
Then warning come with voice claiming to be from Microsoft. Critical no D845....blah blah. It claimed Microsoft would be forced to shut down my computer from infecting their networks if I closed that page.
I could only close the page by closing I.Explorer. I ran virus check, nothing, think it is just a confidence trick, lacking a real virus.

I only had I.Explorer open. Quick scan found nothing, now doing full scan, just in case.

Last edited by Softsynth; 11-02-2016 at 03:04 PM.
Softsynth is offline   Reply With Quote
Old 11-02-2016, 03:08 PM   #13
shift838
Human being with feelings
 
Join Date: Sep 2016
Posts: 7
Default

Quote:
Originally Posted by Softsynth View Post
Page opened fine. Win 10.
Then warning come with voice claiming to be from Microsoft. Critical no D845....blah blah. It claimed Microsoft would be forced to shut down my computer from infecting their networks if I closed that page.
I could only close the page by closing I.Explorer. I ran virus check, nothing, think it is just a confidence trick, lacking a real virus.

I only had I.Explorer open. Quick scan found nothing, now doing full scan, just in case.
I've seen that on other pages before and had to kill IE in the task manager.

I opened it up via IE 11 and Edge and did not see it just to make sure. I even tried Chrome on another machine no report of any issues.

Anyway... an expression pedal should be easily done with a 10k potentiometer and an arduino style board a couple of resistors.
shift838 is offline   Reply With Quote
Old 11-02-2016, 03:32 PM   #14
ivansc
Human being with feelings
 
Join Date: Aug 2007
Location: Near Cambridge UK and Near Questembert, France
Posts: 15,972
Default

Quote:
Originally Posted by cyrano View Post
That's a no-good excuse, Ivan.

The Teensy is available as 16 pin DIL and as a readymade board. Just need to add some wiring, power and program the thing. Hardly any external components needed. And programming is as simple as running the editor on your PC and uploading the firmware. You've probably done that several times for your audio interface...

The hardest part is making the case, really.



Schematics are available on the net, as this is a fairly standard application for Teensies. And for a couple of other cheap microcontrollers out there too.

O.K. You build one and I will drop in at your place next time I hit Dunkerque for a look over your shoulder!!! ... or you could just program mine if I pluck up the courage to build the box and innards!

Hard to believe I am saying this! Years ago my little electronic firm were one of Acorn's first customers for their one-board 6502 based 'puter & "computerised" our range of scientific instruments in a week with it!
But that was long ago & I honestly think my brain is finally clogging up with all the stuff I have crammed into it these last 70 odd years. Never thought I would admit defeat to technology....


@ OP: Aw shoot! I took a look at the PJRC store and for the price I guess I can even afford to mess a couple of those up "learning by doing" can't I? About to order one... Hope the UK customs don't ream me a new one on duty!
Also, any chance of a photo of the innards, just to see how you laid it out and attached the board to the "case"?
__________________
UK and USA: Our leaders MAY be buffoons but they are still dangerous buffoons.

Last edited by ivansc; 11-02-2016 at 03:46 PM.
ivansc is offline   Reply With Quote
Old 11-02-2016, 03:41 PM   #15
shift838
Human being with feelings
 
Join Date: Sep 2016
Posts: 7
Default

i have posted a folder link to the dropbox now with more photos in the original post.
shift838 is offline   Reply With Quote
Old 11-02-2016, 03:53 PM   #16
Softsynth
Human being with feelings
 
Softsynth's Avatar
 
Join Date: Jun 2015
Posts: 3,572
Default

Quote:
Originally Posted by shift838 View Post
I've seen that on other pages before and had to kill IE in the task manager.

I opened it up via IE 11 and Edge and did not see it just to make sure. I even tried Chrome on another machine no report of any issues.

Anyway... an expression pedal should be easily done with a 10k potentiometer and an arduino style board a couple of resistors.
Yes, of course I killed it in task manager, and well I'm still here, Microsoft didn't immediately shut me down to protect their networks!!!

In that case I guess I must have somehow clicked on one of the adverts?
I do not know how that happened though as I am not currently on a laptop or using a touch pad where this can occur by accident.

Back to the project:
The Arduino board could be a good option. I do not actually want the pedals themselves, just a connector and controller software.

First thing is to find out how good the Audiofront widget is.
Softsynth is offline   Reply With Quote
Old 11-02-2016, 05:36 PM   #17
Borodog
Human being with feelings
 
Join Date: Dec 2014
Posts: 147
Default

Niiiice.
Borodog is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.