Consistently sending MIDI data using Pro Micro + Surface Control

I have a custom midi controller that uses a pro micro + surface control library ( @PieterP ) to send data from 5 potentiometers and 26 tactile buttons.

After I upload the sketch I’m able to to detect midi signal with midi monitor or my DAW (Reaper) on OSX.

Sometimes when I power up pro micro, connect it to laptop I can’t detect the midi data being sent.

Is there an order of operations required to consistently get pro micro to successfully send data? Do I need to reset midi devices via my DAW?
Manually reset pro micro? (but power cycling it should already do that?)

Right now the quick fix seems to be reflashing the pro micro with my midi sketch, which isn’t practical in the long run.

After more debugging I've determined the bug is not MIDI related.

The same custom midi controller can also. trigger sounds via DFPlayer Mini MP3 player and exhibits the same issue.

My order of operations:

  1. Supply external 5V power to pro micro and custom midi controller
  2. Plug in micro usb cable to pro micro
  3. Upload sketch to pro micro
  4. Hardware behaves as it is supposed to. I can click any button which triggers sound on mp3 module. If I disconnect micro usb cable from pro micro the circuit still works.
  5. Disconnect external power supply and disconnect micro usb cable from pro mini.
  6. Connect external power supply only to circuit.
  7. Pro mini fails to trigger sound. I can see on board LED on pro micro is on. If I connect micro usb cable at this point to pro micro it still fails.

