Introduction to DIY Midi Controllers Part 4

Bigger and Better

Add five more pots to your breadboard and take your time to connect each of them to the 5V and GND rails correctly. Next, connect the pot outputs to the remaining analog inputs on the Arduino. We already used A0 for our first pot, so connect the other pot outputs to A1, A2, A3, A4 and A5.

Make a new sketch using 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.

This time we are going to group all the pots together and call the group knobs.

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

// The code below creates a new instance of the class 'Analog', called 'knobs', on Arduino pins A0 through to A5

Analog knobs[] = {
    {A0, 0x10, 1}, 
    {A1, 0x11, 1},
    {A2, 0x12, 1},
    {A3, 0x13, 1},
    {A4, 0x14, 1},
    {A5, 0x15, 1},
};

void setup() {};

void loop() {
  // Refresh the MIDI controller to check whether the potentiometer's input is changing
  MIDI_Controller.refresh(); 
}

Verify and upload the code to the Arduino, then go and test out your new six knob controller.

Awesome right, but you have probably realised that we have used up all the analog inputs on our Arduino and can’t add anymore pots. Are we doomed to playing with only six knobs forever? Not quite.

Let’s look at a way of controlling more things using only six pots. We already grouped our pots together, now we can assign the group to a bank and use a push button to select different banks. If that doesn’t quite make sense yet, don’t worry, I’m just bad at writing tutorials, and all will become clear when we build it.


Some push buttons may have four legs but they are actually connected together. Pushing the button connects the two sides.

LEDs usually have a short leg (cathode -) and a long leg (anode +) they don’t work if you wire them up backwards. Most standard LEDs will need a resistor to stop them from going pop.


Grab another breadboard, a push button, 2 x 200 ohm resistors and 2 x LEDs (hooray, pretty lights)

Press the push button into the breadboard across the centre gap so that the pins are not connected to each other. If your button only has 2 pins then there is no need to bridge the gap.
Connect one side of the switch to the GND rail.

Use the 220 ohm resistors to connect the LEDs to the ground rail. Remember the short leg (cathode) on the LED goes to GND.

Connect the other leg of the switch to digital pin 2 on the Arduino. Connect the long legs (anode) of the LEDS to digital pins 3 and 4.

Connect the GND rail to the Arduino.

Make a new sketch using 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 'knobs', on Arduino pins A0 through to A5

Analog knobs[] = {
    {A0, 0x10, 1}, 
    {A1, 0x11, 1},
    {A2, 0x12, 1},
    {A3, 0x13, 1},
    {A4, 0x14, 1},
    {A5, 0x15, 1},
};


Bank potbank(6); // A bank called potbank with six channels
BankSelector bankSelector(potbank, { 2 }, { 3, 4} ); //bank selector switch on pin 2 controlling the bank called potbank, with leds on pins 3 and 4 


void setup()
{
    potbank.add(knobs, Bank::CHANGE_ADDRESS); // Add the group of pots called knobs to the bank called potbank
}


void loop() {
  // Refresh the MIDI controller to check inputs are changing
  MIDI_Controller.refresh(); 
}

What’s going on with that code?

Our six pots are initially set to send information over midi control change numbers 16, 17, 18, 19, 20 and 21. When the button is pressed, the second bank is selected, the LED changes, and the code adds 6 to those values. The pots are now sending midi control change information on 22, 23, 24, 25, 26 and 27. 

Enough talking, let’s test it.

Add six audio channels in Ableton and open up the Midi Mapper. Assign the six pots to Send A on the six audio channels.

Press the bank selector button on your midi controller. Then assign the six pots to Send B on the six audio channels.

Close the Midi Mapper and you should now be able to control Sends A & B by switching banks on your midi controller.

Using banks in this way allows us to build simple midi controllers that can control lots of functions.
Try out your controller on a synth, assign the six knobs to control say an oscillator section, then switch banks and assign the knobs to control an envelope or filter section.
Try altering the code to add more banks and/or LEDs.