geekhack

geekhack Community => Keyboards => Topic started by: Chris_F on Tue, 12 June 2012, 20:10:18

Title: Converting an 83-key XT keyboard to USB
Post by: Chris_F on Tue, 12 June 2012, 20:10:18
I have a keyboard from an IBM XT that I would like to convert to USB. I'm planning on getting one of these (http://www.sparkfun.com/products/11117) to do the job. As I understand it, USB only provides up to 100mA during a devices initialization, and only after that can it be configured to draw more. I'm worried that they keyboard controller might draw too much and prevent the AVR from fully initializing.

Does anyone have any experience with something like this?
Title: Converting an 83-key XT keyboard to USB
Post by: fohat.digs on Tue, 12 June 2012, 20:18:27
Looks just like the Teensy, which works great.

Everything you need is right here:

http://geekhack.org/showwiki.php?title=Island:17458 (http://geekhack.org/showwiki.php?title=Island:17458)

Don't forget to say "thank you" to Soarer!
Title: Converting an 83-key XT keyboard to USB
Post by: spolia optima on Tue, 12 June 2012, 20:26:21
I'm so jelly of you electromechanically-inclined types :(
Title: Converting an 83-key XT keyboard to USB
Post by: Chris_F on Tue, 12 June 2012, 20:35:37
Quote from: fohat.digs;612302
Looks just like the Teensy, which works great.

Everything you need is right here:

http://geekhack.org/showwiki.php?title=Island:17458 (http://geekhack.org/showwiki.php?title=Island:17458)

Don't forget to say "thank you" to Soarer!

Is his firmware open source?

If it isn't (I didn't see any firmware source), it's nice that it exists, but I would probably be happier writing something myself. Also, I didn't see mentioned anything about these keyboards power requirements. I know I can configure the AVR for high-power mode (>100mW) but I'm worried that the keyboard might overload it and prevent it from getting that far.
Title: Converting an 83-key XT keyboard to USB
Post by: fohat.digs on Tue, 12 June 2012, 20:41:52
I have run several different Model Fs, including the behemoth 122-key terminal boards via Teensy from the USB and never had a problem.

I thought that USB could draw up to 500mA, but I may be wrong. I have been through Soarer's intialization process several times, no problems there.

After upgrading to Windows 7, and also Ubuntu 12.04, the computer did not recognize the Teensy until I booted up with a PS2 keyboard, then hot-plugged the USB, but after the first time it worked like a charm.

Don't remember about Soarer's policies, that is way over my head and I am grateful as hell that he wrote it.

If you need to re-invent the wheel, by all means, go ahead!
Title: Converting an 83-key XT keyboard to USB
Post by: Soarer on Tue, 12 June 2012, 22:18:22
Quote from: Chris_F;612289
I have a keyboard from an IBM XT that I would like to convert to USB. I'm planning on getting one of these (http://www.sparkfun.com/products/11117) to do the job. As I understand it, USB only provides up to 100mA during a devices initialization, and only after that can it be configured to draw more. I'm worried that they keyboard controller might draw too much and prevent the AVR from fully initializing.

Does anyone have any experience with something like this?

Well... the spec says that a device should only draw up to 100mA during init, but in practice it isn't a problem as long as the device isn't plugged into something that can only supply 100mA, e.g. a bus-powered hub. Powered hubs have to be able to supply 500mA at all times, even during device init (excepting error conditions).

Quote from: Chris_F;612322
Is his firmware open source?

