PDA

View Full Version : Keyboard anti-ghosting comparison



Konrad
08-15-2010, 12:36 AM
I'm taking another serious look at anti-ghosting keyboards these days, especially the gaming keyboards which tend to feature superior anti-ghosting.

"Anti-ghosting" itself is a bit of a misnomer, more of a marketing gimmick than a useful metric. I use it here in the context of "maximum simultaneous keystrokes", even though it technically refers to a capability that's been built into even the cheapest keyboards for almost two decades.

First and foremost: I won't even consider a keyboard without wires. No wireless. No exceptions. Why not? Simply because even the best and most sophisticated infrared, radio, or bluetooth technologies suffer from problems, problems that are easily avoided with a wire. It's not like I trip on it a lot anyways.

Second: I know way too much about keyboards. I really do. I'm proud to be a geekhacker (http://geekhack.org/). I happen to be a superior typist, I prefer blank keycaps, I'm particular about keyswitches and tactile response. I've owned, typed on, played on, broken, fixed, modded, and simply taken apart more keyboard models than I can remember. I'm even seriously thinking about programming my own overpowered keyboard controller, with multiple scan sets, superior debouncing algorithms, parallel "anti-ghosting" key circuits, large n-key rollover buffers, advanced macros, all the bells and whistles I want - all the sorts of things that just aren't realistic or cost-effective in mortal keyboards.

I'm interested in the capabilities of all the mainstream gaming keyboards.
Logitech G15, G19, G110, G510. Razer Lycosa, Arctosa, Marauder. SteelSeries 7G, 6Gv2, Zboard, Merc, Merc Stealth. Saitek Cyborg. Gigabyte GK-K8000 Ghost. OCZ Alchemy. Even the lowly Microsoft SideWinder X4, X5, X6.

And the non-mainstream keyboards.
Made by names you know like Zalman and OCZ. Made by names you've probably never heard of like Deck, Das, and Cherry. Anything from Model M to the Optimus Maximus project. Hell, even the Optimus Minimus (http://imgur.com/8kdc0.png) if you got one (joke).

And yes, I already know that the G15 and G19 are hugely popular, excellent products - but they're not the only good keyboards out there. But I'm not going to automatically rush out and buy one just because lots of people swear by it. How many of them have really looked beyond the fancy LCD and actually compared the product against the competition?

