Connect with us

Building a USB keyboard

Discussion in 'Electronic Basics' started by David Abrahams, May 31, 2005.

Scroll to continue with content
  1. I need to build an external USB (or PS2 if that's somehow easier)
    computer keyboard around a Dell Inspiron 8100 replacement keyboard.
    It's been almost 20 years since I've done any serious hardware
    hacking, so I thought I'd ask here about how to approach the problem.
    Any help would be deeply appreciated.

    This link explains some of the reasons for my quest:

    Also, I have recently bought an Inspiron 9300 into which I'd
    ultimately like to transplant one of these other 8100 keyboards (the
    9300's keyswitch technology is inferor for my purposes). The
    keyboards in the two machines use an incompatible connector and the
    signals in the cables do not match up (i.e. even after swapping
    connectors the 8100 keyboard won't work in a 9300). It seems rather
    unlikely that I'll be able to simply exchange some signals and get a
    keyboard that functions in the new laptop, so ultimately I'd like to
    build a small circuit to adapt the 8100 to the 9300... that's a much
    bigger and more critical project, though, I'm sure.
  2. mike

    mike Guest

    Why not just type on the Dell?
    It is possible to use VNC and the network to show your desktop screen on
    the laptop. If you just use the keyboard/mouse from the laptop, but
    view the desktop screen directly, you avoid all the transmission latency
    of the VNC display.

    The laptop keyboard is usually just a key matrix. Maybe you can cut up
    a PS/2 keyboard, reverse engineer the matrix and make it work. Or just
    program a microcontroller to do the interface. But I think you'll find
    that it's not worth the effort.

    Return address is VALID but some sites block emails
    with links. Delete this sig when replying.
    Wanted, PCMCIA SCSI Card for HP m820 CDRW.
    FS 500MHz Tek DSOscilloscope TDS540 Make Offer
    Wanted 12" LCD for Compaq Armada 7770MT.
    Bunch of stuff For Sale and Wanted at the link below.
  3. Dave,

    The most drastic solution is is taking the old keyboard, remove its inner
    electronics and build a USB circuit instead. AFAIK Cypress was the first one
    that offered an USB development kit containing a full description of a
    keyboard interface. Others like Microchip and AVR also have micros now that
    support USB. It can't be that difficult. Reading a keyboard matrix is
    amongst the most basic standard applications for a micro and the USB part is
    fully described in the relevant datasheets. But it's a lot of work.

    But what about the Inspiron 8100 keyboard? The "standard" AT-keyboard hardly
    changed since it was introduced by IBM, neither did the protocol. I still
    use a first generation AT-keyboard. A luxuous type that also can be switched
    between PC and AT. The only thing I need is an adaptor for the wide DIN to
    the small PS2 connection. You can find all about both the keyboards and USB
    on the net. Look at
    for instance. So what's the difference between the Dell keyboard and that
    old standard except for the connector? It will be worthwhile to find out
    because translating keystroke codes is much less work then designing and
    implementing the whole of the keyboardelectronics. Besides you don't have to
    destroy the old electronics for it.

    petrus bitbyter
  4. I wouldn't be surprised if the cable coming from a laptop's keyboard is
    essentially a PS/2 interface except with parallel data. I remember looking
    at the one on my laptop a while ago and it had something along the lines of
    11 pins or so - which would translate to 8 data, 1 gnd, 1 vcc, 1 clock.
    Might be worth looking into. Otherwise I'd just reccomend taking the
    electronics out of a full sized keyboard and attaching them to the keyboard
    matrix. Good luck.

    -M. Noone
  5. You mean the 8100, obviously. The 9300 is also a Dell laptop.

    a. I bought the 9300 for its 17" screen among other things.

    b. The 8100's 15" screen would obscure the 20" LCD monitor on my
    desktop. I actually worked that way for a while, with the 8100's
    screen tucked between the bottom of the 21" screen and its base.
    It's kind of a mess.

    c. The idea of soaking that much power continuously just to have the
    8100 act as an expensive keyboard doesn't appeal to me. That said,
    I want to run Linux on it anyway...
    Yep, I'm familiar with VNC.
    Well now, that's starting to sound fiendishly clever. I was going to
    ask how to make the 8100 send USB keyboard signals so I could plug it
    directly into the 9300, but this solution is all done in software.

    Maybe I can find a used Dell with the same keyboard but whose screen
    is smaller and won't be as much of an obstacle.
    Meaning that each key is just a switch that connects a different pair
    of wires on the keyboard cable to one another?
    Well, the one significant issue that still remains is that I want to
    use the 9300 away from my desk (or why bother with laptops, after
    all?), so I still want to get a keyboard I can tolerate into its case.

    Thanks, you've been very helpful!
  6. I was afraid of that.
    Mechanically? Just about everything.

    Electrically? Well, from the articles at the link you cite, it looks
    like the old AT keyboard has some active electronics in it, with a
    serial output interface. I strongly suspect that these laptop
    keyboards are completely passive switch matrices that just complete a
    circuit between different pairs of wires on their connector cables. I
    can see almost the whole keyboard mechanism and there really isn't any
    room for electronics in there.
    I was planning to buy one or two Dell i8100 replacement keyboards for
    this project rather than hack up the one in my old laptop.
  7. I have a box of 50 discarded Dell laptop keyboards downstairs right
    now. I've never seen anything that looked like an IC in any of them,
    so it seems unlikely that there's any encoding going on in there at
    Yeah, but just how to attach?
  8. What I gather from this is that you really like these keyboards. I
    don't know a think about "Inspiron 8100" replacement keyboards,
    though, except that they are for laptops?

    If they are anything like those I find on my IBM A21P laptop, they pop
    out and push back into a system base that is 1/2 of a "clam shell"
    unit. Which means to me that you will need to keep the base of some
    system as your mechanical support. Otherwise, you'd have to
    completely fabricate some kind of comfortable fixture and that sounds
    very difficult to me. So do you already have a base that you can gut
    and use to complete the mechanical whole on which the keyboard unit
    would only a part?
    Does the 9300 offer a "standard" external keyboard connector? If so,
    if you can adapt your 8100 base and keyboard and write the necessary
    micro code so that it behaves as a proper keyboard, you could simply
    connect it as an external keyboard to the 9300. Not that this would
    be as good as replacing the keyboard, itself.

    You mention that the connectors don't match up, but does the 8100
    keyboard mechanically screw down properly to the 9300 system unit?

  9. You catch on fast, my friend ;-)
    Yes. They are a replacement part for the keyboard in a Dell Inspiron
    8100 laptop.
    That's the least of my problems.
    Yes, or I can get one. IBM makes an external keyboard for their
    thinkpads that has the same key layout as Dell laptops, and the
    enclosure should accept whatever Dell KB I decide to stick in there.
    Unfortunately, if it uses the same key *mechanism* as recent thinkpads,
    it's not the one I like right out-of-the-box, so I _would_ have to
    adapt the keyboard.
    Yes, that's part of the plan of course, but when I travel around (the
    house or the country) with my 9300 I'd like the internal KB to be
    comfortable, too.
    Not quite, but the amount of adaptation needed to get it to work would
    be minor.

    Thanks for your reply.
  10. Just trying to make sure I "get it."
    Back to the 8100 keyboard, then.
    Meaning that its keyboard is replaced by an 8100 keyboard, I take it.
    Well, regarding making an 8100 keyboard that would plug into a
    standard keyboard port on a laptop or desktop (non-USB), you certainly
    could make up a circuit for the 8100 and write the software to get the
    job done. An investment, to be sure. But it could be fun. I did
    something like this, many years ago, in adapting an IBM Electronic 85
    typewriter as a printer device, scoping out the reed-relay events when
    I pressed keys on it and developing a schematic and physical circuit
    that I built and attached to it that would accept serial port data and
    type it out as a printer. The software worked great and I used it for
    years. In the case of the 8100 keyboard, you'll need to figure out
    the wires (should be a modest, tolerable effort here) and then
    familiarize yourself with how to scan them properly and handle things
    like n-key rollover, etc. Then write the software to handle the
    keyboard interface you'll also design for it. Work, perhaps. But it
    really sounds like satisfying work.

    I can help inform you about the details of acting like a keyboard.
    There are also docs on the web to help, as well.

    Regarding adapting an 8100 for use as an integral part of a 9300, the
    place I'd start is in figuring out the wiring of the 9300 keyboard
    connector and then also the wiring of the 8100 keyboard connector. I
    suspect that you'll find these to be logically equivalent (as a wild
    guess), though not mechanically equivalent at the connector. If it
    works out that way, you merely need to rewire the connector on the
    8100 so that it actually uses a proper 9300 connector (you'll need to
    find one or scavenge the one on your 9300 keyboard.) Then deal with
    the mechanical vagaries of placing it.

    If it turns out that there is no equivalent remapping of the connector
    wiring, then you may be stuck writing some kind of Windows or Linux
    driver that remaps the received (incorrect) key events into correct
    ones. Even if the key scanning cannot be exactly wired the same, some
    kind of scanning will take place by the existing software that does
    this job so remapping may be all that is needed.

    This assumes, of course, that the 9300 system board does actually scan
    the keyboard. If there is software and intelligence in the keyboard
    itself, there may be further complexities.

    I think you should start, though, by figuring out exactly what the
    8100 keyboard actually does. A lot of "ifs" can be removed from the
    table by knowing more about it. Then figure out the 9300 keyboard,

  11. Seems like my only alternative.
    Actually the 9300 is scanning a similar (but different) matrix and
    doing the rollover support itself, so I doubt I'd have to deal that
    explicitly. I think I'd just need to translate the connectivity of
    the 8100 keyboard into whatever the 9300 expects.
    Yep. A continuity tester should be enough.
    Finding the connector is easy; I have a box of 50 scavenged Dell KBs.
    I put one of the 9300-style connectors on the 8100 KB cable and hooked
    it up, but only a few keys did anything and then they typed the wrong
    characters. So if the wires are equivalent in some way, they're
    Really, that's not a problem. They're the same shape modulo a few
    tabs and other stabilizing details.
    Heh. I'd rather do it in software than in hardware, but since the
    electronics in the computer are probably just detecting *connectivity*
    it seems unlikely to be possible.

    Even if I could write a driver I doubt I'd be able to operate the BIOS
    from the 8100 KB, because the driver wouldn't be loaded yet, right?
    That would be ideal.
    These KBs have no space for electronics. I'm pretty sure they're
    completely passive.
    Makes sense. Thanks for the pointers.
  12. mike

    mike Guest

    David Abrahams wrote:
    If you can get any of the keys to work, you're on the right track.
    Stick your oscilloscope on the connector to determine which are the
    scan output signals. Map out the key matrix on the keyboard. I believe
    that there may be a reasonable pin swapping that can make all the keys
    work. Isn't there a utility built into the OS that lets you remap keys?
    Use that to make the keys to the right thing. But Murphy probably has a
    summer home in your keyboard and you'll have grief with things like
    ctrl-alt-delete and keys that don't map one for one into a function.

    I once built a keyboard for a moving message sign.
    Had to find an XT keyboard that still had a circuit board under the
    keys. Cut a zillion traces and rewired the whole matrix to to what the
    sign needed. This won't work with a plated plastic keyboard.

    Return address is VALID but some sites block emails
    with links. Delete this sig when replying.
    Wanted, PCMCIA SCSI Card for HP m820 CDRW.
    FS 500MHz Tek DSOscilloscope TDS540 Make Offer
    Wanted 12" LCD for Compaq Armada 7770MT.
    Bunch of stuff For Sale and Wanted at the link below.
  13. Hehehehe... haven't seen a sillyscope in years. I have a continuity
    tester at my disposal :)
    I wouldn't know an input from an output. If it's just a switch
    matrix, it's going to connect pairs of wires and there's no particular
    way to tell which are sending and which are receiving... or did you
    mean for me to monitor the signals coming from the laptop's side of
    the connector?
    That would be wonderful.
    Yeah, there's _something_. At least, you can download software that
    lets you do some mapping, so I should be able to figure out how to do
    it myself if necessary.
    Uhh, I dunno about that part. If it's just a switch matrix, the
    keyboard isn't sending scan codes. Seems to me if pins are swapped
    I'm not going to get anything without un-swapping them... or are you
    suggesting that I swap pins until everything does *something*, and
    then straighten out *what* it does in software?

    Might work, but I might just as easily end up with 2 keys typing the
    same character and indistinguishable from the mapper's point of view.
    Could be.
    Probably not. I have plenty of trash KBs to experiment with, though.
  14. Alan Adrian

    Alan Adrian Guest

    On a simular note... I've saved the keyboard out of a Toshiba 286 luggable
    computer... beautiful thing... it even has a keypad on one end... couldn't
    stand to throw it away...

    It's got a 22 pin ribbon cable coming out of it and the only semiconductors
    on it seem to be diodes... (though I haven't looked on the key-side of the
    board, everything sticks through it and is soldered on the back... ahh..
    memories... =)

    I may want to hook this up to a microcontroller one day or something... (I
    play with electronics a bit)... How do I go about mapping this thing out?
    It seems rather tedious hooking a meter up to every two pins, pressing all
    the keys each time, and making notes...

  15. Yeah, this is going to take me forever. I tried, but even getting
    started is so difficult that I can't see my way to the end. It's hard
    to manage the tester leads, and it's an N^2 operation for each key you
    want to test. :(

    I've started trying to hunt down information from the keyboard
    manufacturers, but that seems like a long shot at best. I think the
    9300's keyboard is made by NMB, but they don't seem to want to talk to
    anyone but volume buyers for over 2500 units. I can't find anything
    that looks like a manufacturer name on the 8100 keyboard. :(

    Anyone have a line on schematics or detailed technical specs for these
  16. Alan Adrian

    Alan Adrian Guest

    Funny story... (not)... While doing what you are trying to do... I looked
    through my pile of stuff and found the old motherboard... it had the
    connector on it to match the ribbon that comes out of the keyboard... Great
    I thought... easier to hook my meter up to and work this out.. I determined
    after the last post that it's not impossible as they key order tends to
    "line up" so it's sort of predictable what will be the key to go with the

    Anyways, I got my industrial sized heatgun out and heated the backside of
    the connector till it came out of the motherboard... worked great...

    After it all cooled I connected it up to my ribbon cable and picked up my
    keyboard... which had been laying under my motherboard.... which was now a
    melted piece of slag.... =( been saving it for years meaning to do
    something with it... finally get around to it and wreck it in 2 minutes...

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day