Components and supplies
Apps and online services
About this project
When I was looking to buy a MIDI stomp box with a Wah pedal, I was a little taken aback by the price. Decent ones sell for 200-300 Euro. After some online digging I found out that it's relatively easy to build one yourself for a fraction of the cost. This Arduino-based MIDI controller cost me around 40 Euro, including a seperate Wah pedal and foot switch.
It's pretty easy to put together. I think the hardest part is flashing the firmware of the Arduino Uno to change the USB connection from a serial communications port to a sound, video and game controller in Windows (I have not tested this on a Mac). Note: I used the HIDUINO project. Not all boards are compatible. From their GitHub page:.The Sketch
The first thing you have to do is upload the sketch (see code section). Using the MIDI.h library I programmed the Wah pedal, the two foot switches and the three potentiometers and the on-off switch to send MIDI control change messages. These are then recognized in your favourite DAW or VST (like Guitar Rig or Amplitube) and can be programmed to do all sorts of stuff.
After uploading the sketch, it is time to change the firmware of the Arduino Uno. To do this first download:
- HIDUINO zip file. hex files: the firmware files
- AtmelFlip: to flash the firmware
Then, follow these steps:
-.
- Short the two pins (see picture below) with a wire. Now the firmware is erased. You know it worked when the Arduino is no longer recognized as a COM port in the Arduino IDE.
- Disconnect and connect the Arduino Uno again. Windows will install an unknown USB device.
- Open Flip
- Select Device>Select>ATmega16U2. This is the chip on the Uno. There are some versions of the Uno with a ATmega8U2 chip. To make sure you have the ATmega16U2 one, check the chip on the board. (See picture above)
- Go to Settings> Communications > USB. Select 'Open'. It's possible that it won't open the connection at this point. You then have to install the driver manually. If this is the case, follow the next step.
- Go to Device manager in Windows and select the Unknown USB Device. Choose update driver and manually locate the driver. It is located at C:\ProgramFiles (x86)\Atmel\Flip 3.4.7\usb. After the installation repeat the previous step. it is now possible to open the connection in Flip.
- Next, in Flip, go to: File> Load Hex file. Choose arduino_midi.hex in the compiled firmwares folder in the HIDUINO folder you extracted earlier. Choose 'Run'. The new firmware is uploaded.
- When you connect the Uno now, Windows will recognize it as a MIDI Controller. It is listed as arduino_midi.
-. The Uno is now a MIDI contoller.The Hardware
This part is more straightforward. Connect everything according to the Fritzing drawing:
And put everything in a box:
Code
MIDI Controller SketchC/C++
#include <MIDI.h> MIDI_CREATE_DEFAULT_INSTANCE(); int analogExpression = A0; //expression pedal int analogPots[] = {A1, A2, A3}; //pots on top of pedal int analogPotsOld [] = {0, 0, 0}; int analogPotsNew[] = {0, 0, 0}; int readSwitchNew; //footswitches int readSwitchNew2; int readSwitchOld; int readSwitchOld2; int readExpressionPedalOld; int readExpressionPedalNew; int singleSwitchNew; //single switch on top of pedal int singleSwitchOld; //MIDI Control Numbers #define expPedalCC 50 #define footSwitch1CC 51 #define footSwitch2CC 52 int potsCC [] = {53, 54, 55}; #define singleSwitchCC 56 #define defaultChannel 14 void setup() { MIDI.begin (MIDI_CHANNEL_OFF); //start midi Serial.begin(9600); //configure pin 2 as an input and enable the internal pull-up resistor pinMode (analogExpression, INPUT); for (int x = 0; x <= 2; x++) { //pots pinMode (analogPots[x], INPUT); } pinMode(2, INPUT_PULLUP); //connect to tip //gnd to sleeve. footswitch 1 pinMode(4, INPUT_PULLUP); //connect to ring footswitch 2 pinMode (7, INPUT_PULLUP); //connect singleswitch } void loop() { //read expression pedal readExpressionPedalNew = analogRead (analogExpression); readExpressionPedalNew = (map (readExpressionPedalNew, 0, 1015, 0, 127)); readExpressionPedalNew = constrain(readExpressionPedalNew, 0, 127); if (readExpressionPedalNew == 126) { readExpressionPedalNew = 127; } if (readExpressionPedalOld != readExpressionPedalNew) { readExpressionPedalOld = readExpressionPedalNew; // send serial value (ControlNumber 1, ControlValue = analogValue, Channel 1) // more info: MIDI.sendControlChange(expPedalCC, readExpressionPedalNew, defaultChannel); Serial.println (readExpressionPedalNew); } //read the Footpedal Switches value into a variable readSwitchNew = digitalRead(4); readSwitchNew2 = digitalRead(2); if (readSwitchNew != readSwitchOld) { readSwitchOld = readSwitchNew; MIDI.sendControlChange(footSwitch1CC, 127, defaultChannel); Serial.print("Left: "); Serial.println("Change"); } if (readSwitchNew2 != readSwitchOld2) { readSwitchOld2 = readSwitchNew2; MIDI.sendControlChange(footSwitch2CC, 127, defaultChannel); Serial.print("Right: "); Serial.println("Change"); } //read Pots for (int y = 0; y <= 2; y++) { analogPotsNew[y] = analogRead (analogPots[y]); if (analogPotsNew [y] - analogPotsOld[y] >= 10 || analogPotsOld [y] - analogPotsNew[y] >= 10) { analogPotsOld[y] = analogPotsNew[y]; analogPotsNew[y] = (map (analogPotsNew[y], 0, 1023, 0, 128)); analogPotsNew[y] = (constrain(analogPotsNew[y], 0, 128)); MIDI.sendControlChange(potsCC [y], analogPotsNew[y], defaultChannel); Serial.print ("pot: "); Serial.println (analogPots[y]); Serial.print ("potread: "); Serial.println (analogPotsNew[y]); } //read singleSwitch singleSwitchNew = digitalRead (7); if (singleSwitchNew != singleSwitchOld) { singleSwitchOld = singleSwitchNew; if (singleSwitchNew ==1) { // is aan Serial.println ("On"); MIDI.sendControlChange(singleSwitchCC, 127, defaultChannel); } else { Serial.println ("Off"); MIDI.sendControlChange(singleSwitchCC, 0, defaultChannel); } } } delay (5); }
Schematics
Author
Johan van Vugt
- 2 projects
- 8 followers
Published onNovember 20, 2018
Members who respect this project
you might like