Back to anti-ghosting.
I've recently been a bit disappointed with my new Merc Stealth. It doesn't live up to the SteelSeries advertised spec of "anti-ghosting up to 7 simultaneous keystrokes". Testing it (with Notepad and some decent free keyboard testing software (http://www.passmark.com/products/keytest.htm)), I found the following:
- Gamepad ("Gaming Terrain") – all 6 main cluster [QWEASD], any 4 adjacent on [123456] row, any 4 within [CVFRBGTP] group
- Qwerty block – any 4 in [1234QWERASDFZXCV] and [7890UIOPJKL;M,./] home-columns
- Function keys – any 4 adjacent near center [F4 to F8] area, typically 2-3 otherwise
- Numpad – any combination of 3 numbers (except [369] vertical)
- [Spacebar] and [Shift, Ctrl, Alt] mod keys – usually always scan in combination with other keys
- all other combinations generally scan only 1-2 simultaneous keys
- no combinations (other than the gamepad [QWEASD] cluster ever scans more than 4-5 simultaneous keys
(testing of Windows GUI keys and some F-keys a bit difficult, since they try to launch Windows services)

Why is this disappointing? Here's the results of testing three different cheap generic USB qwerty-104 keyboards:
- Qwerty block - same as above
- Function keys - any 4 in any combination
- Numpad - any combination of 3 numbers
- [Spacebar] and [Shift, Ctrl, Alt] mod keys - as above
- all other combinations generally scan 1-3 simultaneous keys

And here's the results of testing two different cheap generic PS/2 keyboards:
- any combination of 3-6 keys anywhere on the keyboard
- keyboard also has a buffer that stores 16 characters

Can anybody post similar test results on other keyboards here?

diluzio91
08-15-2010, 12:41 AM
I dont know about the ghosting and stuff like that, but ive had a lot of luck with this guy,
http://www.ocztechnology.com/products/ocz_peripherals/ocz_alchemy_series_elixir_keyboard

And it has never once failed to register a key stroke within a game. Not to mention that the macro keys are functional, and the rubber coating on the KB makes it easy to type on, and it has a good solid clicky feel. Now if you want me to test it give me the tests and ill gladly run them for you.

Konrad
08-15-2010, 01:02 AM
Are you interested in running keyboard testing software? Just simultaneously press keys and post your results.

Obviously you can't test every conceivable combination. (For example, up to 5 simultaneous keys pressed out of 104 would be = 104*103*102*101*100 = over 11 billion combinations, ~350 years at a rate of 1 test per second.)

But it only takes a few minutes to get a sense of how the keys are (logically) grouped, especially if you're a proper typist. Test keys that are adjacent, distant, etc. Test combinations that you'd likely use while playing games (example, while simultaneously pressing forward/left/jump/shoot, or whatever).

It's not like the results I post above are absolutely comprehensive. But they do show that a Merc Stealth is roughly equivalent, even a little bit inferior, to a generic USB keyboard as far as "anti-ghosting" really goes. (When the Merc's unique gamepad area isn't considered, just the rest of the keyboard.)

electron_plumber
08-15-2010, 09:46 PM
When I want to see what ghosting/blocking issues a keyboard has, the first thing I do is take it apart and look at the construction. Standard membrane keyboards have terrible ghosting/blocking issues. If you trace out the wires, you can figure out where all the bad combinations are. It's not hard to show that an unsophisticated layout will have on the order of 10,000 3-key combinations that do not work.

The next level of trick is to move the connections around so that the bad sets happen in less noxious places. This is what many companies tout as an "anti-ghosting" feature. The problem is not really solved - it's simply moved.

Moving up, one can get more sophisticated by adding more wires, creating a sparse matrix with fewer ghosts. This takes a lot of extra connections. The G19 does this using something like 3-4x the number of wires.

Next, really expensive keyboards use a large printed circuit board with diodes in series with each key. This is a great, but expensive solution.

The SideWinder X4 uses a new tech based on resistive multitouch. This is instantly recognizable because it adds a printed resistor in series with each key. This is compatible with membrane technology, which is why the X4 is so inexpensive, despite performance essentially equivalent to diode-based systems.

This site does a pretty good job of explaining what causes ghosting:
http://www.microsoft.com/appliedsciences/content/projects/AntiGhostingExplained.aspx

mDust
08-16-2010, 01:42 AM
It's threads like this that make me drink...
The world just got so much more complicated for me.
:D

I'd never given any thought whatsoever about how a keyboard does or does not function. Although I've only ever owned and regularly used a handful, I've never experienced any usage problems with any of them. I could say that some were more comfortable and easier on the wrists than others, but I've never had any complaints. I've used some cheapos too! Even during heavy RTS gaming, I've never had a keyboard fail to function during multiple key-presses. I can't think of any other scenarios that would require such heavy keying unless you usually type at ungodly speeds.:think:

Are these concerns based off issues you experience or issues you could potentially experience? Like a gearhead worrying about how his car would handle at 200+mph... Or an overclocker worrying about stability at 6.0Ghz...

May I ask how both of you (Konrad and electron_plumber) became so knowledgeable on keyboards' inner workings and potential limitations? Do you guys design electronics or just deconstruct them enough? :)

I should be sleeping right now, but I'm going to be up all night wondering about the keyboard performance benchmarks I could be performing and how they would compare to my nemesis and his keyboard...:facepalm:

electron_plumber
08-16-2010, 03:21 AM
I designed the anti-ghosting system in the X4. Anybody who works on gaming keyboards will tell you that we get tons of angry letters from gamers when they discover that some particular key combination doesn't work. So this is not some crazy, theoretical problem - it's very real. I think it is true that most people don't discover these problems. But that doesn't mean that they aren't being impacted by them.

I have a selection of many of the more popular gaming keyboards, and I've had the opportunity to sit down with some gamers as they rigorously tested combinations. People get very angry when they realize that some things they thought worked, simply don't. A common place where people have trouble is when they are moving diagonally while trying to do something else.This typically involves at least 3 simultaneous keys - 2 from ASDW, and one from somewhere else.

To test your keyboard, get your favorite keyboard tester (we have one online at:

http://www.microsoft.com/appliedsciences/content/projects/KeyboardGhostingDemo.aspx

which should be good enough), and press ASDW simultaneously while testing every other key one by one. When you find ones that don't work, try lifting some of the ASDW keys to see what the minimum set is that causes the problem. This isn't an exhaustive test, but it does reveal one of the more common failure modes.

By the way - you don't need a fancy tester. You can run some of these tests with Notepad or virtually any text box if you ignore the repeating characters...

Anyhow, if get a chance, it would be great if you could try a few keyboards. Then you can report back if you think this is a real issue...

Hope this helps!

Konrad
08-16-2010, 07:22 AM
When I want to see what ghosting/blocking issues a keyboard has, the first thing I do is take it apart and look at the construction ... If you trace out the wires, you can figure out where all the bad combinations are.
+1Geek!
I do this as well. The manufacturer's product info sheets can lie. Clever software can lie. Hardware does not lie. Opening it up will reveal overall build quality, logic circuitry, and component part numbers. Difficulty is encountered when the manufacturer codelocks the firmware (pretty standard practice with OTP masks) or takes steps to obscure the part numbers (covering them with stickers or a lump of epoxy or even using chemical/grinding methods to remove them). Microsoft (like all large OEMs) tends to be one of the big offenders in this area, though of course I recognize that's not really your fault. ;)

(Personally, I'm all for "gaming" products welcoming modders. Sure, the warranty is shot after an incompetent monkey cracks the product open. But some products (Deck Legend (http://www.deckkeyboards.com/), for example) actually provide how-to-diy information for aftermarket modding. Seriously, it's not like the guts of a keyboard are classified technology, the physical hardware can't just be "copied" like software, and the firmware is useless without the hardware it runs on, so why not go "open source" and encourage and support modders who want to tinker and customize?)


... Anybody who works on gaming keyboards will tell you that we get tons of angry letters from gamers when they discover that some particular key combination doesn't work. So this is not some crazy, theoretical problem - it's very real.
Yup.
Btw, your Microsoft links were excellent. About the same as the testing software I linked, but doesn't require any installation (or Windows OS) to run the test. And yes, Notepad will work well enough if you're lazy.

The world just got so much more complicated for me.
Hey, suck it up buddy. I just learned that I gotta remove the IHS from my precious CPU with a blowtorch if I'm gonna fit into the serious crowd. ;)

On a more serious note. No matter how much of a beast (http://gizmodo.com/5050527/crays-first-windows+based-supercomputer-puts-a-64+core-datacenter-on-your-desk) your machine might be, your keyboard (and mouse) will be the interface you'll use to tell it what you want to it to do. Everyone's unique, so there's a lot of particulars when it comes to keyboards. Simple fact, though, is that if you are optimally accustomed to the "feel" of your particular keyboard then it'll serve you as an automatic appendage; every little detail you're uncomfortable using will slow you down and divert some of your attention.

The reason I started this thread is that I have yet to find *any* keyboard that can actually deliver on maximum simultaneous keypresses. Maybe it is overkill, and though I type very fast it's not "ungodly speed" (well yes, I do type fast enough to overflow keyboard buffers, but not most models built after the '80s). And then there are those times (very bad times, usually) when I have to frantically slam about 10 keys simultaneously in fps ... and, well, that doesn't always work out so well. Maybe faster, more accurate keyboard response might improve my odds. Backlights and bling and fancy LCD panels just don't matter when they're all laughin' at you.

Do you guys design electronics or just deconstruct them enough?
My answer to both questions would be yes.


---- Boring techbabble below this line ----
Now don't get me wrong here; I'm not trying to be negative, just critical. Obviously I'm just interested in keyboards while you (electron_plumber) actually earn a living designing them for mass market.

... Incidentally, I've discovered that the Merc Stealth is manufactured by Chicony. To me it actually looks like one (of several) Chicony keyboards stuffed into a new shell to accomodate the new gaming features (the gamepad area, backlighting, USB hub and audio ports); all the other keyswitches and keycaps, even the media hotkeys, remain largely unchanged. Hard to learn more since the FCCID isn't marked anywhere inside or out. (Is that legal?)

Standard membrane keyboards have terrible ghosting/blocking issues.
This is typically true with all membrane and rubber-dome designs, but cheap mechanical keyboards can be just as bad. Better keyboard circuitry can be designed regardless of switch type, but most of the better designs have used mechanical keyswitches; the parts tend to be engineered to finer tolerances, the switches tend to last much longer (50-100 million keypresses, as opposed to 5-20 million), and the traditional target market was "professionals" willing to pay a premium for quality "Model M"-inspired keyboards with the classic Cherry response.
Membrane is cheapest of the cheap, and rubber dome is a common compromise that simulates a tactile quality product well enough for most users while also presenting a substantial cost reduction. All of the mainstream gaming keyboards I've seen use rubber domes, probably because most consumers are actually more comfortable with domes than mechanical (having grown up using nothing but cheapish dome keyboards). Scissor-mechanical switches are common on better laptops, mostly because the domes just fail too quickly and render the laptop half-useless. Many other keyswitch technologies exist, but they are either long obsolete or unaffordable sci-fi.

Regardless, each switch type has quirks and problems which define how "clean" a pressed/released key signal will be. Yet the "cleanup" which debounces, filters ghosts, etc, is primarily determined by the capabilities of the embedded controller logic. So I think that clean and well-designed matrix circuitry helps a lot, but ghosts are not strictly switch-dependent and better core logic is the better ghost-processing solution.
... trick is to move the connections around so that the bad sets happen in less noxious places ... The problem is not really solved - it's simply moved ...
Agreed. That's exactly what I see inside my Merc Stealth. Emphasis was placed on the gamepad, so some of the "less used" circuits in the main qwerty/numpad matrices were doubled up. After all, the MCU only has so many I/O lines available for use - a better MCU part or multiple MCU parts would offer more but both approaches increase final cost. Is this a common trick on gaming keyboards, where most of the action is around the WASD cluster?
... one can get more sophisticated by adding more wires, creating a sparse matrix with fewer ghosts ...
I suppose this takes the form of additional matrix circuit layers? Again, it seems to me this only increases complexity and cost while giving ever-diminishing returns because it doesn't really address the bottleneck at the controller I/O lines.

Next, really expensive keyboards use a large printed circuit board with diodes in series with each key. This is a great, but expensive solution ... The SideWinder X4 uses a new tech based on resistive multitouch.

This is instantly recognizable because it adds a printed resistor in series with each key. This is compatible with membrane technology, which is why the X4 is so inexpensive, despite performance essentially equivalent to diode-based systems.
Again, wouldn't just choosing a better MCU part with integrated (and programmable) signal gates at the I/O lines be less expensive than using discrete SMT components? To be honest, I don't really see the point in allocating a diode or resistor to each key unless it's necessary to clean signals that are otherwise impractical to debounce, and I think that would only be a real issue on the cheapest (er, membrane...) keyswitches. As inexpensive as SMT parts are these days, I'd still be willing to bet that a more capable MCU part would cost less. Maybe I'm just biased towards the "elegant engineering" mindset - small code runs faster, simplicity work best, extra parts equals extra failures - not always realistic in competitive markets.

[Edit]
Would a few decoupling caps placed strategically along the edges of the matrices help even out voltage potentials and thus balance out many of the intermittent keybounce signals?

From your context it seems like you're familiar with the insides of a G19. Can you say if this is because you've identified it as the X4's main market competitor?

Konrad
08-16-2010, 08:09 AM
---- more techbabble ----

1)
From what I understand, the default USB keyboard polling rate is 125Hz.
I'm seeing gaming keyboards which advertise 1000Hz polling rates.

The only practical application I can think of for this would be plugging your (1000Hz) gaming mouse into the keyboard's USB hub. Otherwise (assuming you can't type >800wpm) isn't this basically a useless feature? Even a detrimental one, since it consumes bandwidth better used by other USB devices (such as the aforementioned gaming mouse) on the same bus?

2)
Is the USB interface inherently inferior to PS/2 in terms of n-key rollover (ie, what's usually marketed as "anti-ghosting"), simultaneous keypresses, and key buffers?

I'm asking because I haven't (yet) done my research into the dirty details behind programming keyboard controllers for either/both of these two interfaces. Can you recommend any good starting references?

3)
A standard feature appearing on most high-end (or at least high-priced) keyboards is gold-plated USB and audio connectors. I suspect this is just marketing, since consumers (especially those familiar with audio/video) expect gold-plated connectors to provide cleaner signalling. Gold-on-gold connectors are indeed slightly superior.

