Arduino Midi Launchpad (Neopixel RGB Button)


In market there are lots of variety for midi controller devices such as-(Launchpad, Electronic Drum)
This is my First project on Midi Device with Arduino that connect with a software in pc send midi data to serial data software. In this blog I will show you how to make one for use and control any music software. I am using FL Studio in this project just work fine but there are various of platform for Midi software can also work fine just need to connect properly. To make any midi project you need some basic music software knowledge. But if choose this project for professional studio music editing the DIY version is not good you can buy one.

In this blog you are learning about a midi controller which follows:

  •             Why a Arduino DIY version easy to make and cheap
  • ·        How to make one for easy use
  • ·        The complete circuit diagram/proper connection to solder every component to the Perf board.
  • ·        Complete coding with midi mapping
  • ·        How to Control them with a perfect Music software and Communicate with Serial Software.   

Parts Needed:

There are some components need in this project which you can buy from Hobby Electronics and Online Store.



·              Arduino Nano or Micro x1
·        Tactile Switch x16
·        Ws2811 Neopixel Led x16
·        10k Pot Knob x4
·        10k Fader potentiometer x4
·        Female Header for arduino
·        Plain Wire

Outer Enclosure and Design:

Here I am using 20x20cm Square board which place and glue with 6x20cm square board and make a complete Box. Adding some 16, 30mm hole in upper side for button, leds with 10mm space and also 4, 5cm linear cut for Slide potentiometer with 20mm space and also add 4 small hole for normal knob potentiometer that’s already include a mini nut bolt for tight the adjustment.

Neopixel Led:

I used WS2811 big neopixel leds (WS2812 is a Micro or SMD Neopixel) this is help to make led button for its big size. Its take 5V power and minimum current up to 300mA for 16 led in 80% of brightness.
Here in this picture I attached tactile switch in Neopixel led lower base that work like led button

Circuit Diagram:

I make a suitable Circuit for it. Here in this Project the main tactile switches are connect with row and column situation because very low counts of pin in Arduino Nano and save some pins to connect other component like potentiometer and Neopixel led. The simple connection for this is that 10k Knob and 10k Fader Potentiometer just 3 simple pin VCC, Analog, Gnd pin which all VCC pins Connect to Arduino +5v Pin and All GND Pin connect to Arduino GND Pin but all analog pin connect separately one bye one in Arduino analog pin like this Knob Pot-{A0,A1,A2,A3}, Fader Pot-{A4,A5,A6,A7} which follows the Schematic diagram:-




Code:

The simple arduino just compile and upload the code in Arduino Nano-
#include <Keypad.h>
#include <FastLED.h>
#define NUM_LEDS 40
#define DATA_PIN 12
CRGB leds[NUM_LEDS];
int lighttime = 200;
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
  {'0','1','2','3'},
  {'4','5','6','7'},
  {'8','9','A','B'},
  {'C','D','E','F'}
};
byte colPins[COLS] = {7, 8, 9, 10};
byte rowPins[ROWS] = {3, 4, 5, 6};

Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

int val = 0; //Our initial pot values. We need one for the first value and a second to test if there has been a change made. This needs to be done for all 3 pots.
int lastVal = 0;
int val2 = 0;
int lastVal2 = 0;
int val3 = 0;
int lastVal3 = 0;
int val4 = 0;
int lastVal4 = 0;
int val5 = 0;
int lastVal5 = 0;
int val6 = 0;
int lastVal6 = 0;

void setup() {
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);
  animation();
  delay(5000);
  Serial.begin(9600);
}

