![]() |
|
|
|||||||
| modifications post your modifications here |
|
This article is an Island. It cannot be linked to using wiki BB-codes.
How to build a USB controller for your keyboard.
Some time ago I've noticed that my IBM Personal System/2 Space Saving Keyboard (or just my "Mini") had a little problem: the controller would heat up during operation, and I feared it could fail some time. So I replaced the original controller with a homebrew USB controller running my custom Keyboard Upgrade firmware. I've done this before for another M, but this time I took some pictures of the progress and documented how I have built the controller. Even though I only needed the controller for a Model M Mini (i.e., no LEDs), I thought it would be a good idea to build one that could also be used in a full-size 1391401, and hence make these instructions more useful for more people. I tested the controller in a 1391403 (which is a 1391401 with the annoying German layout) to make sure it would really fit in there and work as it should--which it does. Since I didn't want to handle chemicals and also wasn't ready to spend serious money on a professionally etched PCB, I used stripboard for making the controller. Unfortunately, stripboards are a mess, so most of this post describes how I treated a stripboard to recreate the design found on this page. Scroll all way down to the end of this post for some notes on "real", etched PCBs. Meanwhile, my industrial gray Model M Mini has arrived, which I am using now instead of my other Mini. I moved the USB controller over to the gray Mini, and this is what it looks like: Must be the most modern industrial Mini in the world! :D Materials and tools Materials used:
Tools used:
(And yes, I am ignoring medieval ways for specifying lengths. This world is metric. Get used to it. ;) ) Build! So, here are the instructions for building a cheap IBM Model M USB controller... Please read the instructions in full length before attempting to build your own. The resolution of some of the pictures below may not be high enough to show all the necessary details. Therefore, I have attached larger versions here and here. First, cut the stripboard into pieces as illustrated on the following picture using a Dremel or a cutter knife (which is harder). It is OK for the bigger pieces to be a tad larger than shown on the picture since the size of the USB board is not as critical. The main board should not be smaller than shown on the picture. If done correctly, you'll end up with four pieces that could actually be used to make two controllers: two bigger pieces with 39x20 holes, and two smaller 19x20 ones. File down one of the long sides of the main board until it fits easily into the tray where the old controller was (don't force it in!), right next to the two poles that hold the controller in its place. Drill the USB board as shown on the next picture. The smaller holes will pick up the USB connector. The bigger holes should fit over the two poles at the gap for the SDL connector so that the board is held in its place just like the old controller was (later, we will attach the USB board to the main board so that they appear as a single board). Make sure to remove enough copper surrounding the big holes so that it cannot eat into or otherwise damage the plastic poles. Again: don't force anything here and make use of your tools! Now as the boards are correctly sized and drilled, cut the copper strips in the red-marked areas as shown below. I used a Dremel for the coarse cuts, and a cutter knife to rework some improperly cut strips. Double-check for shorts with a multimeter. We'll be running wires from underneath the IC socket, so you'll need to make sure that there is enough room to route some wires below the short sides of the socket. (Scroll down a bit and look at one of the pictures with the IC socket soldered in to see what I mean.) My socket had some ridges on both sides standing in the way which I had to remove with a cutter knife like this: That's it for the mechanical work, you may stow away your Dremel now. Heat up your soldering iron and start soldering some wires onto the stripboard as shown on the next two pictures. There are direct connections between neighboring copper strips in the two green marked areas; these are intended and no mistakes. What follows is a list of the wire connections seen on the pictures. Holes are identified using the coordinate system displayed on the pictures; e.g., coordinate 4/9 means row 4, column (or copper strip) 9. Code: Blue White Red Direct The two white wires 14/2-14/13 and 14/4-14/12 need to run around the programming connector that is soldered in later. Hold the 6-pin jumper header at 14/6-14/11 and route the wires around it to get them right; also check out the pictures below. I didn't solder the header in at that point, however, because it would have stood in the way all the time. Next come 8 wires that you'll need to make long enough to "flow around" the IC socket (look at one of the next pictures to get an idea). Hold the socket into its later place--rows 6 and 12 and starting in column 1--to get the lengths right (I didn't really measure their lengths). I've actually made the four "inner" wires a bit too short for this controller, which is why they are sitting rather tight around the socket... Connections: Code: 10/1 - 4/23 10/5 - 4/27 This is a good time to double-check all connections. Are there any shorts? Do the connections work? Any weak solder joints? This is really important--do yourself a favor and don't skip this step. We'll carry on by soldering in the components. I've added the 8 resistors and 3 capacitors for the next picture. No new wires here. Components: Code: Resistors Capacitors Components: Code: Z-diodes Crystal Note that the 6-pin header for hooking up the AVR programmer is not exactly "the standard way to do it"; commonly, 6- or 10-pin IDC sockets are used for this. The six pins on this design, however, connect straight to pins 6 through 11 on the AVR, which is much more convinient on stripboard. Another reason to go with this solution is space: there is not enough room for an IDC socket in this location when putting the controller into a Mini. If you are planning to use your controller in a Space Saving keyboard, then you still must cut the header pins to a shorter length so that they don't make contact with the metal plate of the keyboard assembly! There is really much less vertical space in a Mini than in a full-size Model M. Your best bet is to put the board into the keyboard case and take a good look if the pins are touching the plate when putting in the assembly; cut the pins accordingly while keeping them long enough to make contact with a programming connector. Make sure that the keyboard assembly is really in its place when doing this, i.e., it must be fully inserted and held in its place by the rectangular plastic poles at its top, and not "hang" or be otherwise misaligned. So, most of your controller is ready by now. Solder the USB connector to the USB board, and add four long wires to the copper strips that run to the pins on the connector. The wires will provide the electrical connection between the smaller USB board and the larger main board. Their names are "GND", "+5V", "D-", and "D+", corresponding to the pins on the USB connector. Again, I didn't really measure the lengths of the wires... Also add the thick grounding wire now that will go to the keyboard assembly--I forgot it at first, but added it later. Depending on the type of cable that you are using for this, you may need to drill the hole for the grounding wire a bit larger. Connections: Code: Blue Red White Direct Alright, here is the last step: connect the four wires to the main board. This picture also shows the grounding wire that I have added a bit too late (at hole 10/7): Connections: Code: Blue Red White Well done! The hardware is ready to be programmed now. Here is the pinout of the programming header on the controller. Your AVR programmer will likely have a 6-pin or a 10-pin IDC socket, or both. Build an adapter cable according to one of the following pinouts in order to program the AVR on the controller. Do not plug the controller into your computer's USB plug when attaching the programmer to the programming header! Code: 6-pin at | header pin on 10-pin at | header pin on This is my cable: A bit rough--I know you can make a nicer one! :) If you don't want to make an adapter cable, see here for a "quick how-to guide on making ultra-simple development boards for programming AVR microcontrollers". Really simple, and saves you from building a custom cable. Note: you should probably add a 12 MHz crystal oscillator and two 22 pF capacitors to the board (in the same places as on the keyboard controller) so that the AVR would still work after programming its fuses to actually make use of an external crystal oscillator... Jumpers There are three jumpers on the controller, in columns 28, 29, and 30. For normal operation, all of these should be left open. Only one of the jumpers is used by the firmware at the moment, called KM0 (for Key Map 0), located in column 28. Closing KM0 forces the controller to use its built-in QWERTY key map. Use this in case you have activated a broken key map and cannot switch back to a good one anymore. Programming the boot loader and firmware The AVR needs, to the very least, a boot loader so that the main firmware can be programmed from your computer via USB. Firmware and boot loader images can be downloaded from http://sourceforge.net/projects/kbup...files/Firmware, sorted by keyboard model and AVR type. Choose the 1391401 version for a 1391401, and the 1392934 version for the Mini; the latter simply lacks LED and numpad support. There is a file called file_id.diz in the zip archives that documents which values your AVR's fuses must be programmed to for the particular firmware. After programming the low and high fuses, write the boot.hex image to your AVR. You need to do this only once and not again for later updates. Then, program the main.hex image to the AVR, and lock the boot loader by programming the lock fuse to the value given in the file_id.diz file. Note that for updating the firmware or uploading alternative key maps via USB you'll still need to build the corresponding tools from the sources for now. I do not have pre-compiled binaries of the required tools right now (too much extra work to keep them up-to-date for multiple operating systems and package management systems). Maybe I can build them for you on demand. If you prefer to build the firmware (and tools) from scratch, you can download source tarballs from http://sourceforge.net/projects/kbupgrade/files/Source or pull the latest sources from GitHub at http://github.com/rhomann/kbupgrade. Follow the instructions given in the INSTALL file. That's all. Put your new controller into your keyboard and stow away or sell the original controller. :) Plug in, and it should be recognized as a generic USB keyboard. For more documentation, read the INSTALL file from the firmware sources (yes, the docs should be split somehow). Have fun! But wait! Look at all those wires! I don't wanna mess with stripboards! If you prefer an etched PCB and are able to produce one by yourself, you may want to take a look at either Dulcimer or RUMP. The relevant files are also found in my source tree. Both of the designs are compatible with my firmware, but only the Dulcimer design incorporates a connector for the LEDs. Note that both designs were made with a full-size 1391401 Model M in mind, which has significantly more spare space than a Mini, especially in vertical direction. If you are planning to build a controller for your Mini using one of these designs, then double-check that it will fit into the keyboard and that no component will touch the metal plate! Programming works just like with the stripboard version, of course.
|
| Bookmarks |
| Article Tools |
| Search this Article |
Posting Rules
|