Most - though not all - 3.5mm headphones, speakers, mics (and PC audio ports to plug them into) do use gold-plated connector jacks. A few use other plated metals; nickle, tin, aluminum, or whatever.

Few (if any) USB devices or USB ports use gold-plated connectors. Yes, you can buy a shiny gold-plated USB hub (http://www.audiocubes.com/popup_image.php?pID=2024), but it too does not use gold-plated connectors (notice the tin-plate USB ports and plug in the pic).

Sending electrical power through connectors made from dissimilar metals promotes a type of galvanic corrosion called "fretting" which covers both metals with dielectric oxides, eventually removes layers of at least one metal, and is generally bad news that degrades signal quality considerably. As it turns out, USB specifications call for tin-on-tin so that's what most (if not all) normal USB plugs and ports are made of. And as it also turns out, tin and gold occupy different extremes in the electronegativity range and are nearly the worst possible combination of metals you could use; promoting rapid and serious fretting, and unlucky for us, the universe chose a potential of about ±3.3-5.8V to be just the right level of electron excitement when "encouraging" "optimum" fretting-reaction equilibrium conditions, yay for USB spec +5V(±0.25V). Much study and megabucks went into figuring all this out; rewriting specifications to require gold connects was the end result.

Worth looking at are the AMP (now Tyco) documents The Tin Commandments (http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBcQFjAA&url=http%3A%2F%2Fwww.tycoelectronics.com%2Fdocumen tation%2Fwhitepapers%2Fpdf%2Fsncomrep.pdf&rct=j&q=tin%20commandments&ei=qilpTNjAOcipnQeniuXBBQ&usg=AFQjCNELHYCa4ibjZr3i_YRWAFnqyo_EuA) and The Golden Rules (http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBIQFjAA&url=http%3A%2F%2Fwww.tycoelectronics.com%2Fdocumen tation%2Fwhitepapers%2Fpdf%2Faurulrep.pdf&rct=j&q=tyco%20golden%20rules&ei=-ylpTPLGIMmenwfTnL3BBQ&usg=AFQjCNETkNpCNv7qVTUG18q2Je5Ssiry2Q) (and countless technical papers like this (http://www.google.com/url?sa=t&source=web&cd=2&ved=0CB0QFjAB&url=http%3A%2F%2Fwww.tycoelectronics.com%2Fdocumen tation%2Fwhitepapers%2Fpdf%2Fp316-90.pdf&rct=j&q=tin%20gold%20connector&ei=jmZpTMuXFYHAsAOcm73ADQ&usg=AFQjCNEgIQOCxeLSsk5skbIwN2QALlWTtA)) - these were the industry "bible" from back in the old days when people made both RAM sticks and RAM sockets with either tin or gold. A pearl of wisdom among computer techs back then was that you plugged tin into tin and gold into gold; any mix of the two was likely to lead to RAM failure within 3-6 months, perhaps a year or maybe even two at most. Application of electrical contact cleaners and lubricants could often - but not always - delay the onset of fretting or recover the RAM stick (or socket) in which fretting corrosion occurred. A lot of bad memories and motherboards were thrown away. Even my beloved Stabilant-22 (http://www.stabilant.com/) didn't always work.

[Edit]
Those dark days are over, as all RAM devices have been gold-plated for years now.

I was a bit surprised when I saw the familiar old tin/gold problem rear it's ugly head back in the early days of removable flash media - CF and SD cards and such - since once again products started off being tinned, then better ones gold, then the inevitable mixing which would cause problems in people's cameras, PDAs, and cellphones. Eventually gold became the only standard, and all the tin devices are surely deceased by now.

Maybe the day will come when everything USB is plated in gold, but it's not here yet, and I don't know of any existing gold-plated USB devices other than the handful of post-2007 gaming keyboards and mice which use them.

Drum Thumper
08-16-2010, 09:24 AM
It's threads like this that make me drink...


I'm gonna take that one step further and say that it's threads like this that make me make my own beer for my consumption.

That said, I'm finding this to be a very interesting read, and I am thinking our newest plumber might work for Microsoft...

Konrad
08-16-2010, 10:18 AM
@electronic_plumber (heehee)

I've just bumped into "Microsoft's Pressure-Sensitive Keyboard" ... Gizmodo linky here (http://gizmodo.com/5331577/microsofts-pressure+sensitive-keyboard-could-change-the-way-you-type)

This pressure-sensitive concept isn't too appealing to me, but watching the videos I noticed that the "anti-ghosting / simultaneous keystrokes" response on demo prototype are amazing. It looks like it registers every single keypress (plus their relative pressures) even when the guy mashes fistfuls of keys or rolls his arm across the board.

Holy crap awesome!
Is this all done through a standard PS/2 or USB interface, or are additional wires and interfaces fed through to the PC?

[Edit]
Are you able to say anything about it? Juicy specs, part numbers, capabilities, whatnot?
I've found tons of reviews and demos of the prototypes, alongside some interesting application ideas. Hard data isn't out there yet, this (http://www.google.com/url?sa=t&source=web&cd=9&ved=0CDsQFjAI&url=http%3A%2F%2Fdownload.microsoft.com%2Fdownload %2F4%2FB%2F4%2F4B49C1C2-4C7A-4CEA-ADB5-EF4E4E7F5F63%2Fuisttn190-dietz.pdf&rct=j&q=microsoft%20pressure%20sensitive%20keyboard&ei=JkppTLz-EYyWsgPF2PjTDQ&usg=AFQjCNEAxcptNn3Z5Gwrlf6iS6eZm4daGw) is really all I could find.

diluzio91
08-16-2010, 12:38 PM
as a follow up to my thoughts about my ocz elixir, it bombed, but i still love the way it feels, so i will forgive it.

electron_plumber
08-16-2010, 01:41 PM
Yes, I do work for MS as a researcher (and yes, that is my paper on the PSK). I'm not a product guy, but hopefully my stuff does eventually make it into product, as happened with the X4. I can't claim to be an expert on all aspects of keyboard design - I'm more of a multitouch guy just applying my craft in that space.

USB vs. PS/2 is a bit of a mixed bag. USB is much faster, but the standard HID spec didn't anticipate pressing large numbers of keys simultaneously. There are workarounds to this problem, but none are ideal. PS/2 will let you press any number, but it's slower and it's simply unavailable on a lot of modern machines.

For the PSK, we emulated a high speed COM port via USB and sent the data with a number of custom protocols. If you want this to play regular keyboard, you need to have something running that reads the COM port, and injects key events. Not particularly optimal...

As for the controllers, you are right that these can be a limiting factor. I tend to think of this as a hierarchy of limitations:

1) What the matrix can detect
2) What the controller can process (i.e. debounce, etc.)
3) What the com protocol will let you send

Most membrane keyboards start having matrix problems at 3 keys. Now, it's not every three keys. It's something on the order of 4% of the 3-key combinations. There are larger sets that can still be detected and sent. Typically, this is where you run into processor or com limitations.

On resistive multitouch based keyboards (the X4, and our "adaptive keyboard" which was in the news last week) and diode based keyboards, the matrix is not a limiting factor.

BTW, before I get the question, the keyboard on the adaptive unit uses resistive multitouch, but the screen is capacitive multitouch...

The resistors on the membrane are screen printed, just like the wires. This is what makes it so inexpensive to build an X4.

As for speed, WPM is an average speed measurement. Peak speeds can be much higher. If multiple keys are pressed within a single scan, they can be reported in the wrong order. This is more of an issue for fast typists than gamers. Again, this is one of those things that people don't tend to notice - they presume they really did type things in the wrong order, and respond by increasing their delay between keys until it works.

Anyhow, it always a pleasure chatting with people who understand the issues!

Konrad
08-16-2010, 03:08 PM
Hmmm. The material I've been absorbing tends to assume a standardized matrix layout, it emphasizes controller functions, particularly timing and debounce issues. USB development is well documented, but might be difficult (for me) only because I can't legally identify my "product" as being made by a registered vendor (I'll probably have to "steal" the identity of some other HID I never use). Documentation about PS/2 protocols seems to be museum stuff now, impossible to find, or written in Chinese.

Your insights, how you choose to prioritize the barriers, are very interesting to me. As a one-shot project I don't suffer any of the mass-market engineering concerns (logistics chain, regulatory hassles, BOM costs, extensive product/compatibility testing, deadlines, reports) that you do, though of course I also don't have any of the advantages either (megabudget, lab and fab facilities, rapid prototyping, in-house PCB, idle engineers, secret archives).

So the way I'm envisioning my "ultimate" keyboard plan now goes -

0) The limits when determining physical form factor, chassis geometry, keyswitch types, keycaps and other cosmetics are ultimately based only on available budget and skill.
1) Matrix limitations are just a matter of tradeoffs, the extreme approach to avoiding limits is simply to wire each key on an independent parallel circuit (with diodes, resistors, caps if really necessary). More work, but worth it.
2) Controller limits shouldn't be a problem if I "overkill" with say, a pair of $8 Parallax Propellers ... each rated at 32 or 40 I/O lines, up to 80MHz (PLL), 8 cores ("cogs"), 32KB RAM, 32KB ROM (can use some ROM to store user-programmed keys/macros and settings when unpowered, keyboard can operate without imposing a software hit on the OS); spare cogs can be used to drive accessories like integrated USB hubs and programmed backlighting effects.
Much better (and easier for me to program!) than the Holtek parts I've been looking at.
(* Yeah, that's right - a pair of 8-core processors running the keyboard, lmao *)
3) Unknown. I need more data to make a decision between USB and PS/2. Additional limits might be imposed if I choose a controller part which uses poorly-written libraries. Using a simulated COM port (or what the hell, even a serial COM port) is an interesting idea. At least I can see that the sort of simultaneous keyscanning I desire is possible with that method.

