Midi/USB Foot Controller. DIY or not?

Ciao Paolo. Hai tirato fuori il coniglio dal cilindro!!!
You pulled the rabbit out of the hat (to put it in Italian …). It is really interesting what you found for me. I was trying until a few minutes ago, without succeeding. In fact, I didn’t know how to find a starting point, an idea. Thank you, see how I can possibly recycle my EC5. Notwithstanding that Line 6 or Behringer remains my basic idea. I’ll let you know what I’m up to!
Thanks
Sergio

Giving the EC5 a new life only worth if you use a DIY solution.
A Line 6 FBV Express MKII comes about €85, It’s quite inexpensive for a out-of-the-box ready device with four switches and a continuous pedal.
My 2 €cents.

Hi Paolo
I like the DIY solution for the EC5, no doubt about it. In particular it could be useful because it has the switches on the same row, it is easier to use them.
Meanwhile, I take the Line 6 FBV Express because it is very immediate, it is simple to configure and use.
The other solution I will see later, maybe I will have to take two cards to get to the use of the 5 switches contained in the EC5. But I will see this later.
Thanks, for now, for the (dritta) information.
Sergio

You can manage all the 5 switches (and more!) with one board. Of course, a good skill in microprocessor programming language is needed. It’s definitely not a ready to use option.

I believe, then, that I will stop here. I’m not so sure I’m that good! I should read something on the subject to see if I can understand how to program. I thought the card was ready to use. I honestly don’t even know what it takes to program the processor.

Sergio,
I did exactly what you are trying to attempt. Only with a Behringer footswitch that has four buttons. See here MIDI Footswitch Controller

If you need help with it, let me know.

1 Like

Hi John, thanks for your reply.
I’m glad you did something that I would like to do too. I just don’t know much about it. How could you help me? I’m reading the thread you submitted to me very carefully.
What would you advise me, to begin with?
Sergio

I’m not familiar with your pedal. Does it have room inside to mount the Arduino board? They are pretty small, about 2 1/2 inces x 2 inches x 3/4 inch.

