Hi all, I've managed to hook up my old casio lk-90 with code by Moura's Keyboard Scanner (GitHub - oxesoft/keyboardscanner: Turn your broken (or unused) keyboard into a MIDI controller (with pedal and veloticy)) and an arduino mega and it partially works perfectly. My challenge is that, that series of casio keyboards has 2 ribbon cables, both are 16 wire ribbons (matrix 8x8) and I've figured out the inputs and outputs, but the code only works with the 1st ribbon and the 2nd doesn't get detected nor read/scanned. I'm certain both cables work and I get expected readings from a multi-meter but I just can't get the 2nd ribbon to work which means certain notes aren't being scanned. What changes can I make to the code to read the 2nd ribbon or do I need to change my entire approach?
do I need to change my entire approach
I think you want to concentrate on what the schematic of the second ribbon cable connector. Only then can you think of designing an interface for it, and the code to drive it.
I got my hands on the schematic for both ribbons (attached: casio_lk-90 schm.pdf - Google Drive). I connected it to the arduino according to this schematic but still can’t figure out how to get the second cable to work with the sketch.
casio_lk-90 schm.pdf (393 KB)
Good that is a start but I will have to wait until I am on my laptop before I can get a proper look at that.
So now can you post how you have wired up the ribbon cable that is working and what code you are running on it and also how you are attempting to wire up the second connector and what code you are running for that.
The working cable is set up that the first 8 wires are for input(into arduino) and the last 8 are for output(from arduino). The second cable: the first 6 cables are input, the next 2 are output, followed by 2 that's input and last 6 being output. The code I'm using is Daniel Moura's Keyboard Scanner (GitHub - oxesoft/keyboardscanner: Turn your broken (or unused) keyboard into a MIDI controller (with pedal and veloticy)). I tweaked it a bit to cater for my specific inputs and outputs.
I tweaked it a bit to cater for my specific inputs and outputs.
But you are not going to show it because?
When I said:-
So now can you post how you have wired up the ribbon cable
I was expecting a schematic with pin numbers and such.
Excuse me, I misunderstood your ask. I’ve attached the both the code and an edited version of the schematic with the arduino pin numbers specified. I’ve also included the scan matrix if that could help.
Cyanide_Kontrol_v1.ino (9.05 KB)
casio_lk-90 scan matrix.pdf (15.4 KB)
Thanks for downloading that, there is quite a bit to take in.
I think the problem here is your software, it is handling only one matrix where as it needs to handle two. It is treating the keyboard like a 16 by 16 matrix which potentially means 256 keys. As each key has two switches, I assume you know why but ask if you don't, then if those connectors were treated as two separate 8 X 8 matrices you would only have 128 keys which is much closer to the 122 keys you need to detect.
Having to scan more keys than you need is going to half the speed you can read them and increase the latency, so that is not a good option.
You said it worked with one ribbon connector connected. Have you tried modifying the code so it just uses the other? If it worked just like the other one that would check out your hardware and you would be able to point your finger definitively at the code. Please try this first.
Rather than just adding more pins to a single matrix I think the code should treat the keyboard as two separate matrices.
I tried connecting the other cable and it worked. So then I tried combining the the 16 column wires to make it 8, that resulted in me getting more notes working but still not all of them. So I'm thinking of exploring the 2 matrices suggestion you made but that I'm not sure how I'd achieve because I didn't write the sketch myself.
I tried connecting the other cable and it worked.
Go back to the original sketch and duplicate the functions using different names ( like adding a 1 on the end of names) and different pin numbers. Then first test on one connection and then the other. If that works try them both.