I'll try not to bug you with (too many) questions - I hate spoonfeeders, but I might be "back" if/when I get seriously dead-ended. ;)

I might need help when trying to design some kind of "anti-tamper" logic which can detect or defeat in-line hardware keyloggers (just a random idea). I'm not paranoid, actually, but it's an interesting project and might even prove useful. Or maybe not.

[Edit]

Thanks, btw!
And I happen to have been following the adaptive keyboard trail, as well. Is that you on the video? (If so, then I've seen you before, Mr Microsoft Accessibility guy)

Drum Thumper
08-16-2010, 04:19 PM
USB vs. PS/2 is a bit of a mixed bag. USB is much faster, but the standard HID spec didn't anticipate pressing large numbers of keys simultaneously. There are workarounds to this problem, but none are ideal. PS/2 will let you press any number, but it's slower and it's simply unavailable on a lot of modern machines.


Ok, this raises a question on my part--with the advent of 3.0, couldn't the HID be retooled to handle simultaneous keystrokes of a larger nature? Or am I comparing apples to oranges?

Konrad
08-16-2010, 05:18 PM
I'm certainly not the expert here, but as I understand it

The majority of HID keyboards (including the "1000Hz" gaming ones) on market today use USB1.x (1.5Mbps Low-Speed or 12Mbps Full-Speed) - it's all they need. I've found some that use USB2 (480Mbps High-Speed) - they all have built-in USB2 hub controllers*, and the HID (keyboard) component is treated by the USB host as a separate device/function which seems to still operate only at Low-/Full-Speed.

The big bottleneck on "maximum speed" appears to be how fast the BIOS and OS can accept characters without choking (keyboard controller can't send a character until the host sends a ready signal, so the rate is controlled). Current USB keyboards can already exceed this rate, even without using USB2 speeds. The only "fix" I can think of is rewriting the HID libraries on the host, which might speed up the rate for the OS but can't speed up BIOS hardware. I've seen some commercial USB-developer software which appears to offer High-Speed and Super-Speed HID libraries, but maybe it's only for pointing devices (which are not enslaved by forced compatibility with ancient IBM keyboard controller chips). I could be wrong, I'm still a bit of noob in this area.

I haven't seen any keyboards or mice with USB3 ... the immediate giveaway would be the new USB3 connectors with extra pins.

[Edit again]
* One keyboard, the Gigabyte GK-K8000, only integrates a USB1.1 hub controller but also integrates a C-Media AC'97 audio controller.

electron_plumber
08-17-2010, 11:39 AM
So the way I'm envisioning my "ultimate" keyboard plan now goes -
...
1) Matrix limitations are just a matter of tradeoffs, the extreme approach to avoiding limits is simply to wire each key on an independent parallel circuit (with diodes, resistors, caps if really necessary). More work, but worth it.
2) Controller limits shouldn't be a problem if I "overkill" with say, a pair of $8 Parallax Propellers ... each rated at 32 or 40 I/O lines, up to 80MHz (PLL), 8 cores ("cogs"), 32KB RAM, 32KB ROM (can use some ROM to store user-programmed keys/macros and settings when unpowered, keyboard can operate without imposing a software hit on the OS); spare cogs can be used to drive accessories like integrated USB hubs and programmed backlighting effects.
Much better (and easier for me to program!) than the Holtek parts I've been looking at.
(* Yeah, that's right - a pair of 8-core processors running the keyboard, lmao *)
3) Unknown. I need more data to make a decision between USB and PS/2. Additional limits might be imposed if I choose a controller part which uses poorly-written libraries. Using a simulated COM port (or what the hell, even a serial COM port) is an interesting idea. At least I can see that the sort of simultaneous keyscanning I desire is possible with that method.