void loop() {
  char customKey = customKeypad.getKey();

  if (customKey) {
    switch (customKey) {
      case '0':
        leds[0] = CRGB::Red;
        FastLED.show();
        delay(lighttime);
        leds[0] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(1);
        Serial.write(100);
        break;
      case '1':
        leds[1] = CRGB::Green;
        FastLED.show();
        delay(lighttime);
        leds[1] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(2);
        Serial.write(100);
        break;
      case '2':
        leds[2] = CRGB::Blue;
        FastLED.show();
        delay(lighttime);
        leds[2] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(3);
        Serial.write(100);
        break;
      case '3':
        leds[3] = CRGB::Red;
        FastLED.show();
        delay(lighttime);
        leds[3] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(4);
        Serial.write(100);
        break;
      case '4':
        leds[4] = CRGB::Green;
        FastLED.show();
        delay(lighttime);
        leds[4] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(5);
        Serial.write(100);
        break;
      case '5':
        leds[5] = CRGB::Blue;
        FastLED.show();
        delay(lighttime);
        leds[5] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(6);
        Serial.write(100);
        break;
      case '6':
        leds[6] = CRGB::Green;
        FastLED.show();
        delay(lighttime);
        leds[6] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(7);
        Serial.write(100);
        break;
      case '7':
        leds[7] = CRGB::Blue;
        FastLED.show();
        delay(lighttime);
        leds[7] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(8);
        Serial.write(100);
        break;
      case '8':
        leds[8] = CRGB::Red;
        FastLED.show();
        delay(lighttime);
        leds[8] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(9);
        Serial.write(100);
        break;
      case '9':
        leds[9] = CRGB::Green;
        FastLED.show();
        delay(lighttime);
        leds[9] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(10);
        Serial.write(100);
        break;
      case 'A':
        leds[10] = CRGB::Blue;
        FastLED.show();
        delay(lighttime);
        leds[10] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(11);
        Serial.write(100);
        break;
      case 'B':
        leds[11] = CRGB::Red;
        FastLED.show();
        delay(lighttime);
        leds[11] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(12);
        Serial.write(100);
        break;
      case 'C':
        leds[12] = CRGB::Blue;
        FastLED.show();
        delay(lighttime);
        leds[12] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(13);
        Serial.write(100);
        break;
      case 'D':
        leds[13] = CRGB::Red;
        FastLED.show();
        delay(lighttime);
        leds[13] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(14);
        Serial.write(100);
        break;
      case 'E':
        leds[14] = CRGB::Green;
        FastLED.show();
        delay(lighttime);
        leds[14] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(15);
        Serial.write(100);
        break;
      case 'F':
        leds[15] = CRGB::Blue;
        FastLED.show();
        delay(lighttime);
        leds[15] = CRGB::Black;
        FastLED.show();
        Serial.write(B10010000);
        Serial.write(16);
        Serial.write(100);
        break;
    }
  }
val = analogRead(0)/8;   // Divide by 8 to get range of 0-127 for midi
   if (val != lastVal) // If the value does not = the last value the following command is made. This is because the pot has been turned. Otherwise the pot remains the same and no midi message is output.
   {
   MIDImessage(176,1,val);}         // 176 = CC command (channel 1 control change), 1 = Which Control, val = value read from Potentionmeter 1 NOTE THIS SAYS VAL not VA1 (lowercase of course)
   lastVal = val;

   val2 = analogRead(1)/8;   // Divide by 8 to get range of 0-127 for midi
   if (val2 != lastVal2) 
   {
   MIDImessage(176,2,val2);}         // 176 = CC command, 2 = Which Control, val = value read from Potentionmeter 2
   lastVal2 = val2;
   
   val3 = analogRead(2)/8;   // Divide by 8 to get range of 0-127 for midi
   if (val3 != lastVal3) 
   {
   MIDImessage(176,3,val3);}         // 176 = CC command, 3 = Which Control, val = value read from Potentionmeter 3
   lastVal3 = val3;

   val4 = analogRead(3)/8;   // Divide by 8 to get range of 0-127 for midi
   if (val4 != lastVal4) 
   {
   MIDImessage(176,4,val3);}         // 176 = CC command, 3 = Which Control, val = value read from Potentionmeter 3
   lastVal4 = val4;

   val5 = analogRead(4)/8;   // Divide by 8 to get range of 0-127 for midi
   if (val5 != lastVal5) 
   {
   MIDImessage(176,5,val3);}         // 176 = CC command, 3 = Which Control, val = value read from Potentionmeter 3
   lastVal5 = val5;

   val6 = analogRead(5)/8;   // Divide by 8 to get range of 0-127 for midi
   if (val6 != lastVal6) 
   {
   MIDImessage(176,6,val3);}         // 176 = CC command, 3 = Which Control, val = value read from Potentionmeter 3
   lastVal6 = val6;


delay(10); //here we add a short delay to help prevent slight fluctuations, knocks on the pots etc. Adding this helped to prevent my pots from jumpin up or down a value when slightly touched or knocked.
}

void MIDImessage(byte command, byte data1, byte data2) //pass values out through standard Midi Command
{
   Serial.write(command);
   Serial.write(data1);
   Serial.write(data2);
}
void animation()
{
}

Software and Communication:

 Here I am using FL Studio which have lots of Midi setting and connection you can use Ableton Live but first you need to download loopMIDI software from here and just open it, Set name of the Port and press the ‘ + ’ Button.



Now open the FL Studio and go to the option and click on the Midi Setting you can also open it by pressing F10 key on your computer now your loopMidi port name appear on this setting just Click on it(Here I am using COM3 Port Name) and select the port of connection between loopMidi and Arduino.



Now Follow this step to Test First:-
Click on the Right Side Generator
Then click Drum> Click FPC
In the left side of FPC click on the Midi Note After clicking on pads and Set the Midi Notes of  pads. Every Steps here in this picture.



Comments