Hi!
I am trying to turn an electric piano (jWIN MK-6140) to a MIDI piano using the Arduino Nano.
I already modified an old electric piano (Casio PT-100) to a MIDI piano using the Arduino Nano but I had to reverse all the diodes on the keys circuit.
I am trying to modify this new electric piano without removing the diodes and reversing them.
There are 61 keys on the jWIN piano and the keys circuit has 2x8 solder joints.
I concluded with the help of a multi-meter that the keys are an 8x8 key matrix.
I have removed the wires from the original controller and connected them to some headers so it would be easier connecting them to a breadboard.
I connected the 8 column wires to wires D5-D12 and the 8 row wires to A0-A7.
I tried using this code:
const byte ROWS = 8; //eight rows
const byte COLS = 8; //eight columns
char keys[COLS][ROWS] = {
{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'},
{'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P'},
{'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X'},
{'Y', 'Z', '0', '1', '2', '3', '4', '5'},
{'6', '7', '8', '9', 'a', 'b', 'c', 'd'},
{'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'},
{'m', 'n', 'o', 'p', 'q', 'r', 's', 't'},
{'u', 'v', 'w', 'x', 'y', 'z', '!', '@'}
};
byte rowPins[ROWS] = {A0, A1, A2, A3, A4, A5, A6, A7};
byte colPins[COLS] = {5, 6, 7, 8, 9, 10, 11, 12};
void setup() {
Serial.begin(9600);
pinMode(rowPins, INPUT_PULLUP);
pinMode(colPins, OUTPUT);
digitalWrite(colPins, HIGH);
}
void loop() {
for (int i = 0; i < COLS; i++) {
digitalWrite(colPins[i], LOW);
delay(10);
for (int y = 0; y < ROWS; y++) {
if (digitalRead(rowPins[y]) == LOW) {
Serial.println(keys[y][i]);
}
}
digitalWrite(colPins[i], HIGH);
}
}
but the serial monitor was just filling with random letters from the keys array.
Also, I tried changing the rowPins with colPins to see if I reversed the pins but the output is still the same.
I tried using the keypad library code:
/* @file CustomKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates changing the keypad size and key values.
|| #
*/
#include <Keypad.h>
const byte ROWS = 8; //eight rows
const byte COLS = 8; //eight columns
char hexaKeys[COLS][ROWS] = {
{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'},
{'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P'},
{'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X'},
{'Y', 'Z', '0', '1', '2', '3', '4', '5'},
{'6', '7', '8', '9', 'a', 'b', 'c', 'd'},
{'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'},
{'m', 'n', 'o', 'p', 'q', 'r', 's', 't'},
{'u', 'v', 'w', 'x', 'y', 'z', '!', '@'}
};
byte colPins[ROWS] = {5, 6, 7, 8, 9, 10, 11, 12}; //connect to the row pinouts of the keypad
byte rowPins[COLS] = {A0, A1, A2, A3, A4, A5, A6, A7}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600);
}
void loop() {
char customKey = customKeypad.getKey();
if (customKey) {
Serial.println(customKey);
}
}
The serial monitor first shows lowercase 'm'
but I got no output when pressing any key.
I tried reversing the connections but this time I got nothing on startup and nothing when pressing any key.
I am very frustrated with this I have been trying to fix this for 4 days with no luck.
Do I have to reverse all diodes with this? Or is it another problem?
I have tried this with two different Arduino Nanos and even tried using external pull-up/down resistors but no improvement.
Sorry if this was long but I tried giving you as much details as possible.
Any help is appreciated. Thanks.
PS: The keys circuit says MT MK-2085 if that helps somehow.