Just a couple of quick tips for rolling your own. First, there is no advantage to wiring each switch individually versus simply making a standard row column matrix IF you put a diode in series with each switch. If you do that, a single Propeller has more than enough I/O, and there are no blocking/ghosting issues. I highly recommend that. Compared to your other expenses (like all the individual switches and the big PCB), the diodes are cheap.

USB is a pain, so many lazy people like myself will use the FTDI parts to convert a serial data stream to USB, giving you what looks like a virtual COM port on the PC side. You can even buy cables with the FTDI part built in! (By the way, while very handy, those work best at lower baud rates. I typically try to restrict those to 9600 baud because you start getting errors. The problem is the long cable to chip. If you mount the FTDI part next to your circuit, you can run at 1M baud, which is very nice. You might need to tweak the latency in the driver for this to work well...)

Good luck!

Konrad
08-17-2010, 01:21 PM
Thanks for the tips :D

I'm beginning to suspect that cable signalling latency (=lowered stable baud rates) isn't as much an issue with PS/2.

I've decided I'll try to build a dual controller; first focus will primarily be PS/2 because that's a lot easier for me to work with right now, especially at BIOS pre-boot; USB can support higher signalling, power supply (for the keyboard) and more features ... I can add that after PS/2 working.

One potential issue I can find no information. Power draw by the keyboard can fluctuate, actually by a fair amount when USB hubs, banks of LEDs, etc are considered. I'm uncertain if the USB host handles power automatically or if the USB device needs to explicitly ennumerate a request when changing power consumption.

