8x8 or larger square bank of mechanical switches

Status
Not open for further replies.

techzen

Member
Can I do this with a teensy++ 2.0 and if so how?

I've honestly been searching for a guide for days and all I can find is modified "regular" keyboard layouts.

I just want a big square key bank, without any key staggering. Just a ton of buttons, why can't I find a how-to on this?
 
Normally you'd connect the switches in a row-column manner and use the Keypad library.

http://www.pjrc.com/teensy/td_libs_Keypad.html

If the switches can't be connected like that for some reason, there are other ways. But it's hard to give useful advice for such a project without knowing more about what type of switch wiring and other constraints you have.
 
This will be my first project so the only thing I'm concerned with is the type of keys themselves, I want to use cherry mx red keys and I want to try and do it with the teensy.

From the limited amount I've learned in I dunno two days, I think the teensy would need an I/O extender or something, to support 64 keys. I honestly have no idea for sure though. I'd like to not have any restraints on how many keys I can hit at once and it be recognized though.

I would be interested in any 8x8 or larger keypad tutorial or information. I've just been looking for a guide or something I could follow to the letter and replicate it, as I don't have the expertise to make something from scratch, but I can follow directions well enough.

I've found about a million ways to modify typical keyboard layouts, but for some reason I can't find anything about larger symmetrical key layouts, which has surprised me. I just want a big square layout of keys.
 
The Teensy 2.0 has 25 I/O pins according to the website (I haven't started my project yet). You could run a 12x12 matrix for a total of 144 keys, or 12x13 blah blah blah. Your 8x8 project will be well within capability. I plan on using the 2.0 to support about 120 button/switch circuits and LED's, and an I/O Expander to run a separate set of output LED's, all for a sim racing cockpit. Someone with more experience in these matters could correct me if I'm wrong on any of that.

There are a ton of guides to building what it seems like you're talking about, just not exactly how you want it. You likely won't find a guide to do exactly what you want unless you write it yourself. There is a tutorial on Arduino for the code and setup of a typical 4x3 keypad. If you're planning on using simple momentary switches such as what I'll be using, you simply wire them up in the same manner as the keys on the pad and you're good to go. Each row of switches is wired in series for one contact of each switch, and each column is wired in series for the other.

-Travis
 
Thanks for the info. Do you know if diodes are necessary? I'm not sure if they are completely necessary but I do want to be able to input at least simple shift+ and control+ hotkeys in a flight sim or something like that. I'm guessing as long as it's not 5+ keys it should be fine but I don't want to assume too much knowing as little as I do about this so far.
 
Perhaps it's not obvious how to use the Keypad library for a bunch of buttons? Maybe the documentation gives the impression it would only work with already-made keypads?

Maybe I need to put a schematic or Fritzing-style wiring diagram on that Keypad page?
 
I'm sure it's probably obvious to somebody who is not a novice. But since I have only started learning about this out of recent "necessity" I'm not exactly sure how much I can wire in matrix at a time and how many connections on the teensy I would have to make and all that.

I'm not saying this would be the best idea, but for me I tend to have a better time scaling something down from whatever is the max to less, rather than scaling up. Because, being new I don't necessarily know why I can't have 30x12 keys etc.
 
Another novice here. It's great to do your research up front and avoid some mistakes. It's also great to try a few cheap experiments to prove a concept and develop your intuition. By figuring out your mistakes on simple projects, you learn troubleshooting skills that will help you with more complex ones.

A quick search turned up small momentary contact push button switches for $0.15 at quantity 10. You could make cheap prototypes to develop a circuit that works for you. Once you're convinced, then create a prototype with one (expensive) cherry switch. With both experiments under your belt, your full 8x8 array would be the next step, not such a big leap.

Here's an example of someone who created a fully custom keyboard using switches like the ones you mentioned: http://hackaday.com/2012/02/15/building-a-keyboard-from-scratch/
 
Another novice here. It's great to do your research up front and avoid some mistakes. It's also great to try a few cheap experiments to prove a concept and develop your intuition. By figuring out your mistakes on simple projects, you learn troubleshooting skills that will help you with more complex ones.

A quick search turned up small momentary contact push button switches for $0.15 at quantity 10. You could make cheap prototypes to develop a circuit that works for you. Once you're convinced, then create a prototype with one (expensive) cherry switch. With both experiments under your belt, your full 8x8 array would be the next step, not such a big leap.

Here's an example of someone who created a fully custom keyboard using switches like the ones you mentioned: http://hackaday.com/2012/02/15/building-a-keyboard-from-scratch/

Thanks for the link. I'll definitely be taking your advice to build a really cheap prototype first. Being new means I naturally have a lot of what-if questions. I guess with a bunch of cheap parts I can just try it for myself.
 
Thanks for the info. Do you know if diodes are necessary?
If the diodes were not necessary, you can be sure that they would not be included on commercial devices.
Yes, they are needed so that the row and column information is always unambiguous even if multiple keys are pressed.
 
Perhaps it's not obvious how to use the Keypad library for a bunch of buttons? Maybe the documentation gives the impression it would only work with already-made keypads?
Yes, it gives that impression.

I would suggest first introducing the row-column matrix method (and explaining about the diodes). This is necessary because most people will assume that n switches requires n pins. Then, state that you can either build your own matrix or use a ready-built one.

Its probably also worth mentioning that the electrical row/column connections and the physical layout are distinct. An example where these are very different would be a music keyboard, where the switches are all in one line. A five octave, 61 note keyboard is actually wired as an 8x8 grid.
 
Last edited:
Status
Not open for further replies.
Back
Top