It isn't. In principle I'd like to, but... Firstly, I can't decide on a license. Secondly, I'd want it to be at a stage where I believe forks make sense. (IMO, that certainly wasn't true until recently, when all that I had in my head for v1.0 was finally implemented). Lastly, once done it can't be undone - so it won't happen until I'm convinced!

Have you released any open source projects, and if so, what license did you use?
Title: Converting an 83-key XT keyboard to USB
Post by: Chris_F on Tue, 12 June 2012, 22:28:56
Quote from: Soarer;612405
Well... the spec says that a device should only draw up to 100mA during init, but in practice it isn't a problem as long as the device isn't plugged into something that can only supply 100mA, e.g. a bus-powered hub. Powered hubs have to be able to supply 500mA at all times, even during device init (excepting error conditions).

I figured that might be the case. How do you handle sleep mode? Does the keyboard controller stay on?

I was thinking about regulating power to the keyboard controller with a NPN transistor, so that I could wait until after init to power it, and also so it could be shut off during sleep. You wouldn't happen to know that the voltage tolerance for these keyboard would be?

Quote from: Soarer;612405
It isn't. In principle I'd like to, but... Firstly, I can't decide on a license. Secondly, I'd want it to be at a stage where I believe forks make sense. (IMO, that certainly wasn't true until recently, when all that I had in my head for v1.0 was finally implemented). Lastly, once done it can't be undone - so it won't happen until I'm convinced!

Have you released any open source projects, and if so, what license did you use?

No, I haven't created anything unique enough or useful enough to release yet. I imagine for something like this, it would not be too big of an issue what license you choose. GPL or BSD/MIT licenses would all probably be fine.

In any case, I look forward to programming the AVR myself since I haven't had much experience with them and I don't need all the bells and whistles, just basic functionality.
Title: Converting an 83-key XT keyboard to USB
Post by: AKIMbO on Tue, 12 June 2012, 22:37:19
Quote from: Soarer;612405
Well... the spec says that a device should only draw up to 100mA during init, but in practice it isn't a problem as long as the device isn't plugged into something that can only supply 100mA, e.g. a bus-powered hub. Powered hubs have to be able to supply 500mA at all times, even during device init (excepting error conditions).


It isn't. In principle I'd like to, but... Firstly, I can't decide on a license. Secondly, I'd want it to be at a stage where I believe forks make sense. (IMO, that certainly wasn't true until recently, when all that I had in my head for v1.0 was finally implemented). Lastly, once done it can't be undone - so it won't happen until I'm convinced!

Have you released any open source projects, and if so, what license did you use?

You should check out a dual-licensing scheme.  One license being GPL or LGPL (so others can use your software for free for non-commercial purposes) and the other being so some sort of for-profit licensing scheme.  You should tack on a reciprocity clause or an extra reciprocity license so you can incorporate others improvements on your software without worry of legal reprecussions against yourself.  

I'm no coder like many of you geekhackers but I do know the law.

Check out the links below for more info on the types of licenses and examples Soarer:
Types of licenses (http://www.zdnet.com/blog/burnette/how-to-pick-an-open-source-license-part-2/131?tag=content;siu-container)
GPL license examples (http://www.gnu.org/licenses/license-list.html)
Title: Converting an 83-key XT keyboard to USB
Post by: Soarer on Tue, 12 June 2012, 23:06:43
Quote from: Chris_F;612409
I figured that might be the case. How do you handle sleep mode? Does the keyboard controller stay on?

I was thinking about regulating power to the keyboard controller with a NPN transistor, so that I could wait until after init to power it, and also so it could be shut off during sleep. Maybe this is completely unnecessary.

I just leave it all on - otherwise, you couldn't do a remote wake-up of the computer from the keyboard! Again, hosts just don't enforce the spec, and if the port isn't configured for remote wakeup, its power will usually be switched off during sleep anyway.

Quote from: Chris_F;612409
No, I haven't created anything unique enough or useful enough to release yet. I imagine for something like this, it would not be too big of an issue what license you choose. GPL or BSD/MIT licenses would all probably be fine.

In any case, I look forward to programming the AVR myself since I haven't had much experience with them and I don't need all the bells and whistles, just basic functionality.

Oh, licensing always matters! I spent a while reading them (so tedious...) and GPL is probably alright for what I want. But it's still hard to make a final decision on that or whether to open source at all... and there's always something more important or more interesting to do, like adding more functionality!
Title: Converting an 83-key XT keyboard to USB
Post by: Soarer on Tue, 12 June 2012, 23:14:56
Quote from: AKIMbO;612416
You should check out a dual-licensing scheme.  One license being GPL or LGPL (so others can use your software for free for non-commercial purposes) and the other being so some sort of for-profit licensing scheme.  You should tack on a reciprocity clause or an extra reciprocity license so you can incorporate others improvements on your software without worry of legal reprecussions against yourself.  

I'm no coder like many of you geekhackers but I do know the law.

Check out the links below for more info on the types of licenses and examples Soarer:
Types of licenses (http://www.zdnet.com/blog/burnette/how-to-pick-an-open-source-license-part-2/131?tag=content;siu-container)
GPL license examples (http://www.gnu.org/licenses/license-list.html)

Thanks! I read the first link a while back, very useful. I would certainly offer a commercial licensing option, just in case I got lucky!!

The second link is a great illustration of why it's hard to make a choice!!!
Title: Converting an 83-key XT keyboard to USB
Post by: Soarer on Wed, 13 June 2012, 16:19:04
BTW, I just measured an XT keyboard: 120mA :-)
Title: Converting an 83-key XT keyboard to USB
Post by: Chris_F on Wed, 13 June 2012, 16:55:07
Quote from: Soarer;612893
BTW, I just measured an XT keyboard: 120mA :-)


Wow, what a pig. I tested mine and it was only drawing ~105mA.

Still, I just wont feel right if it doesn't conform to the spec, so I think I'll add a switching transistor just to be safe.
Title: Converting an 83-key XT keyboard to USB
Post by: Soarer on Wed, 13 June 2012, 18:46:32
Well even 105mA would be over :-p And then there's ~15mA for the AVR.

I'm not sure switching the power is worth the trouble, since with or without it the result is the same - the converter will work on a powered hub or port on the PC, and won't work on a bus-powered hub. I have thought about using buffers in line with the clock and data signals though, because the AVR ports are the most likely place for damage to occur.