Introduction: Custom Midi Controller
This tutorial shows you how to make a custom midi controller. (presumes experience with midi controllers, simple circuits, simple c coding)
Step 1: Figure Out What Controls You Want on Your Controller
How many/what parts do you want on your controller?
Do you want Sliders? Knobs? Buttons?
Other electronic sensors may be used as well, such as gyroscopes, or *blank* sensitive resistors
Check to make sure the parts come with easy connectors, like male/female pins, and if they don't, order them separately. It may be useful to get wire crimps for easy breadboard testing.
Also make sure to save the data sheets, (sellers usually provide a link online)
Order all the parts you desire, along with an Arduino.
Step 2: Design a Board/case
Once your parts come, measure their dimensions for mounting.
Design a board/case accordingly in a 3d software such as rhinoceros(theres a fully featured free trial).
Use a 3d printer or send the model to a 3d printing company to get your design.
Step 3: Test Your Sensors, Dials, Faders, Etc
Before you start assembling everything on to the board, test your sensors to make sure you can get them working.
Open up the Arduino coding environment, and for each potentiometer, use this code, asterisks mean use
int val;
int lastVal;
void midiMessage(byte command, byte data1, byte data2)
{ Serial.write(command); Serial.write(data1); Serial.write(data2); }
void setup()
{
Serial.begin(9600);
}
void loop()
{
}
_______________
Inside the loop function follow this format for each potentiometer or range of values you are reading through analog inputs:
val = analogRead(*analog pin#*);
if (val != lastVal)
{
midiMessage(176,1,leftslideVal);
}
lastVal = Val;
________________
The midi data will be sent to a serial port. Now its time to receive that data with max/msp, and send them out as midi messages.
Here is a max patch that you can use to test that your sensors are working, (and later send midi data to a DAW)
Step 4: Testing Cont.
The letter in the "serial c 9600" box names the serial port.
Plug in your Arduino, then hit the print box to see your serial ports show up in the max console.
change the letter in "serial c 9600" to the Arduino serial port.
Upload your Arduino code, the fiddle with sensors to see the lowest and highest values, as they show up in the Max number box. Remember the range of values for each sensor.
Change the line
val = analogRead(*analog pin#*);
to
val = map(analogRead(*analog pin#*), "lowest value*, *highest value*, 0, 127);
This makes the sensor values fit between 0 and 127, which is necessary for creating midi messages.
Re-upload your Arduino code to see all the sensor values stay within 0-127.
Now, double click the midiout box and choose "from max 1" or "from max 2"
In your DAW you will be able to see "from max 1" or "from max 2" as a midi input.
Step 5: Final Assembly
Once all your sensors are working, its time for the final assembly. Mount the sensors, solder wires, tuck them away, making everything neat and sturdy.