1 / 5
DJ portable Midi_controller — image 1
1 / 5

DJ portable Midi_controller

Order a print of this model

We calculate the final price from your selected file. You review and accept it before payment.

Saved on this device.

A simple, cheap & portable midi controller with usb and no extra software needed (mac an windows)

Rating
0 / 5
Likes
8
Downloads
13
Makes
1
Views
142
Reviews
0

Updated at source:

Model information

Category
Audio
License
Creative Commons — Attribution

Made this for my good friend DJ whitezoo, I added some catpaws as knobs and N64 thumbsticks because we love Cats and played millions of hours Smash on the n64.

it only needs the power from your USB port

You will need

-4 Fader 10K linear (the case is made for the dual slider ones with mounting holes) 4-10$

-4 Rotary encoder 2-6$

-1 Arduino Leonardo (important no other microcontroller) 5-8$

-solder and wires

-a few M3 heatinserts and screws

-arduino IDE  (make sure you installed all libraries (MIDIUSB.H) and boards correctly)

-Solder instructions:

Encoder/potentiometer You can combine the 5V supply and also the ground

R.Encoder 1 : CLK →2 / DT→3 / SW→4

R.Encoder 2 : CLK →5 / DT→6 / SW→7

R.Encoder 3: CLK →8 / DT→9 / SW→10

R.Encoder 4 : CLK →11 / DT→12 / SW→13  

(the numbers are the input Pin @ Leonardo)

Potentiometer

Slide 1 : OTA→A0

Slide 2 : OTA→A2

Slide 3 : OTA→A4

Slide 4 : OTA→A5 

(Ignore the 2nd connection of the first 2 slides (OTB) in the Image, i thought it would be nice to use the dual potentiometer but the code now only reads one Input)

 

The code: 

copy Paste from HERE

----------------------------

#include <MIDIUSB.h>


 

#define NUM_ENCODERS 4

#define NUM_SLIDERS 4


 

// Encoder Pins

const int encoderPins[NUM_ENCODERS][2] = {

  {2, 3}, {5, 6}, {8, 9}, {11, 12}

};

const int encoderButtonPins[NUM_ENCODERS] = {4, 7, 10, 13};


 

// Slider Pins

const int sliderPins[NUM_SLIDERS] = {A0, A2, A4, A5};


 

// MIDI Channel (1-16 for MIDI standards)

const byte midiChannel = 1;


 

// Encoder Variables

int lastEncoderValue[NUM_ENCODERS] = {0};

bool encoderButtonState[NUM_ENCODERS] = {false};


 

// Slider Variables

int lastSliderValue[NUM_SLIDERS] = {0};


 

// Function to send MIDI control change messages

void sendControlChange(byte control, byte value, byte channel) {

  midiEventPacket_t event = {0x0B, 0xB0 | (channel - 1), control, value};

  MidiUSB.sendMIDI(event);

  MidiUSB.flush();

}


 

void setup() {

  // Initialize Encoder Pins

  for (int i = 0; i < NUM_ENCODERS; i++) {

    pinMode(encoderPins[i][0], INPUT_PULLUP);

    pinMode(encoderPins[i][1], INPUT_PULLUP);

    pinMode(encoderButtonPins[i], INPUT_PULLUP);

  }


 

  // Initialize Slider Pins

  for (int i = 0; i < NUM_SLIDERS; i++) {

    pinMode(sliderPins[i], INPUT);

  }

}


 

void loop() {

  // Handle Encoders

  for (int i = 0; i < NUM_ENCODERS; i++) {

    int encoderValue = digitalRead(encoderPins[i][0]) - digitalRead(encoderPins[i][1]);

    if (encoderValue != lastEncoderValue[i]) {

      byte midiValue = encoderValue > lastEncoderValue[i] ? 1 : 127; // Increment or decrement

      sendControlChange(10 + i, midiValue, midiChannel); // Use CC 10-13 for encoders

      lastEncoderValue[i] = encoderValue;

    }

   

    bool buttonState = digitalRead(encoderButtonPins[i]) == LOW;

    if (buttonState != encoderButtonState[i]) {

      byte midiValue = buttonState ? 127 : 0;

      sendControlChange(14 + i, midiValue, midiChannel); // Use CC 14-17 for encoder buttons

      encoderButtonState[i] = buttonState;

    }

  }


 

  // Handle Sliders

  for (int i = 0; i < NUM_SLIDERS; i++) {

    int sliderValue = analogRead(sliderPins[i]) / 8; // Scale 0-1023 to 0-127 for MIDI

    if (abs(sliderValue - lastSliderValue[i]) > 2) { // Only send if significant change

      sendControlChange(18 + i, sliderValue, midiChannel); // Use CC 18-21 for sliders

      lastSliderValue[i] = sliderValue;

    }

  }


 

  delay(10); // Small delay to prevent overload

}

------------

To HERE (inside the -----)
 

 

NOW HAVE FUN

Tags