25 June 2021

Extended 10-key Keyboard

I wanted the extended 10-key (or numpad, same thing) keyboard kinda badly with the influx of MCU projects, and because it wouldn't be too worthwhile to try to do it with reed switches like I wanted (considering I still have to design the new mechanism and figure out how to get them made), I went with the good ol' Cherry MX switches. I forgot how I had the layout for the reed switches planned (forgetting that it was in the backlog for this blog), so I went and created a new layout. Seems like the reed switch layout doesn't add too many keys while the new one I made adds much more.

The new layout. More on how I made this image later.

I did get shift and tab where I originally had planned, since the point of having shift on the opposite side of enter is to be able to move upward in a spreadsheet, but couldn't remember anything else, so I thought about the keys that would be most convenient to have. I also wanted the four "extra" keys that my keyboard has because I plan to eventually shift to a 80% (or ten-keyless, TKL) keyboard and don't want to lose those keys. For EAGLE, I usually have my right hand on the trackball and use my left hand for numeric entry when I need it, so the other feature I wanted was to be able to solder a mirrored version from the same board. I also wanted backlighting since I think I already had the NeoPixel Nano 2020 RGB LEDs for the Powermate, and the datasheet gave me the dimensions of the LEDs, which I used to confirm that they would fit in the hole in the bottom part of the Cherry MX RGB switch shell.

The board does extend beyond EAGLE's free user boundary, but because the board files are just fancy XML files, I had quite a few things that I had to place by editing the file that way. Because of the extra space between the Fn4 and Backspace keys due to the Backspace key being two keys wide, I decided to put the USB mini-B jack there, and the MCU (ATSAMD21G18A-A) close to it. The LEDs were placed, but the voltage in (VDD) stayed unconnected to the board because I wasn't sure if I was going to power them with 3.3 or 5 volts, and I was somewhat concerned with the theoretical draw of 1.044A (5 volts) at full brightness white. I went and made a test board for the 29 LEDs and did what I could to make it as small as possible to keep the cost down. Because of the odd number of LEDs (29), I decided concentric circles would be the best pattern to use, and laid some circles and lines down to help me position the LEDs. The outer ring has 16 LEDs, and I had to tinker a bit to get those reference lines drawn.

The equations used, jumper part number as a reminder, and the board.

After getting the board made (with other boards, etc, etc, etc.) and in-hand, I soldered the LEDs on starting from the centre and working my way around the ring before working outwards. For testing, I think I just had the script go to full brightness white immediately, and on 3.3 volts, the 3.3 voltage regulator browned out and reset due to it only being able to provide 600mA. 5 volts was fine, but I was too dazzled with how bright it was to realise that I wasn't supposed to leave it on for very long, and when I touched the board for whatever reason, it was pretty hot. I immediately unplugged it and shook it off a bit to cool it off, and when I went to connect it all again to check the LEDs, two of the LEDs had burnt out (centre and one next to centre). I went to replace them and started with the centre one, and I decided to double-check which of the ones next to the centre one was dead, but it turned out that I didn't need to replace it. I dunno if I really needed to replace the centre one, and I should've checked since it was annoying to get the centre one off (I used a razor to get under the LED along with large blobs of solder, I think). I had originally thought to use the test board as a sort of flashlight (sometime between when the board was designed and before the test) when I was done using it for testing, but easier said than done when I'd have to figure out how to sink or dissipate all that heat.

For the top row of keys, I did my best to measure the distance between the keys on my keyboard and got about 1-1/64 inches (closest value was in inches, I would've used millimetres otherwise), and used that for the top row distance. I was going to need a custom plate done and really didn't want to use Front Panel Designer because I'd have to draw and lay everything out. Some searching brought me to http://builder.swillkb.com/ which was a little confusing to use until clicking the circled question mark icons. The first field is for the layout from http://www.keyboard-layout-editor.com/ which I played around with to get the layout (as seen in the first image of this post). (Later I found out the layout editor doesn't like my "non-standard" spacing value, and just says to select a valid value within a tooltip with the closest two values, but it doesn't seem to care otherwise.) Anyway, I took the layout's raw data back to the custom plate builder thingy and had to poke around with the settings and guide to get the top plate, but the DXF turned out weird when I downloaded it. I was trying to double-check the dimensions in CAD, but it proved to be weird because I didn't understand the kerf setting that was being automatically applied when I hit the "Order from lasergist" button. (I think I did a bit of drawing in Fusion 360 to confirm kerf? I don't remember now, but I did eventually get my head on straight to understand kerf.)