Any ideas? Does the pro micro need a hard reset somehow to run? I tried connecting a jumper from the RST pin to GND (bc the pro micro doesn't have a reset button) but that didn't appear to fix issue.

The only way I can get circuit to work as programmed is to upload sketch each time with micro cable attached.

Please post your code.

Do you have a while(!Serial) in there by any chance?
There's also the possibility of faulty hardware, of course (either the Arduino or the power source).

I had a "Serial.begin(9600);" in my setup function but I've since commented it out and the application sketch fails to function still if just supplied with external power. It application sketch only works after upload. Using a jumper to connect RST and GND doesn't seem to do anything.

Here's my full sketch. It's a pro micro with 26 buttons and 5 pots. All it does right now is detect button presses and play sounds via the sound module.

#include <Control_Surface.h> // Include the Control Surface library
#include <AH/Hardware/ExtendedInputOutput/AnalogMultiplex.hpp>

// Uncomment this line to debug the values the remote is sending across the wire.
//#define debug



//CCPotentiometer volumePotentiometers[] {
//  { A0, { MIDI_CC::Channel_Volume, CHANNEL_1 } },
//  { A1, { MIDI_CC::Channel_Volume, CHANNEL_2 } },
//  { A2, { MIDI_CC::Channel_Volume, CHANNEL_3 } },
//  { A3, { MIDI_CC::Channel_Volume, CHANNEL_4 } },
//  { A10, { MIDI_CC::Channel_Volume, CHANNEL_5 } },
//};

// Instantiate a multiplexer
CD74HC4067 mux_1{4, {6, 7, 8, 9} , }; //input, S0-S3, optional enable
CD74HC4067 mux_2{14, {6, 7, 8, 9} , }; //input, S0-S3, optional enable

//CCButton A1_But1 {mux_1.pin(0), {MIDI_CC::General_Purpose_Controller_1, CHANNEL_1},};
//CCButton A1_But2 {mux_1.pin(1), {MIDI_CC::General_Purpose_Controller_2, CHANNEL_1},};
//CCButton A1_But3 {mux_1.pin(2), {MIDI_CC::General_Purpose_Controller_3, CHANNEL_1},};
//CCButton A1_But4 {mux_1.pin(3), {MIDI_CC::General_Purpose_Controller_4, CHANNEL_1},};
//CCButton A1_But5 {mux_1.pin(4), {MIDI_CC::General_Purpose_Controller_5, CHANNEL_1},};
//CCButton A1_But6 {mux_1.pin(5), {MIDI_CC::General_Purpose_Controller_6, CHANNEL_1},};
//CCButton A1_But7 {mux_1.pin(6), {MIDI_CC::General_Purpose_Controller_7, CHANNEL_1},};
//CCButton A1_But8 {mux_1.pin(7), {MIDI_CC::General_Purpose_Controller_8, CHANNEL_1},};


//CCButton A2_But1 {mux_1.pin(8), {MIDI_CC::General_Purpose_Controller_1, CHANNEL_2},};
//CCButton A2_But2 {mux_1.pin(9), {MIDI_CC::General_Purpose_Controller_2, CHANNEL_2},};
//CCButton A2_But3 {mux_1.pin(10), {MIDI_CC::General_Purpose_Controller_3, CHANNEL_2},};
//CCButton A2_But4 {mux_1.pin(11), {MIDI_CC::General_Purpose_Controller_4, CHANNEL_2},};
//CCButton A2_But5 {mux_1.pin(12), {MIDI_CC::General_Purpose_Controller_5, CHANNEL_2},};
//CCButton A2_But6 {mux_1.pin(13), {MIDI_CC::General_Purpose_Controller_6, CHANNEL_2},};
//CCButton A2_But7 {mux_1.pin(14), {MIDI_CC::General_Purpose_Controller_7, CHANNEL_2},};
//CCButton A2_But8 {mux_1.pin(15), {MIDI_CC::General_Purpose_Controller_8, CHANNEL_2},};

//CCButton B1_But1 {mux_2.pin(0), {MIDI_CC::General_Purpose_Controller_1, CHANNEL_3},};
//CCButton B1_But2 {mux_2.pin(1), {MIDI_CC::General_Purpose_Controller_2, CHANNEL_3},};

//CCButton B2_But1 {mux_2.pin(2), {MIDI_CC::General_Purpose_Controller_1, CHANNEL_4},};
//CCButton B2_But2 {mux_2.pin(3), {MIDI_CC::General_Purpose_Controller_2, CHANNEL_4},};
//CCButton B2_But3 {mux_2.pin(4), {MIDI_CC::General_Purpose_Controller_3, CHANNEL_4},};
//CCButton B2_But4 {mux_2.pin(5), {MIDI_CC::General_Purpose_Controller_4, CHANNEL_4},};
//CCButton B2_But5 {mux_2.pin(6), {MIDI_CC::General_Purpose_Controller_5, CHANNEL_4},};
//CCButton B2_But6 {mux_2.pin(7), {MIDI_CC::General_Purpose_Controller_6, CHANNEL_4},};


#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(16, 5); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
int playSoundIndex = 1;

//A1
#define A1_But1PIN 0
#define A1_But2PIN 1
#define A1_But3PIN 2
#define A1_But4PIN 3
#define A1_But5PIN 4
#define A1_But6PIN 5
#define A1_But7PIN 6
#define A1_But8PIN 7

//A2
#define A2_But1PIN 8
#define A2_But2PIN 9
#define A2_But3PIN 10
#define A2_But4PIN 11
#define A2_But5PIN 12
#define A2_But6PIN 13
#define A2_But7PIN 14
#define A2_But8PIN 15

//B1
#define B1_But1PIN 0
#define B1_But2PIN 1

#define B1_Pot1PIN A0
#define B1_Pot2PIN A1
#define B1_Pot3PIN A2
#define B1_Pot4PIN A3
#define B1_Pot5PIN A10

//B2
#define B2_But1PIN 2
#define B2_But2PIN 3
#define B2_But3PIN 4
#define B2_But4PIN 5
#define B2_But5PIN 6
#define B2_But6PIN 7

struct SEND_DATA_STRUCTURE
{
    uint8_t A1_But1 = 0;
    uint8_t A1_But2 = 0;
    uint8_t A1_But3 = 0;
    uint8_t A1_But4 = 0;
    uint8_t A1_But5 = 0;
    uint8_t A1_But6 = 0;
    uint8_t A1_But7 = 0;
    uint8_t A1_But8 = 0;

    uint8_t A2_But1 = 0;
    uint8_t A2_But2 = 0;
    uint8_t A2_But3 = 0;
    uint8_t A2_But4 = 0;
    uint8_t A2_But5 = 0;
    uint8_t A2_But6 = 0;
    uint8_t A2_But7 = 0;
    uint8_t A2_But8 = 0;
  
    int B1_Pot1 = 512;
    int B1_Pot2 = 512;
    int B1_Pot3 = 512;
    int B1_Pot4 = 512;
    int B1_Pot5 = 512;
    
    uint8_t B1_But1 = 0;
    uint8_t B1_But2 = 0;

    uint8_t B2_But1 = 0;
    uint8_t B2_But2 = 0;
    uint8_t B2_But3 = 0;
    uint8_t B2_But4 = 0;
    uint8_t B2_But5 = 0;
    uint8_t B2_But6 = 0;
    

} sendToSerial;


int lastA1_But1State = HIGH;  // the previous state from the input pin
int lastA1_But2State = HIGH;  // the previous state from the input pin
int lastA1_But3State = HIGH;  // the previous state from the input pin
int lastA1_But4State = HIGH;  // the previous state from the input pin
int lastA1_But5State = HIGH;  // the previous state from the input pin
int lastA1_But6State = HIGH;  // the previous state from the input pin
int lastA1_But7State = HIGH;  // the previous state from the input pin
int lastA1_But8State = HIGH;  // the previous state from the input pin

int lastA2_But1State = HIGH;  // the previous state from the input pin
int lastA2_But2State = HIGH;  // the previous state from the input pin
int lastA2_But3State = HIGH;  // the previous state from the input pin
int lastA2_But4State = HIGH;  // the previous state from the input pin
int lastA2_But5State = HIGH;  // the previous state from the input pin
int lastA2_But6State = HIGH;  // the previous state from the input pin
int lastA2_But7State = HIGH;  // the previous state from the input pin
int lastA2_But8State = HIGH;  // the previous state from the input pin

int lastB1_But1State = HIGH;  // the previous state from the input pin
int lastB1_But2State = HIGH;  // the previous state from the input pin

int lastB2_But1State = HIGH;  // the previous state from the input pin
int lastB2_But2State = HIGH;  // the previous state from the input pin
int lastB2_But3State = HIGH;  // the previous state from the input pin
int lastB2_But4State = HIGH;  // the previous state from the input pin
int lastB2_But5State = HIGH;  // the previous state from the input pin
int lastB2_But6State = HIGH;  // the previous state from the input pin

void setup() {
  // put your setup code here, to run once:
  mySoftwareSerial.begin(9600);
  //Serial.begin(9600);

  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
  
  if (!myDFPlayer.begin(mySoftwareSerial)) {  //Use softwareSerial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while(true){
      delay(0); // Code to compatible with ESP8266 watch dog.
    }
  }
  Serial.println(F("DFPlayer Mini online."));
  
  myDFPlayer.volume(30);  //Set volume value. From 0 to 30
  //myDFPlayer.play(1);  //Play the first mp3

  mux_1.begin();
  mux_2.begin();

  for(int i=0; i<=16; i++)
  {
    mux_1.pinMode(i, INPUT_PULLUP);
    mux_2.pinMode(i, INPUT_PULLUP);
  }

}

