mac70
Published © CC BY-NC-SA

DAW Button Box for Roland E-Drum Racks

A button box which can be mounted directly onto Roland Drum Racks for easy remote control of your DAW.

IntermediateFull instructions provided6 hours413
DAW Button Box for Roland E-Drum Racks

Things used in this project

Hardware components

Arduino MicroPro
×1
push buttons (normally open)
×1
3d printed clamp and box
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

link to my 3D files

in thingiverse

Code

Arduino Micro Pro Code for Rack Button Box

C/C++
make sure to set the micro pro in your arduino IDE
/* ROLAND RACK BUTTON BOX
  
 Note : This is for the Arduino Pro Micro !

 Emulates a keyboard to press keys a connected PC for a DAW (here : Steinberg Cubase).
 optional : uses emulated UART COM port via USB (for debugging) and LEDs (RX and TX LED) on Micro board

 KEYS : 
 config for Cubase:
 https://steinberg.help/cubase_elements_le_ai/v9/de/cubase_nuendo/topics/key_commands/key_commands_default_c.html

 Assignment : Arduino Micro Port -> Switch on Button Box -> emulated Key on Keyboard -> Function in Cubase
 
 Port Switch  Key       Cubase Function 
 ------------------------------------------
 2	  M       c         Metronome On
 3	  L       [Num] 1   Goto Left Locator
 4	  >>      [Num] +   Forward
 5	  <<      [Num] -   Backward
 6	  P       SPACE     Play/Stop 
 7	  B       b         Begin
 8	  R       [Num] *   Record
 
  mac70
  13.01.2021
*/

#define DEBUG_OUTPUT 0  // when defined as 1, an additional serial monitor output will be generated for debugging

#include <Keyboard.h>

// NUM-KEY codes :  https://forum.arduino.cc/index.php?topic=659117.0
#define KEYPAD_1 225 
#define KEYPAD_PLUS 223 
#define KEYPAD_MINUS 222 
#define KEYPAD_ASTERIX 221 
/*
// in case needed ... other key codes like Shift, Control etc : https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardmodifiers/
char ShiftKey = KEY_LEFT_SHIFT;
char LeftKey = KEY_LEFT_ARROW;
char RightKey = KEY_RIGHT_ARROW;
*/

int RXLED = 17;  // The RX LED has a defined Arduino pin


void setup()
{
   // buttons are connected to the following digital input pins 
   // (button normally open, when activated -> pin will be connected to GND)
  pinMode(2, INPUT_PULLUP);  // Pin 2 is input with internal resistor
  pinMode(3, INPUT_PULLUP);  // Pin 3 is input with internal resistor
  pinMode(4, INPUT_PULLUP);  // Pin 4 is input with internal resistor
  pinMode(5, INPUT_PULLUP);  // Pin 5 is input with internal resistor
  pinMode(6, INPUT_PULLUP);  // Pin 6 is input with internal resistor
  pinMode(7, INPUT_PULLUP);  // Pin 7 is input with internal resistor
  pinMode(8, INPUT_PULLUP);  // Pin 8 is input with internal resistor
  
  pinMode(RXLED, OUTPUT);  // Set RX LED as an output

  digitalWrite(RXLED, HIGH);    // set the RX LED OFF
  Keyboard.begin();  // start keyboard emulation
  
  Serial.begin(9600); //This starts the serial monitor
  Serial.println("");
if (DEBUG_OUTPUT == 1) Serial.println("Button Box Serial Monitor");
  
}

void loop()
{

  Keyboard.releaseAll();
  digitalWrite(RXLED, HIGH);    // set the RX LED OFF
  delay(50);                    // short delay

  // Process buttons
  
  if (digitalRead(2) == 0) // M  
  {
    if (DEBUG_OUTPUT == 1) Serial.println("Button M");  // Print to the Serial Monitor 
    digitalWrite(RXLED, LOW);   // LED on to signal activity
    Keyboard.press('c');
    delay(5);
    Keyboard.releaseAll();
    while(digitalRead(2) == 0); // wait for button to be released
  }
  
  if (digitalRead(3) == 0) // L  
  {
    if (DEBUG_OUTPUT == 1) Serial.println("Button L");  // Print to the Serial Monitor
    digitalWrite(RXLED, LOW);   // LED on to signal activity
    Keyboard.press(KEYPAD_1);
    delay(5);
    Keyboard.releaseAll();
    while(digitalRead(3) == 0); // wait for button to be released
  }
  
  if (digitalRead(4) == 0) // >>  
  {
    if (DEBUG_OUTPUT == 1) Serial.println("Button >>");  // Print to the Serial Monitor
    digitalWrite(RXLED, LOW);   // LED on to signal activity
    Keyboard.press(KEYPAD_PLUS);
    while(digitalRead(4) == 0); // wait for button to be released ... repeat function from PC will re-trigger this key !
    Keyboard.releaseAll();
  }
  
  if (digitalRead(5) == 0) // <<  
  {
    if (DEBUG_OUTPUT == 1) Serial.println("Button <<");  // Print to the Serial Monitor
    digitalWrite(RXLED, LOW);   // LED on to signal activity
    Keyboard.press(KEYPAD_MINUS);
    while(digitalRead(5) == 0); // wait for button to be released ... repeat function from PC will re-trigger this key !
    Keyboard.releaseAll();
  }
  
  if (digitalRead(6) == 0) // PLAY STOP  
  {
    if (DEBUG_OUTPUT == 1) Serial.println("Button PLAY/STOP");  // Print to the Serial Monitor
    digitalWrite(RXLED, LOW);   // LED on to signal activity
    Keyboard.press(' ');
    delay(5);
    Keyboard.releaseAll();
    while(digitalRead(6) == 0); // wait for button to be released
  }
  
  if (digitalRead(7) == 0) // BACK TO START  
  {
    if (DEBUG_OUTPUT == 1) Serial.println("Button BACK");  // Print to the Serial Monitor
    digitalWrite(RXLED, LOW);   // LED on to signal activity
    Keyboard.press('b');
    delay(5);
    Keyboard.releaseAll();
    while(digitalRead(7) == 0); // wait for button to be released
  }
  
  if (digitalRead(8) == 0) // REC  
  {
    if (DEBUG_OUTPUT == 1) Serial.println("Button REC");  // Print to the Serial Monitor
    digitalWrite(RXLED, LOW);   // LED on to signal activity
    Keyboard.press(KEYPAD_ASTERIX);
    delay(5);
    Keyboard.releaseAll();
    while(digitalRead(8) == 0); // wait for button to be released
  }

  
}

Credits

mac70
6 projects • 38 followers
Contact

Comments

Please log in or sign up to comment.