Is remapping a USB keyboard using Teensy possible?

User avatar
Half-Saint

24 Jun 2012, 22:00

RC-1140 wrote:That's apparently an USB Tipro Controller board. I wish I had an USB one too. I only have two PS/2 ones.
Since I'm from Tiproland, I can get you some USB ones ;)

User avatar
hasu

03 Sep 2012, 15:41

I added USB to USB converter in my keyboard firmware repository.
See this post. http://geekhack.org/index.php?topic=330 ... #msg653549

Image

My Sparkfun Host Shield is obsolete and incompatible with Leonardo, this needed messy cables to connect with Leonardo. Of course Circuit@Home Shield doesn't need this messy cables, it can be stacked well on Leonardo.

Limmy

06 Sep 2012, 00:02

How exciting!
So, I need to purchase
1. https://www.circuitsathome.com/products ... ino-boards
[ Edit: this is not what is needed. It is Arduino Leonardo that is needed for this mod. Link for Arduino Leonardo http://arduino.cc/en/Main/arduinoBoardLeonardo ]
2. https://www.circuitsathome.com/products ... r-arduino/

Does this support second layer customizing? (is your firm ware easily modifiable?)
Why is the standard B connector on Arduino is mini B connector in your Arduino board?

Not sure exactly how firmware update is done or whether firm ware is edit friendly, but definitely interesting!! Thanks hasu!
Last edited by Limmy on 06 Sep 2012, 13:49, edited 1 time in total.

User avatar
Soarer

06 Sep 2012, 00:47

1. No, not the Uno, you want the Arduino Leonardo. (explains the connector difference as well).
2. Yes. This one fits neatly on the Arduino. If you don't want to solder there's also an assembled version.

Alternatively, a Teensy 2.0 with the mini shield should work too, as in my earlier post. I haven't got round to trying hasu's code on it yet though!

User avatar
hasu

06 Sep 2012, 03:10

Right, Leonardo is needed instead of Uno. Circuit@Home has no Leonardo, you need to find other shop.
Of course, multi layer, media key and mouse key are supported. Just edit keymap.c to have your favourite keymap.
https://github.com/tmk/tmk_keyboard/blo ... b/keymap.c

Note that my USB to USB converter is not mature enough and has some limitations.
- Hub is not supported, this means HHKB pro2 will not work.
- Only 'boot protocol'(6KRO) is supported, not NKRO keyboards like Noppoo Choc mini. (Never support NKRO)
- keyboard LED is not supported. (I don't have keyboard with LED around :)
- wake/resume is not supported.
- You may need unplug and plug your keyboard to start initialization process. (maybe needs some hardware mod)

Limmy

06 Sep 2012, 14:01

Thank you for the update!
With PS/2 to USB converter using Teensy(one developed by Soarer or another by hasu) and this USB device, I should be able to remap any keyboard except keyboards with integrated USB hub.

I don't put my computer to sleep nor require NKRO(6KRO is enough for me), so I am happy with the solution you guys provided. Thank you guys!

Franzl

30 Oct 2012, 03:13

Soarer wrote:Alternatively, a Teensy 2.0 with the mini shield should work too, as in my earlier post. I haven't got round to trying hasu's code on it yet though!
Sorry for bump, but have you found some time to test it?

User avatar
Soarer

30 Oct 2012, 14:58

Franzl wrote:
Soarer wrote:Alternatively, a Teensy 2.0 with the mini shield should work too, as in my earlier post. I haven't got round to trying hasu's code on it yet though!
Sorry for bump, but have you found some time to test it?
I tried hasu's code with the mini shield without success - I get "HID init: failed" with both an ML4100 and an MX3000, both when starting from the bootloader and when just plugging it in. I'm not sure at this point whether the code doesn't like those keyboards, or whether the different hardware is causing the problem, and I just haven't had time to look into it further :(

I'm assuming that some configuration issue is most likely, since it's failing at a very early stage. My hardware setup passes the board_qc test in the USBHostShield2 libary though, and that can read the device descriptor OK.

User avatar
Soarer

31 Oct 2012, 03:26

Right, got it working... simply a config setting in tmk_keyboard/protocol/usb_hid/USB_Host_Shield_2.0/avrpins.h: needed to uncomment #define BOARD_TEENSY to get it working with the Teensy 2.0 + Mini shield combo.

User avatar
fossala
Elite +1

31 Oct 2012, 07:45

Soarer wrote:Right, got it working... simply a config setting in tmk_keyboard/protocol/usb_hid/USB_Host_Shield_2.0/avrpins.h: needed to uncomment #define BOARD_TEENSY to get it working with the Teensy 2.0 + Mini shield combo.
Got any pictures, pictures are always good.

User avatar
Soarer

31 Oct 2012, 13:45

The next step will be to fold it over and use header pins in some of the spare holes to hold it together.
Teensy_with_Mini_Shield_real.jpg
Teensy_with_Mini_Shield_real.jpg (500.97 KiB) Viewed 19462 times

Limmy

01 Nov 2012, 04:57

Wonderful! Now, it would be perfect if we could get a decent housing for the parts. Is there a popular way to put them in a case? It seems it would be hard to hold the boards in place. Is there an easy solution to this? Hmm.. glue gun?

User avatar
fossala
Elite +1

01 Nov 2012, 09:06

Do you plug the keyboard into the mini shield or the teensy? It would be better into the mini shield because it's usb 2.0. What is a mini shield?

User avatar
Soarer

01 Nov 2012, 12:11

There was a link just a few posts ago! It's the USB host, so that's where the keyboard plugs in :P

Casing it properly would be tricky. A custom made case using layers of acrylic or aluminium might work nicely. But I'll probably just use tape or heatshrink (after smoothing sharp solder joints and PCB corners) :D

User avatar
fossala
Elite +1

01 Nov 2012, 13:23

Dammit Soarer and Hasu, you're just adding to the list of things I NEED to buy.

Janner

03 Nov 2012, 14:30

I am not a hardware engineer and have quite frankly never done something like this myself, but hell would I like to have such a thing lying around! I will be checking this post every once in a while to check for updates. Sounds promising.

User avatar
Soarer

03 Nov 2012, 15:41

The easiest option for hardware is an Arduino Leonardo plus the circuits@home USB shield 2.0 - much larger than the mini combo above, but no fiddly soldering to do, they just plug together. Also, they both have mounting holes and the connectors come out on the same side, so it would be far easier to mount into a box.

However, the edge with the connectors of the host shield doesn't line up with the edge of the Leonardo, which is a shame. This picture is of some other Arduino, not a Leonardo, but the dimensions are similar:

Image

tinyosshop have a USB host shield that appears to be the same design as the circuits@home shield, and slightly cheaper. Even cheaper to buy on ebay though, and free postage. They also have Tosduino Leonardo which is priced well (again, search ebay for it, can be found with free postage).

But still, I don't think hasu will mind me saying, the software needs work before it could really be called ready for general use.

Hubbert

24 Nov 2012, 22:05

Forgive me for being dense, but does this mean that the Soarer Converter will not work when connected to a typical USB keyboard connected through a simple USB to PS/2 adapter?
http://www.cyberguys.com/product-detail ... uctid=4202

User avatar
Soarer

24 Nov 2012, 22:41

Hubbert wrote:Forgive me for being dense, but does this mean that the Soarer Converter will not work when connected to a typical USB keyboard connected through a simple USB to PS/2 adapter?
http://www.cyberguys.com/product-detail ... uctid=4202
My converter works just fine like that (as long as the keyboard supports PS/2). :D

This project's slow progress is mostly explained by its limited applicability. On the one hand most simple 6KRO USB keyboards also work fine over PS/2, so a PS/2 converter can be used instead. On the other, supporting fancier USB keyboards which have >6KRO (or even media keys etc) requires a lot of work. So this just fills a small niche, for now.

Hubbert

24 Nov 2012, 22:51

Thanks; that's good news. All my keyboards are either native PS/2 or include an adapter in the box, which should be enough for now. WASD claims NKRO over the included hunk-o-plastic PS/2 adapter, which should make an interesting test.

User avatar
Soarer

01 Dec 2012, 23:17

Soarer wrote:tinyosshop have a USB host shield that appears to be the same design as the circuits@home shield, and slightly cheaper. Even cheaper to buy on ebay though, and free postage. They also have Tosduino Leonardo which is priced well (again, search ebay for it, can be found with free postage).
... if you don't mind the wait :lol: I ordered both on the 9th. The host shield arrived today, and the Leornardo clone arrived a few days ago. Not toooo bad, I suppose, but the ethernet shield I ordered at the same time arrived over a week ago!

The things I want to play around with first are actually pointer device related - upping report rate to 500Hz or 1000Hz, and allowing sensitivity and acceleration settings per device (for when multiple pointer devices are in use).

User avatar
damorgue

01 Dec 2012, 23:48

How would the Noppoo Choc Mini work with this? If I remember correctly, it manages NKRO over USB by emulating two keybaords. I may have confused it with another model. Just a theoretical question.
Last edited by damorgue on 05 Jan 2013, 15:57, edited 1 time in total.

User avatar
Soarer

02 Dec 2012, 00:18

It wouldn't - anything other than the basic 6KRO means a lot of work :(

- read descriptors
- parse descriptors
- set up some structures for dealing with the report described by the descriptor
- map that report data into the output reports
- send output reports when needed

Hasu (who has done _all_ the work on this so far) doesn't seem keen to do it, and I've no idea when I would find time to have a look at it (or even the pointer stuff I want to play with, if I'm honest). If Hasu doesn't beat me to it, I do want to try and get the reset working nicely though, and perhaps also get it working for keyboards with built-in hubs (although the hub wouldn't work).

edit: forgot about the other bit I thought I might look at - telling the keyboard to use 6KRO mode, like a BIOS does. That might make the noppoo work, I don't know.

darkness

03 Dec 2012, 13:50

In my quest to use learn a new keyboard layout, I actually did a Leonard + USB Host Shield 2 combo and came up with the code to make it work (for me).

I have posted my code and seutp here if you are interested:

http://forum.colemak.com/viewtopic.php?pid=10837

Cheers!

User avatar
Soarer

07 Dec 2013, 19:55

One year on, and I still haven't found the time or motivation to work on this at all :(

I did just stumble across another possible approach, and thought I might as well throw some links up. Hobbytronics have a USB Host Board using the Microchip 24FJ64GB002 microcontroller. They have various firmwares for it, including keyboard, however it outputs a serial stream that's not flexible enough for our wants. I don't know if their source is available, or if it would be better to start from the samples included in the 24F Starter Kit from Microchip.

Aleksander

07 Dec 2013, 20:13

You could also use a MBED-thing.. that one has both USB-host and USB out.. would be WAY overkill, but it should be possible :P

User avatar
Soarer

07 Dec 2013, 20:45

Overkill is fine if the price is cheap! (And if writing/loading code is easy and doesn't require buying more stuff). But €49 (for this one) is more than a Teensy with a module costs... for now! Is there a cheaper one with USB host and device?

Post Reply

Return to “Workshop”