I left it alone since I didn't really want to deal with it, since I think I was having troubles getting holes for mounitng, but I was able to get them a different way when I tried sometime later, though I had to play with the settings to get the holes where they should be. I think I checked with CAD again and called it good enough (I still wasn't getting the kerf thing), and made notes of the settings so that it'd be less stuff to remember when I go to actually order the plates.

Because there's seven keys that are two-wide, I needed stabilisers, but had nothing to go off of. I think it was when I was digging for stabilisers when I came upon a PDF file that Digi-Key happened to have that had quite a bit of info on the Cherry MX switches. I saved this goldmine of a PDF because it provides more info than Cherry does nowadays (I think I ignored the stabiliser part numbers in the PDF because the PDF seemed kinda old and I didn't know how trustworthy those part numbers would be because of it) and there was no telling when it might disappear from Digi-Key's servers. Anyway, I found some stabilisers that seemed to be cheap enough and seemed to be the plate-mounted stabilisers that I needed (there was only two images and it was hard to tell anything because the parts are black plastic), and I ordered twenty-one of the stabilisers. When I got them, it didn't seem right, and when poking around with them, I found out they were PCB-mounted stabilisers. Since the store had a no returns policy (yay small operations specialty stores), I had no choice but to eat the cost. I did end up finding a few places with the plate-mounted stabilisers, but the prices were more than the PCB-mounted ones that I had bought. The store with the best price because of a quantity discount had the highest shipping cost because the store's in Taiwan. Sure, I could make the shipping more reasonable by buying more (or by buying the parts separately in bulk), but I didn't want even more stabilisers sitting around. I held onto the next cheapest place (that sells them singularly and not in sets that include a spacebar stabiliser) as I decide to give the part number from the PDF a shot. And it was a good thing that I did, because I think the search gave me a result from Allied Electronics (which I bought some Cherry MX switches from before for the original spring mod) and I think also Digi-Key. Digi-Key has it as a non-stocked item, so I saved Allied as I went to Mouser to see if they had it, and though they did have it as well, it was non-stocked. What was curious with the result is that there was another result that was the part number without the dash that was in-stock, but because it (as well as the full-hit result) had no images, it was hard to say if it was the stabilisers or not, especially when it's listed as "Switch Hardware 1x2 KEYCAP W/FRAME" with "CHERRY" as the manufactuer (the full-hit result is listed correctly).

When I was ordering stuff from Mouser (I think the stuff for the other MCU projects that was in-process), I went ahead and ordered twenty-one of the item that should be the stabilisers, and since it was 0.18 USD each, it was a cost easier to eat if it wasn't (Allied's price for them was probably about 0.26 USD each, so Mouser would be cheaper if it was right). When I got the parts, I think I went straight for the item, and gloriously, it was the plate-mounted stabilisers that I was looking for. With the confirmation of the correct stabilisers, I ordered the top and bottom plates from Lasergist through the custom plate builder site. (Link to the plate-mounted stabilisers at Mouser for those that want it.)

While I did get an order confirmation from Lasergist, I never got a email that it was shipped, so it ended up just appearing with the post. I had ordered 3 copies of the top plate (that holds the keys and stabilisers) and the bottom plate (which acts as the base) in the shiny 304 stainless steel option (I could only select shiny or brushed stainless steel), and the plates were heavier than I expected (to be fair, the bottom plate is literally just a sheet of steel with four holes and rounded corners).

Lasergist inner packaging (and part of my keyboard).

Is this how you use iFixit's metal spudger?

The plates freed from the packaging, and the front and back of the top plate to show the burrs from the laser cutting.

