Introduction to DIY Midi Controllers Part 3

I know, I know, you came here to twist knobs, and while it’s exciting to have a continuously flashing Arduino to light your way through the dark nights, it doesn’t help much with your music making.

So, grab a breadboard, some cables, a pot and let’s continue making our first controller.

Breadboards are laid out in rows and columns that are separated from each other.

The holes on the left and right parts, highlighted in blue and red, are connected together in vertical columns we will call rails.

In the centre section, highlighted in yellow and green, the holes are connected horizontally with a gap dividing it into two sides.

If you place things in the rail columns they will be connected together.

If you place things in the horizontal rows they will be connected together.

You can place things to jump over the gaps, like the resistors in the image below. These LEDs are connected to the resistors on one pin, but are not connected to anything on the other pin.

Now let’s connect the 5V and ground (GND) of our Arduino to our breadboard rails. Take two male to male cables and connect the Arduino 5V to one of the breadboard rails and the Arduino GND to the other breadboard rail.

Potentiometers (pots) are variable resistors that can be changed from zero through to their max resistance. For our midi controller we connect them to the Arduino using three wires; ground, 5V, and an analog input. When the knob is fully turned in one direction there are 0 volts going from the pot output to the Arduino analog input, when it is fully turned in the opposite direction the max volts are going to the Arduino input.

Push a pot into the breadboard. The reason I have placed it so far away from the rail is so it’s easier to turn the pot with our hands.

Connect the outer pot pins (Vcc and GND) to the 5V and ground rails we setup earlier. Now connect the output of the pot (middle pin) to analog input A0 on the Arduino.

Coding time

To make life easier we are going to use a library to help us build our controller. Libraries are collections of code that have been created for adding extra functionality and reducing complex tasks to simple commands. The library we are going to use is called Midi.Controller.

This is where we say a massive thank you to the library creator Pieter P.
Click below to download.

Alternatively, visit the GitHub page for the library

After downloading, we can add the library to our Arduino software.

Go to Sketch/Include Library/Add .ZIP Library and choose the ZIP file you downloaded.

Connect the Arduino to the computer using the USB cable.

Make a new sketch (file/new) copy and paste the code below, and then file/save it to your computer. The code below has notes with explanations about the functions.

#include <MIDI_Controller.h> // Include the library

// The code below creates a new instance of the class 'Analog', called 'potentiometer', on Arduino pin A0, 
// that sends messages with midi Control number 16, on midi channel 1

Analog potentiometer {A0, 0x10, 1};

void setup() {};

void loop() {
  // Refresh the MIDI controller to check whether the potentiometer's input is changing

Verify the code.

Upload the code to the Arduino.

Let’s test our first midi controller

At the time of writing I’m using Ableton 10, so the next few steps may be different for your DAW of choice. You may need to go to the preferences in your DAW and activate your Arduino.

Open Ableton, go to Options/Preferences in the menu and then select the Link/Midi tab.

You should see the Arduino listed under MIDI Ports. Switch on the controller Track and Remote.

Next, select Edit Midi Map from the Options menu or press Ctrl+M.

The items that can be mapped will now be highlighted. Click on Send A on one of the mixer channels to select it, then turn the potentiometer on your Arduino controller.

Hopefully control change 16 appeared under the Midi Mappings. Close the midi mapper using Edit Midi Map from the Options menu or press Ctrl+M.

You should now be able to control Send A with your midi controller.

Let’s try a Synth

Open up the midi mapper again and delete the control change we just made otherwise our pot will remain linked to Send A and we won’t be able to try it on a synth. Close the Midi Mapper.

You will need a synth that has a midi learn function. I’m going to use Reveal Sound Spire as an example.

In Spire click on midi learn to highlight it, then click on filter cutoff 1 and turn your Arduino controller pot to assign it. You should now be able to control the filter using your Arduino midi controller.

Tip: If your pot is working backwards swap the +Vcc and GND wires

Congratulations, you have built your first midi controller and deserve a well-earned cup of tea. Enjoy playing with your new knob for a while before moving on.

In part 4 we will build a six pot controller.