Connecting arduino midi keyboard to Axoloti


#1

Hello there,

I was wondering if someone could help me with this:
I am trying to connect a salvaged midi keyboard to axoloti over PA3 input with Hugo's extra midi I/O script. I thought I'd just use an arduino uno that I had laying around and used a script I found online. I managed to get the keyboard responding on the arduino (I see the TX light flickering and get integers as outputs on the serial monitor) but when I connect it to axoloti, I don't seem to get any response..
This is how I connected everything :


And this is the code I used for the arduino :
// Pin Definitions
// Rows are connected to
const int row1 = 5;
const int row2 = 6;
const int row3 = 7;
const int row4 = 8;

// The 74HC595 uses a serial communication
// link which has three pins
const int clock = 9;
const int latch = 10;
const int data = 11;

uint8_t keyToMidiMap[32];

boolean keyPressed[32];

int noteVelocity = 127;

// use prepared bit vectors instead of shifting bit left everytime
int bits[] = { B00000001, B00000010, B00000100, B00001000, B00010000, B00100000, B01000000, B10000000 };

// 74HC595 shift to next column
void scanColumn(int value) {
digitalWrite(latch, LOW); //Pulls the chips latch low
shiftOut(data, clock, MSBFIRST, value); //Shifts out the 8 bits to the shift register
digitalWrite(latch, HIGH); //Pulls the latch high displaying the data
}

void setup() {

// Map scan matrix buttons/keys to actual Midi note number. Lowest num 44 corresponds to C MIDI note.
keyToMidiMap[0] = 44;
keyToMidiMap[1] = 45;
keyToMidiMap[2] = 46;
keyToMidiMap[3] = 47;
keyToMidiMap[4] = 48;
keyToMidiMap[5] = 49;
keyToMidiMap[6] = 50;
keyToMidiMap[7] = 51;

keyToMidiMap[8] = 52;
keyToMidiMap[1 + 8] = 53;
keyToMidiMap[2 + 8] = 54;
keyToMidiMap[3 + 8] = 55;
keyToMidiMap[4 + 8] = 56;
keyToMidiMap[5 + 8] = 57;
keyToMidiMap[6 + 8] = 58;
keyToMidiMap[7 + 8] = 59;

keyToMidiMap[16] = 60;
keyToMidiMap[1 + 16] = 61;
keyToMidiMap[2 + 16] = 62;
keyToMidiMap[3 + 16] = 63;
keyToMidiMap[4 + 16] = 64;
keyToMidiMap[5 + 16] = 65;
keyToMidiMap[6 + 16] = 66;
keyToMidiMap[7 + 16] = 67;

keyToMidiMap[24] = 68;
keyToMidiMap[1 + 24] = 69;
keyToMidiMap[2 + 24] = 70;
keyToMidiMap[3 + 24] = 71;
keyToMidiMap[4 + 24] = 72;
keyToMidiMap[5 + 24] = 73;
keyToMidiMap[6 + 24] = 74;
keyToMidiMap[7 + 24] = 75;

// setup pins output/input mode
pinMode(data, OUTPUT);
pinMode(clock, OUTPUT);
pinMode(latch, OUTPUT);

pinMode(row1, INPUT);
pinMode(row2, INPUT);
pinMode(row3, INPUT);
pinMode(row4, INPUT);

Serial.begin(31250);

delay(1000);

}

void loop() {

for (int col = 0; col < 8; col++) {

// shift scan matrix to following column
scanColumn(bits[col]);

// check if any keys were pressed - rows will have HIGH output in this case corresponding
int groupValue1 = digitalRead(row1);
int groupValue2 = digitalRead(row2);
int groupValue3 = digitalRead(row3);
int groupValue4 = digitalRead(row4);

// process if any combination of keys pressed
if (groupValue1 != 0 || groupValue2 != 0 || groupValue3 != 0
    || groupValue4 != 0) {

  if (groupValue1 != 0 && !keyPressed[col]) {
    keyPressed[col] = true;
    noteOn(0x91, keyToMidiMap[col], noteVelocity);
  }

  if (groupValue2 != 0 && !keyPressed[col + 8]) {
    keyPressed[col + 8] = true;
    noteOn(0x91, keyToMidiMap[col + 8], noteVelocity);
  }

  if (groupValue3 != 0 && !keyPressed[col + 16]) {
    keyPressed[col + 16] = true;
    noteOn(0x91, keyToMidiMap[col + 16], noteVelocity);
  }

  if (groupValue4 != 0 && !keyPressed[col + 24]) {
    keyPressed[col + 24] = true;
    noteOn(0x91, keyToMidiMap[col + 24], noteVelocity);
  }

}

//  process if any combination of keys released
if (groupValue1 == 0 && keyPressed[col]) {
  keyPressed[col] = false;
  noteOn(0x91, keyToMidiMap[col], 0);
}

if (groupValue2 == 0 && keyPressed[col + 8]) {
  keyPressed[col + 8] = false;
  noteOn(0x91, keyToMidiMap[col + 8], 0);
}

if (groupValue3 == 0 && keyPressed[col + 16]) {
  keyPressed[col + 16] = false;
  noteOn(0x91, keyToMidiMap[col + 16], 0);
}

if (groupValue4 == 0 && keyPressed[col + 24]) {
  keyPressed[col + 24] = false;
  noteOn(0x91, keyToMidiMap[col + 24], 0);
}

}

}

void noteOn(int cmd, int pitch, int velocity) {
Serial.write(cmd);
Serial.write(pitch);
Serial.write(velocity);
}

Am I overseeing something? Should I change something in Hugo's script?

Thanks!!


#2

Hello,

How did you connect the power to the Arduino and the Axoloti?
Do they share a common ground? (run from the same powersupply)
In your schematic I see only 1 wire going from the Arduino to the Axoloti.

Hope this helps.
I built a Arduino Midi-controller and connected it with succes to an Axolotiand can show you my schematic and/or code.

Greetings,

Willem


#3

Hey Willem,

Thank you for responding to this!
I connected both the axoloti and the arduino to my computer for power.
In the future I would like to power te arduino from the axoloti.
Would be great to see how you did it!

Thibaut