I was going to sand blast the plates myself, so there wasn't a point to selecting the finish when ordering. Though now that I think about it, I was thinking about using Lasergist's ordering system instead to be able to have both sides brushed, but it ended up costing more than if I ordered through the custom plate builder site. I forgot about laser cutting leaving burrs (though lasergist did clean up the top side and polish it), so I had to buff those out, and because I had never worked with 304 stainless steel, I had no idea what to expect. It wasn't as bad as I thought it might be (I just started with one top plate to see how it would go), and I went to grab two bottom plate and another top plate to do. Sandblasting is where it really showed how the metal is, where it seemed to be slightly harder than aluminium but softer than the steel I've sandblasted at work.

Bottom of the top plate after buffing, top plate after sandblasting, bottom of the bottom plate after buffing (scratches were pre-existing), and bottom plate after sandblasting.

Why two? Because I was waiting on a friend (different friend than the Powermate one) to say whether they wanted to keep the shiny finish or if they wanted it sandblasted. Eventually, I kinda made the decision for them and sandblasted them anyway.

Post-sandblasting of the bottom plate. I wore gloves to not put finger oils on it since it's not mine.

Back when I got the plates, I realised that I made a mistake in the PCB design because I had arranged all the switches to have the LED above (y-axis) the switch, so for the keys that are 1×2, there was nothing there to hold the switch to the plate. While it technically is fine to have the switch legs to hold the switch to the PCB, I preferred if the plate holds the switch instead, so I had to turn them whichever way would keep the increase in board size to a minimum (90° clockwise). I also realised that the stabilisers pretty much meet with the PCB (even for being plate-mounted), so I had to draw a mockup footprint to know what I would need to move. After the info from test with the LEDs, I was able to connect the LEDs' VCC to 5 volts in the airwire and be able to run the rest of the traces. Oh right, I also used some polygon pours to connect the 5-volt from either of the USB mini-B jacks, and I had adjusted the design rule to tent minimally-sized vias. There's also a spot for a probe pin that would contact the bottom of the top plate, and a 1MΩ resistor between that and ground to help with ESD (maybe overkill, I dunno). I also did some ground-plane via stitching to help make a direct path from the switches or LEDs to the ground pad of the USB jack.

This screenshot is as good as it gets, sorry.

For the keycaps, I was thinking of buying a set of keycaps for a full keyboard and using some of the keys to fill out the standard numeric pad while using some letter keys for home and end (I had spent time figuring out what to use, and came up with either I, O, or P for home and L for end), and then getting some coloured blank keycaps from WASD Keyboards to fill in the rest. The main problem with this is that I end up with a bunch of unused keycaps at the benefit of having the standard numeric pad labelled, and though the blank keycaps are a little pricey, it is still a cheaper idea. At some point I found that WASD Keyboards sells a kit of their blank keycap colours, so I went ahead and ordered one because it was cheap and I didn't know how much to believe the images on their site. There was some differences (which I reported to my friend that just wanted all-blank keycaps to make it cheaper), but with the keycaps in hand, it was a little easier to imagine. I used the layout editor to kinda build a colour layout, and I forgot how I decided to try the keyboard customiser on WASD keyboards, but I was able to get their colour lineup from it, which seems to have changed a bit since the layout editor was created. (Along with the colours, some of the colour names on the layout editor are wrong, which I also reported to the friend.) Anyway, I wanted to have the 10-key area all one colour so it stood out, and then have all the added keys different colours.

The layout I decided on (unless I change it).

Oh right, the control and shift keys give some additional layers to the four function keys. I haven't been able to do much else (I don't want to order the keycaps yet, since shipping would be cheaper if I ordered mine and my friend's keycaps together) since the bloody silicon shortage, so the project's at a standstill until I get the three ATSAMD21G18A-A that I would need. I'm also wanting to look the board over again before I send it to OSH Park because I don't want expensive mistakes; yes, I could order from somewhere else, but my friend likes purple colours and OSH Park seems to have the best rating for quality compared to other PCB manufacturers that Manufacturing Reports has reviewed (this is the place where I found the "mouse bites" comment for OSH Park boards). I could get the bootloader and CircuitPython built for the board, but there's really no point until I have the boards ordered at the very least. There's probably some stuff I forgot to talk about, but I've been typing for too long.