While typing away on our DIN, PS/2, USB or Bluetooth keyboards one of the questions which we rarely concern ourselves with is that of how the keyboard registers which keys we’re pressing. One exception here is when the keyboard can only register a limited number of simultaneous keypresses (rollover). Even though most keyboards today use a matrix which connects the keys, there are many configuration choices even here, which much like other keyboard configurations come with their own advantages and disadvantages. As a good primer we can look at this article by [Daniel Beardsmore] as he takes us through both historical and current-day keyboards.
Especially before it was realistic to just put an entire microcontroller with a look-up table into every keyboard, more inventive approaches were required to not only register keypresses, but also encode them for the host computer. The photoelectric approach of the 1960s was one such encoding method, before diode matrices became popular, along with more exotic encoding switches that contained their code already hard-wired on their multitude of pins. One inevitable limitation with these was that of a lack of multi-key support, leading to the development of matrix scan technology around 1970.
Matrix scanning keyboards allow for multiple key presses at the same time, tackle debouncing of keys and were at the forefront of what gives us the ubiquitous and generally boringly reliable keyboards which we use today.
its an interesting article, too bad the summary leaves me with just enough to not really care if I wasn’t a computer nerd
I’m looking forwards to the ‘Not So Brief’ follow up article which explains what a matrix scanning keyboard is.
A matrix scanning keyboard is the design behind most modern keyboards, both for computers and electronic musical instruments. It uses a clever wiring scheme to efficiently detect which keys are being pressed with far fewer wires than the number of keys.
Here’s how it works:
Grid of Wires: The keys are arranged in a grid of rows and columns. Each key sits at the intersection of a single row and a single column.
Scanning Process: A microcontroller inside the keyboard controls the scanning. It activates each column (one at a time) by sending a voltage through it.
Checking the Rows: While a column is activated, the controller reads the voltage on all the rows. If a key in that column is pressed, it will create a connection between the active column and the pressed row, causing a change in voltage.
Identifying the Key: By knowing which column is active and which row shows a change in voltage, the controller can pinpoint the exact key being pressed.
This technique drastically reduces the number of wires needed. For instance, a keyboard with 8 rows and 8 columns (64 keys) only requires 16 wires (8 for rows and 8 for columns) compared to 65 wires if each key had its own dedicated wire.
Here are some additional points about matrix scanning keyboards:
Software Decoding: The microcontroller uses software to translate the row-column information into the specific key code that the computer can understand.
Not perfect: In rare cases, if multiple keys are pressed very close together, it can lead to a phenomenon called “ghosting” where the keyboard registers extra key presses. However, modern keyboards have techniques to minimize this.
Efficiency and Simplicity: Matrix scanning is a simple and efficient way to detect key presses, making it the dominant design for modern keyboards.
16 wires for 64 buttons … that’s a lot of wires. Can a diode array accommodate one key to enable capital letters? How many wires required for 64 button diode array with button for capital letters? …..
Was this comment AI generated ?
All my comments are ai generated.
I think commentators who use ai like Reluctant Cannibal who are obviously too lazy to write comments themselves should be banned. I’ve written a letter of complaint to Supply Frame.
@Roger,
I think RelCan was being sarcastic.
Edit: @Roger, rereading your comment has risen my /sarc flag for you as well.
(mumbling) Where’s my coffee?
I dont care if they were being sarcastic or not. Ai is the scourge of humanity and in the hands of bad actors such as the Kremlin or N.Korea will undoubtedly undermine such fine institutions as Hackaday with their subterfuge. What might seem like a harmless comment about a matrix scanning keyboards is just an injection point for far more insidious comments designed to undermine western democracy. Commentators such as Reluctant Cannibal are ‘Sleeper’ ai bots waiting to be activated by their malevolent masters who occasionally test their influence with what would erroneously be conceived as constructive input.
Stupid nested comment depth limit. Come on HaD, just use Slashcode already. It’s free, handles deep nested comments, and the moderation system is still better than reddit’s, or doing it by hand.
Anyway, this is just a public announcement relating to the “AI” comments below. Ms List probably gets the joke, but for non-UK readers, “Fulchester” is a made-up place where most of the action in the the adult satire comic “VIZ” takes place. While being completely imaginary, Fulchester often resembles certain parts of Newcastle on Tyne where the creators grew up.
Viz is a great read BTW, and still as funny as it used to be.
Maybe someone knows this. I have an old IBM Model M in the attic, with F1 to F24, but it has an RJ45 connector (not SDL). Any chance anyone knows an easy way to get that hooked up to USB?
Hi Bob,
i found this: https://sharktastica.co.uk/guides/soarers_1#WhatCanDo , the Soarer’s converter for several keyboards to USB.
Thank you so much, that is a great help!
In essence, it seems to be an Arduino Leonardo Pro micro (which has USB) with specific Firmware.
You can build a Soarer’s Converter yourself, like in https://deskthority.net/viewtopic.php?t=19035 .
At risk of dating myself, I headed up the product marketing and application engineering for General Instrument and later SMC for their 2-key rollover (KR2376) and n-key rollover (KR3600) keyboard encoders. These devices, which handled switch closure detection, switch debounce, encoding and rollover, were used by nearly every keyboard manufacturer in the 70’s and early 80’s. I wrote a piece describing their operation, for Arthur B. Williams (any relation?) “Designer’s Handbook of Integrated Circuits” published in 1984. The N-key rollover IC’s became far more popular than the 2-key rollover devices by facilitating high typing rates. Typing errors with N-key rollover errors tended to produce incorrect data entry, whereas typing errors with 2-key rollover tended to produce missed key strokes. 2-key rollover was preferable for numeric data entry where a missing digit was easier to spot than an incorrect digit.
https://en.wikipedia.org/wiki/Charlieplexing
Most keyboards are less than 128 keys and once you have a microcontroller that can do a decent job of talking USB, you usually have enough pins to do a small matrix or can add a relatively cheap line decoder that will massively increase the potential size of a matrix.
On the LED side of things, doing Charlieplexing/tristate-multiplexing is potentially interesting. You can’t do a big RGB keyboard matrix with charlieplexing. Well you can, but there are diminishing returns when you have to sink current for too many LEDS using a low duty cycle. But your typical set of indicators for caps lock, scroll lock, num lock could be done with two pins and no additional active components.