Teensy 3.6 for scanning Fatar Keyboard - Latency/multiplexers/resistors

Status
Not open for further replies.
Hello together,

I have a short 61-key-version of the Fatar TP9/40GH keybed (very nice piano keys) and want to build a custom-fitted lower Manual of my Clavia Nord Stage 2 SW73 from wood. I only need MIDI note information on channel 1 and send it to the Nord, without any additional buttons or switches. I thought of a dedicated MIDI controller (e.g. Doepfer MKE) but either they are function-overloaded or not suited to my very keyboard. So: perfect for a Teensy Project.
What I need is to wire and scan my keyboard, obviously. Done this is the past with mediocre success. Hence, I have some basic questions. PS: I would like to encourage others to do something like this as this is really creating something, and keeps you mentally young ;-)

1. Need of a (de-)multiplexer?

I have a Teensy with 62 digital pins. More than needed for my 2 x 20pole MicroMatch cables coming from the keyboard. I know that you have colums to activate and then rows to read.
Now I would keep things simple & easy and wire the keyboard cables directly to the Teensy. I understood that it is recommended to use (de-)multiplexers for the advantage of saving pins and channeling the flow (by increasing complexity obviously). I do not have this restriction, plenty of pins available that I won't use anyway. And I'd need to wire the channels to the multiplexer eventually anyways. Is there any other advantage of using a (de-)multiplexer, like speed, accuracy etc? I cannot think of any better & faster solution that direct connection with nothing in between. But I am not an electrotechnic expert.

2. Need of resistors?

As per my understanding, the Fatar keyboard has already diodes and restistors for the switches soldered into its base. See the picture below my post.

I wonder if - taking this into consideration - I need additional resistors for my board. If yes, is it safe to use the pullup resistors of the Teensy, or do i need to manually and physically add resistors to my board. Again, try to make it simple & easy.

3. Latecy of pin activation- avoid "ghost readings"

My last question is about the latency of pin activation vs. reading speed. I know it is not good to have a "slow" board, as you activate the columns in a loop and read the pressed keys and therefore detect the pressed note. So you may have latecy issues, espacially when calculating the time between the two contacts of each key (in order to determine key velocity). I believe this is not an issue with Teensy 3.6. On the other hand, I heard that the opposite is also bad: if you scan through the columns&rows too quickly, you may have a ghost reading as it takes some milliseconds (?) for the pin to send out the current and when reading the pressed key immediately after that, this might be too quick to detect a pressed key before the next column is activated.
Is there any recommendation to handle that? Maybe activate a pin and then wait some milliseconds? Is there any experience which value is recommendable? (if you wait too long, you loose the advantage of a fast board and run into the abovementioned latencies).

I hope I could express my questions clearly. Also please forgive me if some of these questions have been touched in the past. It is really difficult to find clear answers when each question is slighty different or maybe under a different context, so it becomes a puzzle of details I have not been able to solve so far.

Image (7).jpeg
 
1. I don't understand why or what the demultiplexer is, so I can't really comment.

2. The diodes act as a mechanism to prevent ghost or extra keys from appearing when you select multiple keys at the same time. I am not sure what the resistors would do (pull-ups?). Do you have a schematic?

3. As for multiplexing keys I have a little more experience, at least with push buttons. I would not think that you could sample too fast, but you would need to debounce the keys. Switches are notoriously noisy when you make or break contact, so the trick is to scan the keys quickly and keep at least one or more copies of the previous scan to compare with the current scan.

The theory is, when there is a state change in a switch (say from high to low) you need to record that new value, then on the next scan compare it to the previous. If they match, then the state change is considered a valid key press. If not, then it's noise and you start all over again.

As for timing, I would think you need to scan at a very high rate to account for debounce times and do the switch closure velocity measurement. So milliseconds may be slow in your world. There may be more information on the web on design guidelines or someone here may have actual experience.

This link might help... https://www.allaboutcircuits.com/technical-articles/switch-bounce-how-to-deal-with-it/

Good luck!
 
Status
Not open for further replies.
Back
Top