T3100/20 USB Keyboard

Keycap Monkey Nightmare

So why embark on such a project, well it's not just because I had this one sitting around needing a purpose. But also my current keyboard a DELL AT102W mechanical keyboard, also very nice to type with. However it has a few problems & needs a potential replacement. Plus the modern mechanical keyboards I have I am not overly impressed with. Some of the issues with it are:
1. It is well used & thus has temperamental keys
2. The caps lock is in a retarded place, next to the A key was never a good idea
3. It is PS/2, while still supported on most desktops, is not supported by KVMs or any laptops
4. It is not from the 1980s, the era when computers were exciting

Alpe's key switches so ya knows it's good. Only discovered this after having out of the machine for a while.

The computers though that do have the best keyboards ever made are the IBM 5150 & the CAF Prolite 286. Both those machines have been restored & have no spare keyboards for a project like this. So he will have to do. The tactical feed back is still very good & miles better than anything you can buy today. Plus it has a sensible layout with caps lock living where the Windows key would on a modern keyboard.

As this project requires using an existing keyboard from a vintage computer a reverse engineering project.

This actually makes it harder than a normal keyboard build as rather than designing the key map like most normal people would do. I take a spare keyboard from a parts unit T3100/20 & try & use that. Luckily I was was able to find the key map layout in the service manual so I printed them off & pasted them in my note book. From those two tables I was able to reverse engineer the pin out.

While it took a good few hours due to parts such as the diodes on each key. I was able to successfully map out the pin out for the keyboard. After the key map was reversed engineered I was able to design the a PCB to convert from the ribbon cable to standard pin headers.

So after the design process it was time to etch.

My current enchant solution, came as a powder I mixed with about a liter of water to make the solution. Sodium Persuifate, Ferricloraide it not the only solution to making PCBs out there.

Don't get this shit on your skin, it will make very unhappy skin.

The solution waiting for the copper clad PCB to etch.

Etching PCBs takes a stupid amount of time, heating the solution up will speed it up but if you don't have a hot plate there is no point as it will cool down to room temperature well before the PCB has etched. Using the gas hob would of been to fierce for it.

The ribbon cable going into the connector & then soldered onto the PCB. Pretty much to convert the ribbon cable to pin headers for connecting to a microcontroler.

Pin headers for the win, good for testing. My logo was also etched onto the PCB as well as a cock, because a every home made PCB needs to have a cock on it.

I made sure to add the pin outs on the PCB so I can always refer to them during the project, nothing worse that a connector or PCB with no pin outs.

The connector that I soldered on broke, so rather than fart ass around & try to fix it. I just soldered the ribbon connector onto the PCB.

So after much deliberating I decided on the microcontroler I was to use, it was the Pi Pico pretty much as it had HID support & had enough I/O for the keyboard. I needed 20 I/O pins. Most like the Pro Micro only had 19 I/O pins. Multiplexing would of increased complexity to much & the original driver chip was a custom microcontroler. 

The pin headers were used so I could easily swap round the pin out for development. This turned out to be a life savior as it was related to fixing an issues later on. Note the colour order compared to the image with the resistor on the Pi Pico.

Coding Rabbit Hole To Hell & Back

So I knew the coding part was going to be an ass. As I have never coded a keyboard of any kind before I was gona have to at least use a library to do the heavy lifting, could probably work out how to do it in hardware though. I first came across ENv-KB, from that I was able to start messing with the key map. However they was a problem that would be persistent. The right end of the keyboard would not work.The rows A, 9 & 8 were not being scanned. After testing the hardware extensively, repaired a few loose connections, bought a few other lines back but not the Persistent Three.

So after giving up with that base which was pretty much ripped from KMK I tried, you guessed it, KMK. This time I had only the raw code i needed to get this bastard working. Still had the dead right end though. SO I mapped out the key map anyway thinking I would figure out the problem later. Well I never did, tyred everything, hardware was good, re-configured the Pi Pico's pins in software, still no dice. SO I gave up with it & moved on.

The is where I tried the Adafruit HID software. Set it up, got the keyboard programmed in, re-did the key map & guess what. The right end of the keyboard was still not working. The Persistent Three struck again. At this point I was very close to kicking the bucket & lobbing the keyboard in the parts bin with the parts Toshiba it's self.

So in one last ditch effort I wondered if it was something to do with how I had wired the keyboard to the Pi Pico, something someone mentioned in the form's made me think of this as I saw a pattern every bit of keyboard software scanned the keyboard matrix the same way. So I wired it in rows, them columns. I also noticed my code on the Pico had not changed much which was a red flag (but that could be due to debugging). Same as the rows & columns being the wrong way round. Anyway once I had it configured & setup in hardware & software again I was able to type on the end right of the keyboard. SO after some messing in the Adafruit library it really did not do what I needed it to do so I went back to KMK

So I went back to KMK & found the keyboard magically worked, something about the pin layout mattered on the microcontroler with how the software was configured. This was quite a surprise as I expected it to not matter as long as you pointed the software at the right pins. Anyway that was the problem. So there was a third time of programming the key map. Then I discovered there was a way of getting the keys to be defined in the right place. That was with coordinate mapping. So I programed the key cap configuration for a 4th time. But at least it was fixed & working. There was a debouching glitch but that was any easy fix discussed below.

So once I got the firmware up & working & configured correctly. I still had an issue, repeated keys further down the array on the zero line of the columns. Witch was an interesting issue. Turns out the solution to the problem was to put a 10K pull up resistor on the zero pin which was GP11. Fixed the problem pretty reliably, might add 10K pull up resistors to the rest of the columns just to be extra safe as microcontroler inputs can be a little fussy.

So here is the working code so far. Still needs the standard indicator status LED's in every keyboard. Aside from that the current tasks still to do are:
1. Status LEDs
2. Keyboard Case
3. Finalizing The Electronics

So I designed & printed the keyboard surround, only took one test print to get right. The second version did require some file-ling to stop it fouling the keys. Due to having an Ender 3 I had to split the print in half to get it to fit on the bed. I was able to get both parts to fit on the bed though.

I also 3D printed some feet. They only needed to be printed once. There were echos of my old GCSE maths coming back when working on the feet. Yes kids some of the stuff you do in GCSE maths is useful in later life, just not every day.

The electronics still needed to be contained. I wanted to use wood for the base as I had it sitting around, but would also look nice in my house as I have a lot of pine & oak furniture. The electronics would get a 3D printed case that would complete the 1980s look of the keyboard.

There is also one other advantage to the wood for a base that I just screwed the keyboard PCB to. It would give the keyboard weight which makes it far more stable than any keyboard I have ever used. The feet worked well. Used super glue to hold them in place while I screwed them in for a more strong hold.

The back case had to be printed in two halves as my bed was not long enough. However it was nothing a bit of superglue & some screws could not fix.

The keyboard over all came out looking really nice & is about the right angle & height for what I like to type. It also has the bonus of looking a bit like a Sinclair ZX Spectrum. So I might print a Sinclair logo for it.

I decided to leave the bottom open for now so I can access everything while I still want to add upgrades. But at least it is in a state where I can use it as a daily driver. Still want to add Status LEDs or a VFD.

The electronics fitted in really nicely, just as I designed them to, although I did have issues with the built in screw holes, nothing a bit of glue & the wrong screws could not fix. There is still space for me to fit other hardware such as LED's & VFD screens.