I've never actually used FTDI; usually similar MAX, SX, PIC, dsPIC, ARM parts when I need "modular" RS232 or USB interfaces. Are the baud-latency problems you describe the sort of thing I'd encounter regardless of the part, or just a real issue with FTDI?

Yeah, one Propeller is overkill. Two would be ridiculous, I'll have to use the other one for some other project.

Even though I originally scorned the idea, I was already favouring using a diode matrix approach before you suggested it (reduces total wiring/trace lengths by at least 75%). $6 for a bucket o' diodes isn't an issue but the 200+ solder points (hand soldering, and testing) looks a little tedious. Expenses aren't so high, really. I'll sacrifice a cheapo keyboard (complete with keys, switches, etc) to experiment on the controller/programming, then once satisfied, I'll just install it into the desired keyboard (Merc Stealth, heehee, I love the backlighting) and hammer out the details.

Of course I'm still at the "design" stage. Haven't actually built or programmed a thing yet; my "specifications" are actually evolving as I collect information and learn what it's about.

electron_plumber
08-17-2010, 01:37 PM
I think the issue is with driving logic level serial at high rates over a long cable. It's not differential like USB, and the impedance is not well controlled, and I think the cap/ft is pretty high. So you want to make the USB cable the long link, not the logic level serial. I think this would be true for any system like this, regardless of part...

I'm no expert on USB, but if memory serves, you get up to 100mA automagically, and up to 500mA if you request it. That can drive quite a few LEDs. Some keyboards add a second USB connector just so they can legitimately take twice as much power. Of course, most desktops will let you draw much more than this. Laptops are a different story...

electron_plumber
08-17-2010, 01:40 PM
Oh, and one more thing. The USB standby current spec is very tight - only 500uA!

Konrad
08-17-2010, 01:52 PM
Ouch 500uA. I thought 100mA (or at least 50mA) was "guaranteed" service?
Propeller can standby as low as 50uA, but that's really pushing it. Registers and RAM (including running code) flake out below 1mA unless the part is slowed to < 20Hz, plus sluggish recovery.

Yeah, laptops suck for power output, I avoid using 'em for RS232 (pitiful voltages) and was automatically going to do the same here. Maybe USB is better regulated. Still, I doubt this (or any other) gaming keyboard will see use on a laptop, so this shouldn't be an issue unless I'm just tweaking for compatibility.