void loop() {
  // put your main code here, to run repeatedly:
  
  sendToSerial.A1_But1 = mux_1.digitalRead(A1_But1PIN);
  sendToSerial.A1_But2 = mux_1.digitalRead(A1_But2PIN);
  sendToSerial.A1_But3 = mux_1.digitalRead(A1_But3PIN);
  sendToSerial.A1_But4 = mux_1.digitalRead(A1_But4PIN);
  sendToSerial.A1_But5 = mux_1.digitalRead(A1_But5PIN);
  sendToSerial.A1_But6 = mux_1.digitalRead(A1_But6PIN);
  sendToSerial.A1_But7 = mux_1.digitalRead(A1_But7PIN);
  sendToSerial.A1_But8 = mux_1.digitalRead(A1_But8PIN);

  sendToSerial.A2_But1 = mux_1.digitalRead(A2_But1PIN);
  sendToSerial.A2_But2 = mux_1.digitalRead(A2_But2PIN);
  sendToSerial.A2_But3 = mux_1.digitalRead(A2_But3PIN);
  sendToSerial.A2_But4 = mux_1.digitalRead(A2_But4PIN);
  sendToSerial.A2_But5 = mux_1.digitalRead(A2_But5PIN);
  sendToSerial.A2_But6 = mux_1.digitalRead(A2_But6PIN);
  sendToSerial.A2_But7 = mux_1.digitalRead(A2_But7PIN);
  sendToSerial.A2_But8 = mux_1.digitalRead(A2_But8PIN);

  sendToSerial.B1_But1 = mux_2.digitalRead(B1_But1PIN);
  sendToSerial.B1_But2 = mux_2.digitalRead(B1_But2PIN);
  sendToSerial.B1_Pot1 = analogRead(B1_Pot1PIN); 
  sendToSerial.B1_Pot2 = analogRead(B1_Pot2PIN); 
  sendToSerial.B1_Pot3 = analogRead(B1_Pot3PIN); 
  sendToSerial.B1_Pot4 = analogRead(B1_Pot4PIN); 
  sendToSerial.B1_Pot5 = analogRead(B1_Pot5PIN); 

  sendToSerial.B2_But1 = mux_2.digitalRead(B2_But1PIN);
  sendToSerial.B2_But2 = mux_2.digitalRead(B2_But2PIN);
  sendToSerial.B2_But3 = mux_2.digitalRead(B2_But3PIN);
  sendToSerial.B2_But4 = mux_2.digitalRead(B2_But4PIN);
  sendToSerial.B2_But5 = mux_2.digitalRead(B2_But5PIN);
  sendToSerial.B2_But6 = mux_2.digitalRead(B2_But6PIN);

  //A1

  if(lastA1_But1State == HIGH && sendToSerial.A1_But1 == LOW){
  Serial.println("A1_But1 The button is pressed");
  playNextSound();
  }
  else if(lastA1_But1State == LOW && sendToSerial.A1_But1 == HIGH)
  Serial.println("A1_But1 The button is released");

  // save the the last state
  lastA1_But1State = sendToSerial.A1_But1;

  if(lastA1_But2State == HIGH && sendToSerial.A1_But2 == LOW){
  Serial.println("A1_But2 The button is pressed");
  playNextSound();
  }
  else if(lastA1_But2State == LOW && sendToSerial.A1_But2 == HIGH)
  Serial.println("A1_But2  The button is released");

  // save the the last state
  lastA1_But2State = sendToSerial.A1_But2;

  if(lastA1_But3State == HIGH && sendToSerial.A1_But3 == LOW) {
  Serial.println("A1_But3 The button is pressed");
  playNextSound();
  }
  else if(lastA1_But3State == LOW && sendToSerial.A1_But3 == HIGH)
  Serial.println("A1_But3 The button is released");

  // save the the last state
  lastA1_But3State = sendToSerial.A1_But3;

  if(lastA1_But4State == HIGH && sendToSerial.A1_But4 == LOW) {
  Serial.println("A1_But4 The button is pressed");
  playNextSound();
  }
  else if(lastA1_But4State == LOW && sendToSerial.A1_But4 == HIGH)
  Serial.println("A1_But4 The button is released");

  // save the the last state
  lastA1_But4State = sendToSerial.A1_But4;

  if(lastA1_But5State == HIGH && sendToSerial.A1_But5 == LOW) {
  Serial.println("A1_But5 The button is pressed");
  playNextSound();
  }
  else if(lastA1_But5State == LOW && sendToSerial.A1_But5 == HIGH)
  Serial.println("A1_But5 The button is released");

  // save the the last state
  lastA1_But5State = sendToSerial.A1_But5;

  if(lastA1_But6State == HIGH && sendToSerial.A1_But6 == LOW) {
  Serial.println("A1_But6 The button is pressed");
  playNextSound();
  }
  else if(lastA1_But6State == LOW && sendToSerial.A1_But6 == HIGH)
  Serial.println("A1_But6 The button is released");

  // save the the last state
  lastA1_But6State = sendToSerial.A1_But6;

  if(lastA1_But7State == HIGH && sendToSerial.A1_But7 == LOW) {
  Serial.println("A1_But7 The button is pressed");
  playNextSound();
  }
  else if(lastA1_But7State == LOW && sendToSerial.A1_But7 == HIGH)
  Serial.println("A1_But7 The button is released");

  // save the the last state
  lastA1_But7State = sendToSerial.A1_But7;
  
  if(lastA1_But8State == HIGH && sendToSerial.A1_But8 == LOW) {
  Serial.println("A1_But8  The button is pressed");
  playNextSound();
  }
  else if(lastA1_But8State == LOW && sendToSerial.A1_But8 == HIGH)
  Serial.println("A1_But8 The button is released");

  // save the the last state
  lastA1_But8State = sendToSerial.A1_But8;

  //A2

  if(lastA2_But1State == HIGH && sendToSerial.A2_But1 == LOW){
  Serial.println("A2_But1 The button is pressed");
  playNextSound();
  }
  else if(lastA2_But1State == LOW && sendToSerial.A2_But1 == HIGH)
  Serial.println("A2_But1 The button is released");

  // save the the last state
  lastA1_But2State = sendToSerial.A2_But1;

  if(lastA2_But2State == HIGH && sendToSerial.A2_But2 == LOW){
  Serial.println("A2_But2 The button is pressed");
  playNextSound();
  }
  else if(lastA2_But2State == LOW && sendToSerial.A2_But2 == HIGH)
  Serial.println("A2_But2 The button is released");

  // save the the last state
  lastA2_But2State = sendToSerial.A2_But2;

  if(lastA2_But3State == HIGH && sendToSerial.A2_But3 == LOW) {
  Serial.println("A2_But3 The button is pressed");
  playNextSound();
  }
  else if(lastA2_But3State == LOW && sendToSerial.A2_But3 == HIGH)
  Serial.println("A2_But3 The button is released");

  // save the the last state
  lastA2_But3State = sendToSerial.A2_But3;

  if(lastA2_But4State == HIGH && sendToSerial.A2_But4 == LOW) {
  Serial.println("A2_But4 The button is pressed");
  playNextSound();
  }
  else if(lastA2_But4State == LOW && sendToSerial.A2_But4 == HIGH)
  Serial.println("A2_But4 The button is released");

  // save the the last state
  lastA2_But4State = sendToSerial.A2_But4;

  if(lastA2_But5State == HIGH && sendToSerial.A2_But5 == LOW) {
  Serial.println("A2_But4 The button is pressed");
  playNextSound();
  }
  else if(lastA2_But5State == LOW && sendToSerial.A2_But5 == HIGH)
  Serial.println("A2_But4 The button is released");

  // save the the last state
  lastA2_But5State = sendToSerial.A2_But5;

  if(lastA2_But6State == HIGH && sendToSerial.A2_But6 == LOW) {
  Serial.println("A2_But6 The button is pressed");
  playNextSound();
  }
  else if(lastA2_But6State == LOW && sendToSerial.A2_But6 == HIGH)
  Serial.println("A2_But6 The button is released");

  // save the the last state
  lastA2_But6State = sendToSerial.A2_But6;

  if(lastA2_But7State == HIGH && sendToSerial.A2_But7 == LOW) {
  Serial.println("A2_But7 The button is pressed");
  playNextSound();
  }
  else if(lastA2_But7State == LOW && sendToSerial.A2_But7 == HIGH)
  Serial.println("A2_But7 The button is released");

  // save the the last state
  lastA2_But7State = sendToSerial.A2_But7;
  
  if(lastA2_But8State == HIGH && sendToSerial.A2_But8 == LOW) {
  Serial.println("A2_But8 The button is pressed");
  playNextSound();
  }
  else if(lastA2_But8State == LOW && sendToSerial.A2_But8 == HIGH)
  Serial.println("A2_But8 The button is released");

  // save the the last state
  lastA2_But8State = sendToSerial.A2_But8;

  //B1

  if(lastB1_But1State == HIGH && sendToSerial.B1_But1 == LOW){
  Serial.println("B1_But1 The button is pressed");
  playNextSound();
  }
  else if(lastB1_But1State == LOW && sendToSerial.B1_But1 == HIGH)
  Serial.println("B1_But1 The button is released");

  // save the the last state
  lastB1_But1State = sendToSerial.B1_But1;

  if(lastB1_But2State == HIGH && sendToSerial.B1_But2 == LOW){
  Serial.println("B1_But2 The button is pressed");
  playNextSound();
  }
  else if(lastB1_But2State == LOW && sendToSerial.B1_But2 == HIGH)
  Serial.println("B1_But2 The button is released");

  // save the the last state
  lastB1_But2State = sendToSerial.B1_But2;

  //B2

  if(lastB2_But1State == HIGH && sendToSerial.B2_But1 == LOW){
  Serial.println("B2_But1 The button is pressed");
  playNextSound();
  }
  else if(lastB2_But1State == LOW && sendToSerial.B2_But1 == HIGH)
  Serial.println("B2_But1 The button is released");

  // save the the last state
  lastB2_But1State = sendToSerial.B2_But1;

  if(lastB2_But2State == HIGH && sendToSerial.B2_But2 == LOW){
  Serial.println("B2_But2 The button is pressed");
  playNextSound();
  }
  else if(lastB2_But2State == LOW && sendToSerial.B2_But2 == HIGH)
  Serial.println("B2_But2 The button is released");

  // save the the last state
  lastB2_But2State = sendToSerial.B2_But2;

  if(lastB2_But3State == HIGH && sendToSerial.B2_But3 == LOW) {
  Serial.println("B2_But3 The button is pressed");
  playNextSound();
  }
  else if(lastB2_But3State == LOW && sendToSerial.B2_But3 == HIGH)
  Serial.println("B2_But3 The button is released");

  // save the the last state
  lastB2_But3State = sendToSerial.B2_But3;

  if(lastB2_But4State == HIGH && sendToSerial.B2_But4 == LOW) {
  Serial.println("B2_But4 The button is pressed");
  playNextSound();
  }
  else if(lastB2_But4State == LOW && sendToSerial.B2_But4 == HIGH)
  Serial.println("B2_But4 The button is released");

  // save the the last state
  lastB2_But4State = sendToSerial.B2_But4;

  if(lastB2_But5State == HIGH && sendToSerial.B2_But5 == LOW) {
  Serial.println("B2_But5 The button is pressed");
  playNextSound();
  }
  else if(lastB2_But5State == LOW && sendToSerial.B2_But5 == HIGH)
  Serial.println("B2_But5 The button is released");

  // save the the last state
  lastB2_But5State = sendToSerial.B2_But5;

  if(lastB2_But6State == HIGH && sendToSerial.B2_But6 == LOW) {
  Serial.println("B2_But6 The button is pressed");
  playNextSound();
  }
  else if(lastB2_But6State == LOW && sendToSerial.B2_But6 == HIGH)
  Serial.println("B2_But6 The button is released");

  // save the the last state
  lastB2_But6State = sendToSerial.B2_But6;

  #ifdef debug
     debugRoutine(); 
  #endif

}


