A Programmable Keyboard Controller
I was frustrated by the Mac keyboard layout and also noticed that a lot of projects require some kind of custom keyboard controller (for example, if you’re trying to hack and old PS2 keyboard to work with a modern system. For this reason I decided to create a programmable keyboard controller.
The controller is based around a AT90USBKey and uses the LUFA library to manage the USB HID stuff.
To use the keyboard controller you need to removed the existing controller from your keyboard (hence the Mac keyboard disassembly I previously posted). Once removed you need to connect the keyboard matrix to the controller. It doesn’t really matter how you connect it, the idea is that the keyboard will learn the keyboard layout.
Here’s a close up of the controller installed in a Mac full size keyboard:
And a slightly less elegant hack in to a Mini mac keyboard:
To program the keyboard, open notepad or another text editor on your computer. Plug the keyboard in while holding down a key. The keyboard will being typing text in to the text editor. It’ll start my printing a welcome message and will then ask you to press keys on your keyboard.
The controller is now learning which key is which. It’s continually scanning the keyboard matrix, and when it detects a short between pins it registers this as the key it’s currently learning. Once training is complete the controller writes the matrix layout information to the AT90s internal flash. So you only need to train once.
The whole thing seems to work pretty well, though I think my debouncing logic could do with some work. Suggestions are welcome.
I’ve put all the code on sourceforge here.
If you’re interested in using or developing from this code, please let me know. I think a keyboard controller like this could be a generally useful tool for hacking projects.
[…] [Nav] wanted to change his keyboard mapping for one particular keyboard, rather than on each operating system. He used an AT90USBKey as a replacement PCB by soldering to all of the contacts on the key matrix. This allows him to remap the keys by following onscreen prompts. […]
[…] [Nav] wanted to change his keyboard mapping for one particular keyboard, rather than on each operating system. He used an AT90USBKey as a replacement PCB by soldering to all of the contacts on the key matrix. This allows him to remap the keys by following onscreen prompts. […]
[…] [Nav] wanted to change his keyboard mapping for one particular keyboard, rather than on each operating system. He used an AT90USBKey as a replacement PCB by soldering to all of the contacts on the key matrix. This allows him to remap the keys by following onscreen prompts. […]
Wow, nice hack!
Good matrix discovery and defining keymap without rebulding are very impressive and exactly what I want to implement into my firmware. I’ll look into your code.
This is my firmware: https://github.com/tmk/tmk_keyboard
Thanks.
[…] 。他作为一个AT90USBKey更换PCB焊接关键矩阵的所有接触。这让他重新映射的键,按照屏幕上的提示 […]
[…] [Nav] wanted to change his keyboard mapping for one particular keyboard, rather than on each operating system. He used an AT90USBKey as a replacement PCB by soldering to all of the contacts on the key matrix. This allows him to remap the keys by following onscreen prompts. […]
Hey,
This is a great site. Really love some of the builds you’ve put together.
Do you have an email I can contact you on? I have a few questions to ask.
Thanks
Ryan
[…] The article will be more of a guide on how to build a portable yet effective keyboard controller which can be programmed as per the user’s requirem…. […]