3D Modeling and 3D Printing Nonstandard Keycaps
While working on the design of ErgoStrafer (modeled after the discontinued Merc Stealth), it became abundantly clear that I would need to redesign the keycaps from scratch because the original keycaps were not compatible with MX switches. I reproduced the switches by carefully and repeatedly measuring the original keycaps, generating 3D models of them, and then having them 3D printed. PCBWay graciously offered to sponsor the production of the ErgoStrafer prototypes, including both the electronics and 3D printing. The electronics they produced performed flawlessly, and while I only got to experience a tiny slice of what PCBWay offers for 3D printing, the results are great and I look forward to seeing what other customizations and surface treatments can be done with them in the future.
Measure Twice, Print OnceI started with 2-dimensional measurements of the Merc Stealth keycaps using digital calipers. Many of the keys are either perfectly round or rounded rectangles. However, to create the 3D models, there are numerous three-dimensional details that added to the complexity of the keycaps:
- The concave and convex top surfaces of round keys are difficult to measure precisely
- Rounded rectangle keycaps have either slight curvatures on their top surface, a slightly angled top surface, or a bevel around the edge.
- The red butterfly keys in the center are not basic shapes and collectively share a concave curvature across their top surface
Additionally, each type of key has a different height relative to other keys. Fortunately, the membrane internal to the Merc Stealth keyboard can be represented as a flat plane, so measuring the differing key heights was straightforward (by measuring the bottom of the keycap stem to the top of the keycap).
In total, there are 13 different keycap shapes used in the gamepad layout, but I added a 14th key (the Ctrl key from the main keyboard) at the request of Doug, who commissioned the design of ErgoStrafer.
Don't Go Chasing Butterfly Keys
To capture the shape of the prominently-featured butterfly keys, I took a photo of the original keyboard layout from directly above the keys at a relatively far distance (to minimize parallax distortion). In the photo, I also included the digital calipers to provide a reliable reference for real-world distances. I then imported the image into FreeCAD and scaled it until the measurements on the calipers matched the dimensions used within FreeCAD.
With known-good dimensions in the reference photo, I created a sketch parallel to the image plane and used the spline tools to trace the outlines of each keycap switch individually. Or rather, I traced approximately 1/4 of the outlines because the butterfly keys have a healthy amount of symmetry from left-to-right and top-to-bottom.
For example, with the "s" key, I only traced out the part of the switch contour, and for the rest, I added an equal number of spline control points. Using the sketcher symmetry constraints, I could force the other quadrants to mirror the first portion precisely and then make minor adjustments to ensure the best overall fit to the photo. Similarly, while the top-left "q" key does not have any internal symmetry, it is still a mirror image of the "e" (as well as the "z" key I added).
Once all the butterfly keys were defined in two dimensions, I extruded each of them to an excessively large height. To add the common concavity across all six keycaps, I measured the depth of concavity and added a sketch with an arc matching that curve, and then swept that arc through the keycaps using the Groove tool.
At that point, all the top surfaces of the keycaps were nearly complete, except for the addition of a the small homing bar on the "s" key.
With the keycap surfaces taking shape, I then needed to add the MX-compatible stems. Fortunately, there were other keycaps I could use as a reference, despite finding a few differences between them. Ultimately, the two best resources I found were these:
Unlike downloading STL files from Thingiverse and trying to take measurements of features, the use of SCAD files in these projects for parametric modeling meant that I could open up the SCAD file in a text editor, read through the code, and precisely duplicate known-good MX stem dimensions.
Fixturing and Grouping
3D printing services generally apply a minimum cost per part, so it can be helpful to organize parts together in a single design. This helps ensure that the costs are based on the total mass and print volume of the design, as opposed to incurring a minimum charge. However, the rules governing such groupings vary from supplier to supplier:
- PCBWay has no restrictions concerning how parts are grouped (or at least none that I ran into). I was able to create a thin 2mm plane around the base of all the keycap stems, then open up a circle around each keycap stem, and add 2mm supports back to tie all the parts together. Those supports make it easy to cut out each keycap when the parts get to me.
- JLCPCB imposes several restrictions on how parts can be grouped/connected (which they detail on this dedicated webpage). But here is the summarized version
Overall, PCBWay made it very straightforward to print with whatever I had already 3D modeled, whereas JLCPCB felt like a puzzle to solve to avoid arbitrary rulebreaking and fees. Of course, this tends to mirror how the two companies handle PCBs as well: PCBWay will build whatever you send them, JLCPCB requires you to use parts from the JLCPCB Parts Library (or consignment). There are pros and cons to both approaches. For example, you can get a comprehensive, instant online assembly quote from JLCPCB (because they limit you to their parts library, so they already "know" every part you could use in a design), whereas PCBWay has a person in the loop to calculate component purchase and placement costs. They are just two different-yet-valid approaches depending on your particular needs.
While most of this article focuses on the design of the keycaps, there is an element of the keycaps that impacted the case design: the case had to include a hole for each keycap. To make those holes, I used the original 2D keycap sketches and simply added a second spline just outside of the perimeter of the original keycap. I made sure to include an identical number of spline control points as the switch I was surrounding, and then added a dimension constraint between each of the original keycap control points and the new spline control points. I fixed this dimension to about 1mm for all the control points, and around the edge, and manually ensured that the dimension lines are roughly perpendicular to the original keycap boundary. This new outer line then served as the case opening for the keycaps to protrude through.
After getting the keycaps 3D printed, there are a few things I learned that will impact how I make them going forward:
- It is very important to test the 3D printed keycaps with materials you might want to use. Different material properties and tolerances matter a lot. I used the same 3D models with different materials and observed different results. Some materials were too brittle and would shatter when separating from their groupings, or would crack while being installed onto switches. While the material may still be usable, it would benefit from slightly larger openings and better-placed attachment points.
- Ensure the cruciform (the cross on the bottom of the switches) was cleaned of uncured resin. Most of the parts were completely clean, but there were a few that seemed to be missed during the wash process. Any leftover resin within the cruciform makes it very difficult to install onto an MX switch stem.
- Both PCBWay and JLCPCB warn against including thin features. Be sure you really want to accept the risks instead of modifying the design. Both failures in the above photos located at thin features.
Overall the process went remarkably well. The few (entirely preventable) issues resulted from my own decision deviate from their recommendations, and I have incorporated changes as needed to avoid those issues.
Overall, the process of designing non-standard keycaps for ErgoStrafer and getting them produced went really well, despite the somewhat tedious design process. The resulting parts look good, fit right, and feel great.