void playNextSound()
{
    if(playSoundIndex==131){
      playSoundIndex=1;
    } else{
      playSoundIndex++;
    }

    myDFPlayer.playMp3Folder(playSoundIndex);
}

void debugRoutine()
{
    Serial.print(sendToSerial.A1_But1); Serial.print(", ");
    Serial.print(sendToSerial.A1_But2); Serial.print(", ");
    Serial.print(sendToSerial.A1_But3); Serial.print(", ");
    Serial.print(sendToSerial.A1_But4); Serial.print(", ");
    Serial.print(sendToSerial.A1_But5); Serial.print(", ");
    Serial.print(sendToSerial.A1_But6); Serial.print(", ");
    Serial.print(sendToSerial.A1_But7); Serial.print(", ");
    Serial.print(sendToSerial.A1_But8); Serial.print(", ");
    Serial.println();
    Serial.print(sendToSerial.A2_But1); Serial.print(", ");
    Serial.print(sendToSerial.A2_But2); Serial.print(", ");
    Serial.print(sendToSerial.A2_But3); Serial.print(", ");
    Serial.print(sendToSerial.A2_But4); Serial.print(", ");
    Serial.print(sendToSerial.A2_But5); Serial.print(", ");
    Serial.print(sendToSerial.A2_But6); Serial.print(", ");
    Serial.print(sendToSerial.A2_But7); Serial.print(", ");
    Serial.print(sendToSerial.A2_But8); Serial.print(", ");
    Serial.println();
    Serial.print(sendToSerial.B1_Pot1); Serial.print(", ");
    Serial.print(sendToSerial.B1_Pot2); Serial.print(", ");
    Serial.print(sendToSerial.B1_Pot3); Serial.print(", ");
    Serial.print(sendToSerial.B1_Pot4); Serial.print(", ");
    Serial.print(sendToSerial.B1_Pot5); Serial.print(", ");
    Serial.print(sendToSerial.B1_But1); Serial.print(", ");
    Serial.print(sendToSerial.B1_But2); Serial.print(", ");
    Serial.println();
    Serial.print(sendToSerial.B2_But1); Serial.print(", ");
    Serial.print(sendToSerial.B2_But2); Serial.print(", ");
    Serial.print(sendToSerial.B2_But3); Serial.print(", ");
    Serial.print(sendToSerial.B2_But4); Serial.print(", ");
    Serial.print(sendToSerial.B2_But5); Serial.print(", ");
    Serial.print(sendToSerial.B2_But6);
    Serial.println();
}