Step 1 Wire the switches to the Arduino
Step 2 Modify the code for your needs ( # of switches and CC#s you want to use
Step 3 Upload the code to the Arduino
Step 4 Flash the bios to make it a universal MIDI device
Step 5 Mount the Arduino board in the pedal

It really is very easy to do. Your pedal has 6 wires connecting the switches. One is the ground, the others are signal. Connect the common wire (ground) to the Arduino ground the other five wires will connect to the “digital” inputs of the Arduino. The code in my example is for four buttons, you can use that as a guide to add the fifth button. The only tricky part is flashing the Arduino bios to make it a bootable MIDI controller. You can assign any MIDI CC# to each of the buttons. I used a few that were not used in the standard controller range. Once you get started if you any have problems, PM me and I’ll help you work it out.
Of course, if you want to send me the pedal and an Arduino Uno, I can build it for you.

where are you from?

You wrote:
“The only tricky part is flashing the Arduino bios to make it a bootable MIDI controller.”
This part I don’t know how to set up. Could you help me?

I’m in Florida, US

To create a custom hex file for your controller to be a universal MIDI device go here, enter the name you want to use (FS-101, Footswitch, etc), the manufacturer is you (what ever you want it to be)
https://moco-lufa-web-client.herokuapp.com/#/

Next
You will need this software from Microchip
https://www.microchip.com/en-us/development-tool/flip
Once you have modified the code and uploaded it to the Arduino you then run Flip.

This video shows how to install the proper driver and use Flip (around the 4:00 mark)

Glad to help

I’m from Rome, Italy, too far away …
I took a look at the Arduino site, there is a video explaining how to program, it’s in Italian (easier for me).
If I don’t find it difficult to understand the programming, I try to do it. I saw on Amazon Arduino Uno, it doesn’t cost much.
But first I want to understand if I can proceed with the programming and then, eventually, take it.
I will also see the videos you proposed and then I will make a summary of everything.

I can’t help but thank you for your help. Thanks John, I’ll let you know.
Sergio

You could also try a Teensy 4.1 board.

They are very small and also easy to program. I’m working on box right now with a couple of switches, a volume knob, and hopefully a breath controller (waiting on parts…)

Rick

Hi Rick.
Today is a day of surprises !!! Since I wanted to give up completely, now I find myself more than intrigued by so much abundance!
As soon as you have new news, let me know.
Then you will explain to me what the price of the card can be and if the programming can be simple.
Sergio

Hi John.
I think I also understood how Arduino Uno is programmed, I downloaded the program and ordered a couple of boards.
I wanted to ask you for a little help: Could you help me write the script for 5 buttons and 2 knobs (for Volume and Expression)? As I understand from the instructions it is possible to insert in the context both digital and analog formats (buttons - potentiometers).
I have read your program for 4 buttons, and maybe you could help me, highlighting the new program lines in red, so I learn how to do it.
My EC5 does not have much space inside it, but I can provide it in another way, with an external box.
I would like to take advantage of building an external box because I would like to build a Half Moon (for this I was also asking you for programming for potentiometers, but I see this after I have learned to program well !!)
In this way I can resurrect my legendary Korg EC5 pedalboard !!
regards
Sergio

Here is the code I wrote for a hand controller with 6 buttons and two pots.
Copy and paste it into the Arduino IDE
In the first section labeled // BUTTONS
Change N_BUTTONS = to the number of buttons you want to use.
Change BUTTON_ARDUINO_PIN to the list of digital pins you connected each button to.
In the next section labeled // POTENTIOMETERS
Change N_POTS = to the number of pots
Change POT_ARDUINO_PIN to the list of analog pins you connected the pots to
Upload it to the Arduino, flash the bios and you are done.

(Copy from the next line and paste into the IDE)

// – Defines the MIDI library – //
// if using with ATmega328 - Uno, Mega, Nano…
#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

/////////////////////////////////////////////
// BUTTONS
const int N_BUTTONS = 6; //* total numbers of buttons

const int BUTTON_ARDUINO_PIN[N_BUTTONS] = {0, 2, 4, 6, 8 ,10}; //* pins of each button connected straight to the Arduino

int buttonCState[N_BUTTONS] = {}; // stores the button current value
int buttonPState[N_BUTTONS] = {}; // stores the button previous value

//#define pin13 1 //* uncomment if you are using pin 13 (pin with led), or comment the line if not using
byte pin13index = 12; //* put the index of the pin 13 of the buttonPin[] array if you are using, if not, comment

// debounce
unsigned long lastDebounceTime[N_BUTTONS] = {0}; // the last time the output pin was toggled
unsigned long debounceDelay = 10; //* the debounce time; increase if the output flickers

/////////////////////////////////////////////
// POTENTIOMETERS
const int N_POTS = 2; //* total numbers of pots (slide & rotary)
const int POT_ARDUINO_PIN[N_POTS] = {A1, A3}; //* pins of each pot connected straight to the Arduino

int potCState[N_POTS] = {0}; // Current state of the pot
int potPState[N_POTS] = {0}; // Previous state of the pot
int potVar = 0; // Difference between the current and previous state of the pot

int midiCState[N_POTS] = {0}; // Current state of the midi value
int midiPState[N_POTS] = {0}; // Previous state of the midi value

const int varThreshold = 4; //* Threshold for the potentiometer signal variation

/////////////////////////////////////////////
// MIDI
byte midiCh = 1; //* MIDI channel to be used
byte cc = 105; //* Lowest MIDI CC to be used
byte ccp = 103; //* Lowest MIDI CC to be used

/////////////////////////////////////////////
// SETUP
void setup() {

// Baud Rate
// use if using with ATmega328 (uno, mega, nano…)
Serial.begin(31250); //*

// Buttons
// Initialize buttons with pull up resistors
for (int i = 0; i < N_BUTTONS; i++) {
pinMode(BUTTON_ARDUINO_PIN[i], INPUT_PULLUP);
}

// Pots
for (int i = 0; i < N_POTS; i++)
{

// Initialise the analogue value with a read to the input pin.
potCState[i] = analogRead(POT_ARDUINO_PIN[i]);

}

#ifdef pin13 // inicializa o pino 13 como uma entrada
pinMode(BUTTON_ARDUINO_PIN[pin13index], INPUT);
#endif

}

/////////////////////////////////////////////
// LOOP
void loop() {

buttons();
potentiometers();
}
/////////////////////////////////////////////
// BUTTONS
void buttons() {

for (int i = 0; i < N_BUTTONS; i++) {

buttonCState[i] = digitalRead(BUTTON_ARDUINO_PIN[i]);  // read pins from arduino

#ifdef pin13
if (i == pin13index) {
buttonCState[i] = !buttonCState[i]; // inverts the pin 13 because it has a pull down resistor instead of a pull up
}
#endif

if ((millis() - lastDebounceTime[i]) > debounceDelay) {

  if (buttonPState[i] != buttonCState[i]) {
    lastDebounceTime[i] = millis();

    if (buttonCState[i] == LOW) {

// use if using with ATmega328 (uno, mega, nano…)
MIDI.sendControlChange(cc + i, 127, 1); // cc number, cc value, midi channel

    }
    }
    buttonPState[i] = buttonCState[i];
  }
}

}

/////////////////////////////////////////////
// POTENTIOMETERS
void potentiometers() {

for (int i = 0; i < N_POTS; i++) { // Loops through all the potentiometers
potCState[i] = analogRead(POT_ARDUINO_PIN[i]); // reads the pins from arduino
midiCState[i] = map(potCState[i], 0, 1023, 0, 127); // Maps the reading of the potCState to a value usable in midi
potVar = abs(potCState[i] - potPState[i]);
if (potVar > varThreshold) { // Opens the gate if the potentiometer variation is greater than the threshold

  if (midiCState[i] != midiPState[i]) {
      MIDI.sendControlChange(ccp + i, midiCState[i], midiCh);
      potPState[i] = potCState[i]; // Stores the current reading of the potentiometer to compare with the next
      midiPState[i] = midiCState[i];
  }
}

}
}

One more thing.
In the following section, I define what cc numbers to use
cc is the starting number for the buttons
ccp is the starting number for the pots
you can change these to any Control Change values you want.
They will be incremented.
Since there were two pots in mine, the pots will send 103 and 104
the buttons will send 105 through 110

// MIDI
byte midiCh = 1; //* MIDI channel to be used
byte cc = 105; //* Lowest MIDI CC to be used
byte ccp = 103; //* Lowest MIDI CC to be used

Hey @Sergio,

just a word of advice: don’t make the same mistake with this project as with your start into Cantabile - don’t try to ask others to do your work for you. If you’re serious about getting into the world of microcontroller projects (building and programming), you need to learn that stuff starting with the basics. Get a first Teensy and a breadboard (if you don’t know what that is, then definitely find out), a couple of buttons and LEDs - do a lot of reading on the 'net and get your feet wet!

There are no easy shortcuts when it comes to electronics and programming - learn your stuff step by step, do a lot of googling to find how others have cracked their problems, and become reasonably proficient. Then - and only then - come back for advice when you get stuck. Getting into microcontroller projects is not something you do for an afternoon - learning to program and designing and building your projects is something that requires studying, determination and a lot of patience. If you’re serious about this, then I wish you all the best - it’s a lot of fun!

But don’t start out on this if it’s just for solving this one problem - there are easier ways to address this - like the AudioFront MIDI Expression that @ClintGoss mentioned above.

Or get someone who knows their way around an Arduino to build you a little box that does what you want - but please DO pay or otherwise compensate them for their effort. Programming is a valuable skill - you shouldn’t expect everything for free…

I am getting the impression that you are on another spontaneous wild goose chase here, and you seem to expect others to solve things for you - but that’s not how this community works.

Apologies if I sound like an old school headmaster - must be in my genes :wink:

Cheers,

Torsten

2 Likes

Sergio,
Regardless of your past “spontaneous wild goose chases”, I am happy to help you get this working. You shouldn’t bang your head to figure out what someone else has already accomplished.
Some people learn best by asking for help, others may go it alone and teach themselves.
Wire your device, copy and paste my code, make the needed changes, upload it, and flash the bios. Enjoy your new controller.

John, Arduino Uno will arrive next Tuesday or Wednesday. In the meantime, I will copy what you have proposed to me. For this I thank you. I’ll be answering your help post in more detail shortly. I have to go away for an urgency, see you soon.
Sergio