IFo's MX Keyboard Design Tips & Tricks Thread
Posted: 26 Apr 2021, 04:58
Keyboard case and PCB design and modding tips and tricks I've learned with time, either from experiences or from other people.
A bit of terminology first:
- A unit (written as 1u) in terms of keyboards refers to the distance between two switches (measured from their centers), as well as keycap sizes. 1u is 19.05mm / 3/4" / 0.75".
- The cutout in a plate, for an MX type switch is a 14mm square for a regular switch cutout. Stabilized keys and cutouts that allow you to open the switch without having to de-solder it (for non-hotswap boards) are slightly different (although the 14mm square can easily be spotted in their design so you can still use that for centering).
- The actual size of a keycap of certain amount of units is less than those units multiplied by 19.05. A 1u keycap's actual size is more like an 18mm square (this is a back of the envelope measurement and varies between keycap profiles. However, this isn't meant to give you the actual size of keycaps, but give you a good understanding of what the units are and aren't and so the formulas later make sense).
- So what do those units actually measure and why should we care?
- When you have two adjacent switches on which you want to put keycaps of unit size of Xu, you place them them Xu units apart (measured from their centers). This ensures there is enough space between those two switches to press the keycaps without them interfering with one another.
- If you have two adjacent keys and you want to use keycaps of the same unit size on each, the center distance between the two should be that same unit size.
- So for two 1u keys (switches that are 1u apart and/or on which you want to use 1u keycaps) you place them 1 * 19.05mm apart (measured from their centers). 2u keys? 2 * 19.05mm center to center. 1.5u keys? 1.5 * 19.05mm apart center to center.
Disclaimer: There are some keyboards made by enthusiasts (and probably some commercial ones) that don't use the units and have just positioned keys by eye. Please, don't do this! It makes it harder for people to later design plates and PCBs for your keyboards. Make KLEs, etc.
1. To calculate the center distance between two keys of different units, use the following formula: ((Xu + Yu) / 2) * 19.05mm.
Example: If your left key is 1.75u and your right key is 1u, this becomes ((1.75 + 1) / 2) * 19.05 = (2.75 / 2) * 19.05 = 1.75 * 19.05 = 33.3375mm apart measured from their centers. If you need the center to center distance in units, not in millimeters, don't divide it by 19.05.
I have intentionally placed brackets in more places than they are needed in the calculations, just to make things clear.
If the formula doesn't really makes sense to you - don't worry. It took me awhile to get it either. Also, feel free to ask me for an explanation.
Thanks to j`ey on Freenode for teaching me this formula back in the day.
2. If you want to design for stepped key(s), to calculate the center distance between the stepped key and its adjacent non-stepped key add 0.5u to the size of the key(s) you want to be stepped, then use the formula above.
Example: The famous stepped Caps Lock. You want a 1.75u stepped Caps Lock and a 1u A key to its right. Add 0.5u to the Caps Lock size, essentially treating it as if it's a 2.25u key and then use the formula above. That's because the center stem of a stepped keycap for a certain size key is 0.5u to the left than on a non-stepped keycap of equivalent unit size.
If you have two adjacent stepped keys, use the regular formula to calculate their center distance. The stems of both are by 0.5u to the left, so the distance between them isn't changed.
To those curious how I found that out:
- I created a KLE of a 60% board without stepped keys, then using the raw data, I exported an SVG using swillkb's builder.
- Then, I created a second KLE with the keys stepped, exported SVG again.
- I measured the center distances between the non-stepped mod keys and the adjacent non-stepped 1u keys
- Then, I measured the center distances between the stepped mod keys and the adjacent non-stepped 1u keys
- Used the formula I'll post below (essentially the opposite of the formula above) to find out what keys create that center distance and saw that all of the stepped keys have their center 0.5u more to the left than their non-stepped counter part.
3. If you have a center to center distance, where the distance is Xu, to calculate the keys making up this distance, use the following formula: If the distance is in millimeters, first divide it by 19.05 to turn it into units. Then, the formula is: Xu * 2 = Yu.
Example: If you have 30.95625mm, 30.95625 / 19.05 = 1.625u. Then 1.625 * 2 = 3.25u.
Now, if you know the sizes of one of the keys for that center distance (like I know the right key in my case is 1u) subtract it from the result above and you get the size of the other key. In my case, that leaves me with the left key being 2.25u (or a stepped 1.75u key).
If you don't know however, you can either assume that distance is created by 2 keys of the same size, which is equal to their center distance (Remember? two 2u keys have a center distance of 2u, two 1.25u keys have a center distance of 1.25u) or knowing standard key sizes are 1u, 1.25u, 1.5u, 1.75u, 2u, 2.25u, 2.75u, 6u and 6.5u (with keys of other sizes being more rarely seen) you can start subtracting each of those keys from the center distance to see if the result is a common size key.
Over time, I'll post new tips as comments, then edit this post to include them
Last Updated: 11:50AM on 27th of April 2021
A bit of terminology first:
- A unit (written as 1u) in terms of keyboards refers to the distance between two switches (measured from their centers), as well as keycap sizes. 1u is 19.05mm / 3/4" / 0.75".
- The cutout in a plate, for an MX type switch is a 14mm square for a regular switch cutout. Stabilized keys and cutouts that allow you to open the switch without having to de-solder it (for non-hotswap boards) are slightly different (although the 14mm square can easily be spotted in their design so you can still use that for centering).
- The actual size of a keycap of certain amount of units is less than those units multiplied by 19.05. A 1u keycap's actual size is more like an 18mm square (this is a back of the envelope measurement and varies between keycap profiles. However, this isn't meant to give you the actual size of keycaps, but give you a good understanding of what the units are and aren't and so the formulas later make sense).
- So what do those units actually measure and why should we care?
- When you have two adjacent switches on which you want to put keycaps of unit size of Xu, you place them them Xu units apart (measured from their centers). This ensures there is enough space between those two switches to press the keycaps without them interfering with one another.
- If you have two adjacent keys and you want to use keycaps of the same unit size on each, the center distance between the two should be that same unit size.
- So for two 1u keys (switches that are 1u apart and/or on which you want to use 1u keycaps) you place them 1 * 19.05mm apart (measured from their centers). 2u keys? 2 * 19.05mm center to center. 1.5u keys? 1.5 * 19.05mm apart center to center.
Disclaimer: There are some keyboards made by enthusiasts (and probably some commercial ones) that don't use the units and have just positioned keys by eye. Please, don't do this! It makes it harder for people to later design plates and PCBs for your keyboards. Make KLEs, etc.
1. To calculate the center distance between two keys of different units, use the following formula: ((Xu + Yu) / 2) * 19.05mm.
Example: If your left key is 1.75u and your right key is 1u, this becomes ((1.75 + 1) / 2) * 19.05 = (2.75 / 2) * 19.05 = 1.75 * 19.05 = 33.3375mm apart measured from their centers. If you need the center to center distance in units, not in millimeters, don't divide it by 19.05.
I have intentionally placed brackets in more places than they are needed in the calculations, just to make things clear.
If the formula doesn't really makes sense to you - don't worry. It took me awhile to get it either. Also, feel free to ask me for an explanation.
Thanks to j`ey on Freenode for teaching me this formula back in the day.
2. If you want to design for stepped key(s), to calculate the center distance between the stepped key and its adjacent non-stepped key add 0.5u to the size of the key(s) you want to be stepped, then use the formula above.
Example: The famous stepped Caps Lock. You want a 1.75u stepped Caps Lock and a 1u A key to its right. Add 0.5u to the Caps Lock size, essentially treating it as if it's a 2.25u key and then use the formula above. That's because the center stem of a stepped keycap for a certain size key is 0.5u to the left than on a non-stepped keycap of equivalent unit size.
If you have two adjacent stepped keys, use the regular formula to calculate their center distance. The stems of both are by 0.5u to the left, so the distance between them isn't changed.
To those curious how I found that out:
- I created a KLE of a 60% board without stepped keys, then using the raw data, I exported an SVG using swillkb's builder.
- Then, I created a second KLE with the keys stepped, exported SVG again.
- I measured the center distances between the non-stepped mod keys and the adjacent non-stepped 1u keys
- Then, I measured the center distances between the stepped mod keys and the adjacent non-stepped 1u keys
- Used the formula I'll post below (essentially the opposite of the formula above) to find out what keys create that center distance and saw that all of the stepped keys have their center 0.5u more to the left than their non-stepped counter part.
3. If you have a center to center distance, where the distance is Xu, to calculate the keys making up this distance, use the following formula: If the distance is in millimeters, first divide it by 19.05 to turn it into units. Then, the formula is: Xu * 2 = Yu.
Example: If you have 30.95625mm, 30.95625 / 19.05 = 1.625u. Then 1.625 * 2 = 3.25u.
Now, if you know the sizes of one of the keys for that center distance (like I know the right key in my case is 1u) subtract it from the result above and you get the size of the other key. In my case, that leaves me with the left key being 2.25u (or a stepped 1.75u key).
If you don't know however, you can either assume that distance is created by 2 keys of the same size, which is equal to their center distance (Remember? two 2u keys have a center distance of 2u, two 1.25u keys have a center distance of 1.25u) or knowing standard key sizes are 1u, 1.25u, 1.5u, 1.75u, 2u, 2.25u, 2.75u, 6u and 6.5u (with keys of other sizes being more rarely seen) you can start subtracting each of those keys from the center distance to see if the result is a common size key.
Over time, I'll post new tips as comments, then edit this post to include them
Last Updated: 11:50AM on 27th of April 2021