Teensy Ideas

User avatar
mrog

05 Dec 2011, 15:05

Hi guys,

I don't even have a keyboard to mod yet, and i'm already thinking of mods.

Unfortunately I only have basic electronics skills, but I do like to think that I have some reasonable ability with code.

Anyway I was thinking about the possibilities of the teensy/ardunio board, and what I could do with the ability to intercept the keypresses before sending them to the pc.

My initial idea is to write some on the fly keyboard remapping/swapping and macro recording and playback - probably initialized by some special key combination to start recording macros and assign key buttons, perhaps I can throw in some profiles etc.

The more I think about features the more I think I need some sort of display - now you could easily enough produce some client software for the pc instead, but I that would be besides the point, you can always write software to do this stuff, but you maintain true independence and compatibility by keeping it all within the keyboard.

There a few displays available so this shouldn't be a problem - although I am worried about using up all the digital inputs. Anybody know a good guide to keyboard wiring, how many inputs do I need for NKRO?

Anyway these are so far just ideas I'm having, anybody have any thoughts? anybody already done this sort of thing before? I don't yet have a keyboard to mod, but when I do i think this will be a fun project.

grasshopper

05 Dec 2011, 15:16

Yes it's already been done, but without a display. One of these days I intend to build one because I like to swap CAPS LOCK and CTRL.

link

User avatar
mrog

05 Dec 2011, 15:26

Not bad, I see its got some hardcoded profiles - I'll probably use this code for my base if I do this.

But I was thinking more about having macro recording and on the fly key remapping - if you use vim, think like vim macros.

Say you find yourself repeatedly pressing a certain key combo, press Meta-R type your combo press Meta-R press the key to assign it to. then when you press that key it performs your combo.

Might be good for streetfighter players - but also awsome for people editing text (and for some reason not using vim!!)

Other possibilities also exist, some game have a feature to lazy walk - as if you were holding forward for long distance travel, we could emulate that feature in the keyboard - allow the user to lock any key (Meta-L key to lock) and (Meta-L key to unlock again)

User avatar
mrog

05 Dec 2011, 15:32

I keep having more ideas, key swapping Meta-S key1, key2
Meta-C clear all bindings,
Meta-shift-P 0-9 save to profile 0 to 9
Meta-P 0-9 switch to profile 0 to 9

Might not need a display after all really - it would probably only add to the work load

Also when i say Meta- I mean I dunno some key combination i havn't really thought about yet...

--edit-- More ideas

How about: Meta-Number Key => repeat chosen keypress (which could be a macro) however many times.

grasshopper

05 Dec 2011, 17:09

I think a display would be overkill and would add to the cost. However, it would be useful to have the facility to pre-program a number of different keymaps into the device in advance, and then have some dip switches on the board itself to switch between them.

User avatar
mrog

05 Dec 2011, 17:14

I had better order a Teensy I guess - I can make a ps2 -> usb adapter like the project you've linked to - although my initial thoughts were to replace the keyboard controller - going off the back of this project would at least substantially cut my development times - in both software and hardware.

User avatar
kps

05 Dec 2011, 18:13

Small text LCD displays (16 or 20 columns by 2 lines) are readily available under $5, and bitmap displays under $10. These use a parallel interface, generally requiring 11 pins (though many have a 6-pin, 4-bit option), so you'd need a Teensy++ if you are decoding a large matrix rather than going from PS/2. You can find tutorials and libraries on avrfreaks.net.

User avatar
mrog

06 Dec 2011, 17:13

Yeah I'll defiantly consider it, Once I've got a keyboard to mod I'll throw something together.

dsjbirch

24 Apr 2012, 16:17

Have you made any progress on this yet? I'm having a similar idea...

User avatar
mrog

24 Apr 2012, 16:25

Nope :( I have a board now, I produced code as a proof of theory to drive an n-key rollover keyboard matrix, its sitting on my desk right now - its not quite the same project - but related.

I'm not sure which direction I want to take the idea - an entire keyboard, or just an adapter?
It's a little on hold at the moment while I move house!

Let me know if you get anywhere!

dsjbirch

24 Apr 2012, 23:48

Will post up a thread if anything takes off. I'm gonna start with an adapter. If I manage (and my poker arrives) I'm gonna replace the controller.

hemflit

27 Apr 2012, 11:51

Hey, a little late to the party, but...
mrog wrote:Anyway I was thinking about the possibilities of the teensy/ardunio board, and what I could do with the ability to intercept the keypresses before sending them to the pc.
You could borrow some ideas (or code!) from Hasu's HH mod - notably, he makes some key combos act as a mouse, so you can move a pointer without taking your hands off the keyboard.

Code: https://github.com/tmk/tmk_keyboard
Story: http://geekhack.org/showwiki.php?title=Island:12047

My initial idea is to write some on the fly keyboard remapping/swapping and macro recording and playback - probably initialized by some special key combination to start recording macros and assign key buttons, perhaps I can throw in some profiles etc.
Sounds fun.

The more I think about features the more I think I need some sort of display...
This may not be what you're looking for, but PJRC sell a screen they've made work with a Teensy: http://pjrc.com/store/dev_display_128x64.html
(Seems to take up 20-ish pins.)

Instead of a display, have you considered using the keyboard's output? So, you would switch to a text editor on your computer (or just run cat), press some keyboard combo to enter some diagnostic mode on it, and the kbd would send its output to the computer as if you're typing it. You would see it on the screen. It could even have menus and a help system ("{D}elete all macros, {L}ist macros....")

Anybody know a good guide to keyboard wiring, how many inputs do I need for NKRO?
NKRO is about communication between the controller and the computer, it doesn't enter into the number of wires.

For maximally-useful NKRO, of course you also want anti-ghosting, but that also doesn't affect the number of wires, as long as you can stick in a diode next to each switch. (If you can't, forget anti-ghosting - it would then need a dedicated pin for every key.)

Also, NKRO (unlike anti-ghosting) is overrated. How often do you really need to register 7 (non-modifier) keys at the same time?


Simplified: The number of pins you need is roughly double the square root of the number of keys.

17 pins would be enough for a mini keyboard of 65-72 keys, 21 pins for a full-sizer (101-110 keys), 23 pins for some beast with up to 132 keys. You could shave down the key count a little by wiring the two Ctrls together or something.


For completeness: If you don't mind sticking in a bunch of demultiplexers or similar gates, you could actually manage most real-world keyboards with just 8 controller pins. This is probably not worth the trouble - for the extra $1 they cost, and the space they'll take, you could just get a bigger controller.

Theoretically, if you're willing to put increasingly complex electronics between the controller and the switches, you can reduce the pin count further, but that's really only a good idea if you're doing this as an electronics challenge, not if you just want to hack a kbd.

dsjbirch

27 Apr 2012, 13:31

Great summary hemflit. I've ordered my controller, expected delivery in 3 weeks. I like the cat idea. Will definitely look at hasu's choose too.

Post Reply

Return to “Keyboards”