Advice for building a fully custom keyboard

User avatar
insomniac_lemon

21 Feb 2015, 00:16

Hello,

After using a chiclet-style dome keyboard (which, having never used a mech keyboard, I don't mind. essentially it is an unbranded version of this) with a 2-3key rollover (CR:3 on Rajagra scale @geekhack) that came with my computer for so long, I started wanting a new one. I realized that most have a double super (windows) key and no menu key (mine has 1 super key and a menu key). I also realized that my keyboard is quite big, with tons of keys I don't use.

I found a site to design my own keymap, but soon discovered that custom computer keyboards aren't really sold, not even fully custom MX keycaps, so really you're on your own for a custom keyboard. Luckily I found this community, and it seemingly being active with custom makers.

For anyone interested, my layout is a 50%(?), ultra-compact tenkeyless that includes a dedicated number row and arrow keys, but other key reductions (no redundancy) that are added as functions:
Image


As for why I'm posting, I need advice. The biggest is that I don't want to use a standard keyboard matrix that you all use, but rather 'arms' of keys set up in a resistor ladder to use resistance to allow the teensy to figure out which keys are pressed. 14 sets of 4. I *think* this is the proper way to wire each arm:
Image

I'd just have to figure out firmware for it. I'd imagine the code would be a bit different from a matrix, because rather than scanning each column, it could constantly send an output to each arm, and then when a key is pressed, it would send a voltage to the input, and then the exact voltage could be used to find the key (or key combo)

I also need suggestions on what sort of switch I should use for smaller keys (Cherry ML?), and if there is anywhere I can buy the teensy boards in bulk to save money. I plan on buying the cherry mx switches from Mouser(I didn't see Teensy boards there, and if I buy them in 50 I'll save, and I'll save even more if I buy 1000 (enough for about 18 keyboards). Or, maybe there is an alternate board I can purchase from Mouser (or some other company that offers bulk discount) that is comparatively functional to the Teensy 3.1 (along with 14+ analog inputs)?

Also, wondering what you think of my design? I might sell these on Etsy if all goes well.
Last edited by insomniac_lemon on 21 Feb 2015, 09:08, edited 4 times in total.

User avatar
Mal-2

21 Feb 2015, 02:17

insomniac_lemon wrote: For anyone interested, my layout is a 50%(?), ultra-compact tenkeyless that includes a dedicated number row and arrow keys, but other key reductions (no redundancy) that are added as functions:
If you're willing to go to these lengths, you should at least consider making it a straight matrix rather than staggered. This means you could re-purpose some existing switch plates and save a fair bit of either custom ordering or custom construction.

User avatar
insomniac_lemon

21 Feb 2015, 08:58

Mal-2 wrote: If you're willing to go to these lengths, you should at least consider making it a straight matrix rather than staggered. This means you could re-purpose some existing switch plates and save a fair bit of either custom ordering or custom construction.
What do you mean by "switch plate"? The keycaps themselves? If so, I plan to 3D print those, at least as soon as I get my dual-extruder (Cyclops) set up. A new keyboard isn't really a big deal (I'm in no rush for it, just think it'd be cool), but I also wouldn't mind a project.

Seems like just as work and/or compromises, IMO. For some reason non-staggered just feels odd to me (sorta like improperly laid bricks that are structurally weak) plus I doubt modifying the firmware would be any easier, plus I'd have to replace the keys anyways (or modify the sides of some of them, at least). Smaller keys wouldn't be an option at all, so It's have to be bigger as a result.

I think I've got the the circuitry figured out (I updated the OP), and I do have this to start on how to read voltage with it. Maybe now I just need to get a teensy and mess around with it and try to cobble together some firmware.

Plus, thought somebody here might've done something similar with the wiring.

User avatar
matt3o
-[°_°]-

21 Feb 2015, 09:48

that is exactly how the new cherry switch is configured to work. The result is a "zero-delay" keyboard, very interesting but you need a custom firmware and I wouldn't know how to help you with that.

please keep us posted if you intend to proceed that way, but honestly the standard matrix is super easy to implement and you can find plenty of ready to use firmwares for that.

User avatar
Mal-2

21 Feb 2015, 11:03

insomniac_lemon wrote: What do you mean by "switch plate"? The keycaps themselves? If so, I plan to 3D print those, at least as soon as I get my dual-extruder (Cyclops) set up. A new keyboard isn't really a big deal (I'm in no rush for it, just think it'd be cool), but I also wouldn't mind a project.
I mean the metal (or in some cases, plastic or fiberboard) plate with holes cut into it, which the switches are locked into. I guess some people call it a "top plate", I just couldn't think of it at the time. You don't have to fill every hole in such a plate, in fact some holes are set up such that you couldn't fill them all because they're set up to (for example) take a switch at each end, or one in the middle, but not both. But if you're not into matrix layouts for whatever reason, this isn't going to work for you anyhow so don't worry about it.

jerry_c

21 Feb 2015, 21:28

http://ortholinearkeyboards.com/planck-top-plate-grd

There's a picture of a matrix layout switch plate.

User avatar
insomniac_lemon

22 Feb 2015, 01:06

matt3o wrote: that is exactly how the new cherry switch is configured to work. The result is a "zero-delay" keyboard, very interesting but you need a custom firmware and I wouldn't know how to help you with that.

please keep us posted if you intend to proceed that way, but honestly the standard matrix is super easy to implement and you can find plenty of ready to use firmwares for that.
I saw that on their site('real-key' technology), but wasn't sure if they were actually doing analog inputs like me, dedicated digital pins for every key, or some proprietary matrix instead (their animations seem to suggest they're still using a matrix). Has someone reverse engineered it?

I've ordered a Teensy 3.1 so I can actually experiment with it and figure out how the circuit works out with the resistance. I figure the best way to get some firmware flowing is to experiment with it and to see if it works. Any firmware gurus on this site? If so maybe they can help me if I run into issues. If I get something, maybe I'll release it on Github or something and make a thread for it.
Mal-2 wrote: I mean the metal (or in some cases, plastic or fiberboard) plate with holes cut into it, which the switches are locked into. I guess some people call it a "top plate", I just couldn't think of it at the time. You don't have to fill every hole in such a plate, in fact some holes are set up such that you couldn't fill them all because they're set up to (for example) take a switch at each end, or one in the middle, but not both. But if you're not into matrix layouts for whatever reason, this isn't going to work for you anyhow so don't worry about it.
Ah, I see. That shouldn't be too hard for me to print off with my 3D printer. I'll probably do it in 2-3 pieces per-layer in a brick like fashion and screw it together, similar to a laser-cutter case. Should be easier if I get it onto a PCB.

User avatar
insomniac_lemon

14 Mar 2015, 22:12

Just an update on this, I haven't been able to do any testing on this because my connections on my breadboard are really poor (because jumper cables) it was hard to get a stable voltage.

I've done some research and am thinking of using daisy-chained (8bit, parallel-in/serial-out) shift registers (through I^2C?).

Anybody have thoughts on this? I was thinking it would be more expandable this way, and I wouldn't have to worry about voltage changes.

User avatar
vvp

16 Mar 2015, 15:35

OK, so looks like you have given up on the analog approach to scan keys. I think it is an interesting way to do it but also a way which is hard to do right.

As for as chained shift registers. I already saw some thread where they wanted to do it that way. Either here or on geekhack. Essentially a 1xN keyboard matrix scanned with parallel-in shift registers. But I cannot find the reference now. You can use SPI interface for it nicely.

I use both parallel-in and parallel-out shift registers in Katy keyboard. It works fine.

An overview of common input matrix scanning methods is here: http://www.openmusiclabs.com/learning/d ... -scanning/

User avatar
chzel

16 Mar 2015, 16:19

If you have given up on analog reading, why bother with shift registers? Unless you have a really good reason to use them, go for a traditional matrix instead.
matt3o wrote: that is exactly how the new cherry switch is configured to work. The result is a "zero-delay" keyboard, very interesting but you need a custom firmware and I wouldn't know how to help you with that.
How is it "zero-delay"?
You still have to debounce the switches, and you still need to scan a "matrix" of inputs to the ADC and convert each one of them, which might be a lot slower than scanning a matrix.
I am trying to find out what I am missing here.

User avatar
vvp

16 Mar 2015, 18:59

chzel wrote: If you have given up on analog reading, why bother with shift registers? Unless you have a really good reason to use them, go for a traditional matrix instead.
Good point. Teensy 3.1 has plenty of IO ports. And the keyboard is in one piece, so no need to save wires between the halves.

User avatar
insomniac_lemon

16 Mar 2015, 22:30

vvp wrote: OK, so looks like you have given up on the analog approach to scan keys. I think it is an interesting way to do it but also a way which is hard to do right.

As for as chained shift registers. I already saw some thread where they wanted to do it that way. Either here or on geekhack. Essentially a 1xN keyboard matrix scanned with parallel-in shift registers. But I cannot find the reference now. You can use SPI interface for it nicely.

I use both parallel-in and parallel-out shift registers in Katy keyboard. It works fine.

An overview of common input matrix scanning methods is here: http://www.openmusiclabs.com/learning/d ... -scanning/
I haven't given up on analog reading. As I said, as soon as I can get better connections I will test it. I was pondering using shift registers because I wasn't sure how "solid" of a concept analog will be with voltage, how simple I can make the firmware, and how expandable it will be(I would like to be able to attach an external keypad). As I've said, shift registers look like they're a really solid solution where it'd be easy to ready any sort of key press combination without ambiguity.

chzel wrote: If you have given up on analog reading, why bother with shift registers? Unless you have a really good reason to use them, go for a traditional matrix instead.
matt3o wrote: that is exactly how the new cherry switch is configured to work. The result is a "zero-delay" keyboard, very interesting but you need a custom firmware and I wouldn't know how to help you with that.
How is it "zero-delay"?
You still have to debounce the switches, and you still need to scan a "matrix" of inputs to the ADC and convert each one of them, which might be a lot slower than scanning a matrix.
I am trying to find out what I am missing here.
My simplest reason for not going with a matrix is because I don't want to. I think it's a flawed concept that people still use because it's easiest.... I don't want to have to worry about 2KRO or alternate wiring on certain keys to remove ghosting/blocking to make it look like I have a higher KRO.

I think when matt3o said "0 delay" he means that the outputs don't need to be switched in order to scan. You'd just have your outputs always-on and then when you press the switch (not necessarily because it could roll through or scan all at once), your microcontroller reads it. As for it being faster/slower all I can say is that the new Cherry mech keyboard boasts a much lower delay with full NKRO, but I have no idea if they're using analog/dedicated digital inputs, shift registers, etc. but it's most likley NOT a standard matrix.

User avatar
chzel

16 Mar 2015, 22:44

insomniac_lemon wrote: My simplest reason for not going with a matrix is because I don't want to.
Fair enough! I can totally understand that! :mrgreen:
I think it's a flawed concept that people still use because it's easiest...
In my humble amateur opinion the matrix is the most elegant solution, given enough inputs on the controller.
Using shift registers in such a simple keyboard is like a complicated answer looking for a suitable problem.
Sure, if you had a 256-key matrix with a remote mounted input restrained controller it might be the reasonable solution,
but in this case it feels like over-complicating.
How are you planing to use the shift registers?

User avatar
insomniac_lemon

16 Mar 2015, 23:45

chzel wrote: How are you planing to use the shift registers?
Well, I was thinking I was going to go with 7 PISO shift registers, each with (up to) 8 inputs daisy chained together. Like the image attached (the less saturated blocks are the shift registers and use the keys they touch as inputs, the brighter blue are the daisy wires, teensy would likely go at the top-right). I might go with SPI as someone else suggested.

I wish I could connect it to multiple pins (so there are multiple smaller daisy chains). If I could go with 2-4 serial connections if I could. It might be a bit more complicated, but I've also thought about using multiple serial connections (like SPI AND I^2C) to do just that. Can I have 2 I^2C connections? Regular serial and CAN bus maybe (would these just be asynchronous)?

Also, I might even use analog in addition to all that, I don't know yet. You're right, it's over-complicated, but probably so is making a keyboard on its own, going out and buying a keyboard I don't like is the simple solution ;)
Attachments
keyboard_54_8input.png
keyboard_54_8input.png (30.89 KiB) Viewed 4062 times

Post Reply

Return to “Workshop”