Go Down

Topic: Salvage old 61 key keyboard with 2 ribbon cables for key matrix (Read 2690 times) previous topic - next topic

Cyanide01

Hi all, I've managed to hook up my old casio lk-90 with code by Moura's Keyboard Scanner (https://github.com/oxesoft/keyboardscanner) 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?

Grumpy_Mike

Quote
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.

Cyanide01

Thanks Mike,

I got my hands on the schematic for both ribbons (attached: https://drive.google.com/file/d/1cixszdxTorFLsVuvp9nqI2GMKk2A_mcT/view?usp=sharing). 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.

Grumpy_Mike

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.

Cyanide01

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 (https://github.com/oxesoft/keyboardscanner). I tweaked it a bit to cater for my specific inputs and outputs.

Grumpy_Mike

Quote
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:-
Quote
So now can you post how you have wired up the ribbon cable
I was expecting a schematic with pin numbers and such.

Cyanide01

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.

Grumpy_Mike

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.   

Cyanide01

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.

Grumpy_Mike

Quote
I tried connecting the other cable and it worked.
Great.

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.

Go Up