Here's another pro micro user having a similar issue as me after restart/powerup:

https://forum.arduino.cc/t/pro-micro-not-working-after-reset-powerup/970883/6

But unfortunately no solution.

I just found this via spark fun….

So maybe I need to use a button instead of a jumper because you have to short it twice within 8 seconds to initiate restart.

I this what most people have to do when using a pro micro in their custom midi controllers? Seems inconvenient to have to hard reset the pro micro each time, just for the sake of having a midi class compliant device.

I have an update! I used a tactile button to short rst pin and ground. After some testing I found just a single press was enough to reset pro micro and run my application sketch properly. There's about a 5 second delay for pro micro to reset/reboot bootloader and my application sketch. I tried using jumper cable for rst pin and it also worked when I waited long enough.

So my question now is there a way to auto restart pro micro board on power cycle? Because having to press a button each time is not ideal.

I have a custom midi controller that uses a pro micro + surface control library ( @PieterP ) to send data from 5 potentiometers and 26 tactile buttons.

I currently can connect it to my laptop via USB and read MIDI data successfully. I want to now connect the midi controller to a vocoder effects pedal that accepts MIDI input through a 5-pin DIN connector.

My current code is:

USBMIDI_Interface midi;

Which I will change to this to used the 5-pin DIN connector:

// Select the serial port to use.
auto &serial = Serial;
// Instantiate a Serial MIDI interface at the default MIDI baud rate.
SerialMIDI_Interface<decltype(serial)> midi {serial, MIDI_BAUD};

My wiring I found this example on Youtube using an UNO, and will rework it for my pro micro.

midi

I'm going to connect Pin 2 from the MIDI jack to GND. Pin 4 to 5V through a 220 OHM resistor. Pin 5 to TX on the pro micro through a 220 OHM resistor.

Do these changes to my code and circuit make sense, in over to move from USBMIDI to a sending data over a 5-pin MIDI jack?

You'll have to use Serial1, not Serial, see Serial - Arduino Reference.

@PieterP Thanks for the correction. The pro mico uses 0(RX), 1(TX) for Serial1 pins.

My current code to send midi data to computer via USB:

USBMIDI_Interface midi;

Which I will change to this to use the 5-pin DIN connector on effects pedal:

HardwareSerialMIDI_Interface midi {Serial1, MIDI_BAUD};

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.