tp-mk.md (18567B)
1 --- 2 title: "DIY Trackpoint Mechanic Keyboard" 3 date: 2019-09-09 4 tags: tech electronics mechboard thinkpad diy 5 categories: tech 6 --- 7 8 ![finish](/img/posts/tp-mk/finish.jpg) 9 10 I've used a mechanical keyboard for many years now. I currently own a 11 tenkeyless layout, even though as a programmer I almost never use the 12 arrow cluster or function row, so I to try the much more compact 60% 13 design. I also no longer care for the Cherry MX blue switches on my old board 14 since they are quite loud, so I went with MX clears instead in this new design. 15 16 I have also owned many ThinkPads to use in conjunction to my desktop's 17 mechanical board. While ThinkPads have, in my opinion, the best laptop 18 keyboards, they are still nothing compared to a good mechanical keyboard. While 19 I could just use a regular mechanical keyboard with my laptop when needed, all 20 mechanical keyboard's I could find are missing an important part of the 21 ThinkPad's keyboard, the trackpoint. 22 23 It because of these unique requirements that I decided to try and build my own 24 keyboard. I've done plenty of small electronic projects before and thought it 25 would be fun to attempt this new one. It also allows me to configure everything 26 about this keyboard the exact way I want it. 27 28 Since I need to include a trackpoint stem in the middle of the board I also 29 choose to go with hand wiring a board instead of printing a custom PCB to 30 solder the switches onto. Since I have much more soldering experience than PCB 31 design I didn't think this would be too much more work and allows much more 32 flexibility. I sure you could somehow fit a trackpoint to a PCB it would require 33 much more work than I'm willing to give. 34 35 After doing some research on what others have done in the past to install 36 trackpoints to their boards I found the best method is to simply savage an old 37 trackpoint from an existing ThinkPad keyboard. This way a lot of the hard work 38 and coding is already done for you, you just need to adapt it to work in your 39 board with your microcontroller. I found an old IBM ThinkPad's replacement 40 keyboard for cheap on eBay, but there are many others you can find if you get 41 creative and look hard enough. 42 43 ## parts 44 45 ![kb-parts](/img/posts/tp-mk/kb-parts.jpg) 46 47 * [60% plastic case][2] \$15 48 * [60% aluminium plate][3] \$20 49 * Cherry MX Switches *x61* ~\$70 50 * Cherry MX Keycaps *x61* ~\$50 51 * [MX Stabilizers][5] \$7.99 52 * [Through hole diodes][4] *x61* \$6 53 * [22 AWG Wire][6] 54 * [Teensy][7] 2.0 or 3.2 55 * USB cable (micro or mini) 56 * Trackpoint module ~\$15 57 * 1 kΩ Resistors *x5* 58 * 100 kΩ Resistor *x1* 59 * 4.7 kΩ Resistors *x2* 60 * 2.2 μF Capacitor *x1* 61 * [30 AWG wire][10] \$30 62 * Shrink wrap 63 * [Perfboard][11] 64 * [Standoffs][9] *x5* 65 * Trackpoint stem (be creative) 66 67 [2]: https://sentraq.com/products/plastic-60-case 68 [3]: https://sentraq.com/products/60-aluminum-plate-1 69 [4]: https://www.amazon.com/gp/product/B06XB1R2NK 70 [5]: https://sentraq.com/products/cherry-stabilizers 71 [6]: https://www.amazon.com/dp/B01LH1FV0Y/ 72 [7]: https://www.amazon.com/dp/B015M3K5NG/ 73 [10]: https://www.amazon.com/dp/B01CK9GZV6 74 [11]: https://www.amazon.com/dp/B019Q0ZTJ6 75 [9]: https://www.amazon.com/dp/B07GGJ4YLC/ 76 77 ## tools 78 79 * Hot glue gun 80 * Soldering iron 81 * Solder 82 * [Wire strippers][15] \$21 83 * Needle nose pliers 84 * Philips screwdriver 85 * Multimeter (optional) 86 * Alligator clips (optional) 87 88 [15]: https://www.amazon.com/dp/B000XEUPMQ/ 89 90 ## steps 91 92 ### 1. cut aluminium plate 93 94 ![plate](/img/posts/tp-mk/plate.jpg) 95 96 The first modification needed to support the trackpoint is to cut the metal 97 plate used to hold the keycaps. This makes room for both the trackpoint's stem 98 and the 5 spacebar keys (2 spacebars surrounding the 3 mouse buttons). You can 99 see where I made the cuts in read above. You have to be careful not to cut too 100 much off, comprising the plates structure, while still making enough new room 101 for the stem to move freely and the new keys to fit straight. 102 103 ![plate-cut](/img/posts/tp-mk/plate-cut.jpg) 104 105 Shown above is the plate after the careful cuts. The right side of the spacebar 106 didn't turn out super straight so the far key ended up a little crooked, but 107 can't be noticed once the keycaps are placed. 108 109 ### 2. insert switches 110 111 Place your choice of mechanical switches into the cut plate, I went with Cherry 112 MX clears. You might need to use some hot glue to hold the new spacebar keys 113 in place depending on how straight and tightly you cut. Because we are 114 hand wiring and not using a PCB to firmly attach the switches, hot glueing all 115 the switches could be a good idea to make it more sturdy and easier to remove 116 keycaps without pulling the switch out by mistake. 117 118 It might also be wise to add the key stabilizers at this step but I forgot 119 this. You can add them later after everything is soldered but it is not as 120 easy. 121 122 ![switches](/img/posts/tp-mk/switches.jpg) 123 124 ### 3. solder rows 125 126 #### a) prepare diodes 127 128 ![diodes](/img/posts/tp-mk/diodes.jpg) 129 130 Cut off enough diodes from the bundle for the first row being soldered. With 131 this strip you can bend them all 90° at once on the anode side (side without 132 black or grey marking band), about a millimeter from the base. This joint is 133 where they are soldered onto the switches pin. By doing this at once they will 134 look more uniform in the finished product.It's important which side you bend 135 since the purpose of a diode is to act as a one way value, so if it's facing the 136 wrong way its not going to work. 137 138 #### b) place solder globs 139 140 ![switch-solder](/img/posts/tp-mk/switch-solder.jpg) 141 142 To prepare soldering the diodes, place a small glob of solder on the top 143 left pin of each switch. I salvaged some of these switches from an old keyboard 144 so the image above shows some additional left over solder. 145 146 #### c) attach diodes 147 148 ![switch-diodes](/img/posts/tp-mk/switch-diodes.jpg) 149 150 Use the pre placed glob to quickly solder the bent diodes down the row to all the 151 switches. An additional bend is then made on the cathode side near the bottom 152 of the switch so it can reach the next diode when they are linked in the next 153 step. There should still be enough overlap so you 154 don't have to solder the end to the bend, around 2-3 mm worked for me. 155 Before moving on you should use the wire cutters to trim to anode as to 156 clear up some space. 157 158 #### d) link diodes 159 160 ![diodes-linked](/img/posts/tp-mk/diodes-linked.jpg) 161 162 Lastly connect all the diodes in each row with a bit of solder. You might have 163 to use some of that 22 AWG wire to extend the diodes if they don't reach 164 between the longer keys. 165 166 ![diodes-side](/img/posts/tp-mk/diodes-side.jpg) 167 168 Black wire extenders: 169 170 ![diodes-extend](/img/posts/tp-mk/diodes-extend.jpg) 171 172 #### e) repeat 173 174 Repeat steps (a) through (d) for all the rows 175 176 ![diodes-done](/img/posts/tp-mk/diodes-done.jpg) 177 178 179 ### 4. solder columns 180 181 Now that the rows are completed it's time for the columns. The 22 gauge wire is 182 used to connect the switch's right pins downwards. The easiest way to do this is to cut a 183 long wire to span the entire column with a bit left over. Simply use wire 184 cutters or a blade to slice the insulation at each pin and push the insulation 185 down before soldering. Leave enough wire at the end to attach the columns 186 directly to the microcontroller in the next step to reduce soldering. In 187 hindsight I could have left the extra wire at the top where the controller is 188 located but either way works. 189 190 ![columns](/img/posts/tp-mk/columns.jpg) 191 192 I used alternating colored wires to make connecting to the microcontroller more 193 organized. If you are constructing a staggered layout keyboard like me you 194 might not be able to connect every key to a complete column, I had two keys in 195 the upper left and one in the bottom right as you can see. You can get creative 196 with how you wire it, making a new short column like I did with the left two 197 switches, or attach them to existing short rows like the bottom key. You just 198 need to keep in mind that no two keys can be on the same row and column, 199 because otherwise they would appear to be the same key. 200 201 ### 5. wire the microcontroller 202 203 With these newly soldered columns and rows it's time to connect them to the 204 microcontroller. First I connected the columns to the digital pins on the 205 Teensy board, I had to resolder a lot of new wires onto the ends since I didn't 206 leave enough room or couldn't bend it fully. I realized halfway through that 207 you didn't actually need to solder the connecting wire to the end of the 208 columns like you need to with the rows, so I could have simplified it. 209 210 To connect the rows new wires are attached with different colors to make it 211 easy to wire and trouble shoot. 212 213 ![teensy-wire](/img/posts/tp-mk/teensy-wire.jpg) 214 215 ### 6. attach pull up resistors 216 217 Depending on the microcontroller you are using you might have to manually add 218 pull up resistors to any of the input pins. Many microcontrollers do this for 219 you, such as most Arduino boards. I found out the hard way that the Teensy 3.2 220 does not. These resistors have to be added to each of the input rows connecting 221 them to ground, luckily because of the design of the matrix only 5 resistors 222 are needed for the 5 corresponding inputs at each of the rows. 223 224 ![pullup-resistors-upper](/img/posts/tp-mk/pullup-resistors-upper.jpg) 225 226 If I had know this about the Teensy before hand I would have probably come up 227 with a better way then just adding the resistors free standing last minute. 228 229 ![pullup-resistors-lower](/img/posts/tp-mk/pullup-resistors-lower.jpg) 230 231 I used shrink wrap on the long portions of exposed wire to prevent any shorts 232 when the keyboard is closed together. 233 234 ![pullup-resistors-shrinkwrap](/img/posts/tp-mk/pullup-resistors-shrinkwrap.jpg) 235 236 ### 7. remove trackpoint 237 238 ![ibm-thinkpad](/img/posts/tp-mk/ibm-thinkpad.jpg) 239 240 The easily way to build a trackpoint into our custom keyboard is to just savage 241 an existing module from an old keyboard and wire it into ours. I found an old 242 IBM ThinkPad replacement keyboard on eBay for cheap which will work perfectly 243 well. There are tons of different keyboards with trackpoints that work, but the 244 removal, wiring, and fitting might be slightly different. 245 246 To remove my trackpoint module form the ThinkPad keyboard I first took off the 247 key caps around the red dot, exposing the screws attaching it. By unscrewing 248 these the module should fall out. 249 250 ![kb-screws](/img/posts/tp-mk/kb-screws.jpg) 251 252 The ribbon cable connecting it can then be cut freeing the 253 module. Cutting it at the base of the cable where it joins with the module's 254 board is fine since wires will be attached directly on to the exposed solder 255 later. 256 257 ![tp-module](/img/posts/tp-mk/tp-module.jpg) 258 259 ### 8. construct trackpoint circuit 260 261 This circuit will be used to connect the pins from the trackpoint module to the 262 microcontroller 263 264 #### a) resistors 265 266 The bottom two resistors are pull-up resistors which connect the trackpoint's 267 clock and data lines to high so they are not left floating when there is no 268 data passing through them. The top resistor is used with the next step to make 269 an RC circuit which automatically triggers the reset pin after the appropriate 270 amount of time has passed, instead of having to do it in code. 271 272 ![resistors](/img/posts/tp-mk/resistors.jpg) 273 274 #### b) capacitor 275 276 Capacitor to complete the RC circuit in order to trigger the reset pin at the 277 correct interval. 278 279 ![tp-cap](/img/posts/tp-mk/tp-cap.jpg) 280 281 ### 9. wire trackpoint 282 283 With the completed intermediating circuit you next need to solder the 284 corresponding pins on the trackpoint module to the circuit. [This GitHub 285 repo][25] has the pin out for various different modules so you can find the one 286 you salvaged. Since the exposed pins on the module are normally very close 287 together it is necessary to use the very thin 30 AWG wire here. I also 288 recommend using some electrical type to make sure none of the wires come loose. 289 290 [25]: https://github.com/alonswartz/trackpoint/tree/master/pinouts 291 292 ![tp-soldered](/img/posts/tp-mk/tp-soldered.jpg) 293 294 ### 10. test trackpoint 295 296 In order to test to make sure the trackpoint works correctly solder more 297 wire (any will do) to the other side of the RC circuit and use a breadboard or alligator 298 clips to test the trackpoint, circuit, and wiring with the teensy. 299 300 ![tp-test](/img/posts/tp-mk/tp-test.jpg) 301 302 ### 11. flash firmware 303 304 To confirm that the keyboard is working correctly so far we need to connect the 305 teensy to a computer and upload firmware to read all the inputs and communicate 306 with your device. There are many different tutorials online about uploading 307 code to our microcontroller, I used [the official teensy arduino tutorial][32] 308 so that I could push code with the easy-to-use arduino IDE. 309 310 [32]: https://www.pjrc.com/teensy/tutorial.html 311 312 Once you know how to upload code we now need the actual code that's going to 313 make the keyboard work. Depending on the choice of microcontroller, the well 314 supported [QMK firmware][33] is a good choice. Unfortunately I realized too 315 late that the teensy 3.2's new ARM processor was not supported when I 316 originally tried QMK, so I had to write my own arduino code from scratch 317 which can be found [here][34]. Either way since this is a custom hand wired 318 board you will need to tweak the program to the layout you wired 319 320 [33]: https://qmk.fm/ 321 [34]: https://gist.github.com/edvb/2b63ac6ac29eeb5bb1cdd117f2b5b5ed 322 323 ![teensy](https://i1.wp.com/makezine.com/wp-content/uploads/2015/09/Screen-Shot-2015-09-14-at-4.07.31-PM.png) 324 325 ### 12. attach trackpoint 326 327 Once the teensy is working with the trackpoint it can be soldered permanently 328 to the board. 329 330 ![tp-attached](/img/posts/tp-mk/tp-attached.jpg) 331 332 The trackpoint module was then hot glued to the bottom of the case. Depending 333 on the case the thin protruding support structures might need to be clipped off 334 in order to fit the module as low as possible. 335 336 ![tp-installed](/img/posts/tp-mk/tp-installed.jpg) 337 338 I chose to position the module sideways since placing it straight down would 339 require me to cut out much more of the case's supporting structure. This just 340 meant that I needed to tweak the code a bit so that the new orientation is 341 taken into account. 342 343 ### 13. construct trackpoint stem 344 345 To control the trackpoint from outside the keyboard enclosure a stem 346 needs to be attach to the top of the module. This is the point where you have 347 to get pretty creative as there are many different ways to achieve this. Some 348 people use a lip piercing, one of the keys themselves, or a simple screw. 349 Since I had some screws and bolts laying around I opted for this option as it 350 seemed the simplest. 351 352 ![stem](/img/posts/tp-mk/stem.jpg) 353 354 To make the screw feel more like a traditional trackpoint some coarse sandpaper 355 cut with a hole puncher was glued to the top of the screw and red spray paint 356 was coated on the top of it. While the sandpaper gives the screw texture, 357 the paint covering it gives it a softer and rubbery feel which is much less 358 harsh then the sandpaper by itself. 359 360 ![stem-comparison](/img/posts/tp-mk/stem-comparison.jpg) 361 362 ### 14. attach trackpoint stem 363 364 ![stem-board](/img/posts/tp-mk/stem-board.jpg) 365 366 To attach the screw to the trackpoint the textured red control was removed and 367 a series of washers and a bolt were first super glued together and then glued 368 onto the controller of the module. This allows a short screw to be easily 369 attach and detached from the board controlling the direction the cursor 370 moves. 371 372 ![stem-installed](/img/posts/tp-mk/stem-installed.jpg) 373 374 A small amount of silicone tape is added to the end of the threads of the screw 375 to reduce the amount of play in the screw, making its movements more precise. 376 377 ![tp-wire](/img/posts/tp-mk/tp-wire.jpg) 378 379 A new wire has to be connected as well to make the stem fit through the 380 previously cut opening. 381 382 ### 15. attach standoffs 383 384 Since the trackpoint requires extra room in the case the top plate needs to be 385 raised above from where it normally sits so the keys aren't interfering with 386 the trackpoint. This can be done in many different ways, but I decided to go 387 with motherboard standoffs that fit over the existing screw bases. 388 389 ![standoffs](/img/posts/tp-mk/standoffs.jpg) 390 391 ![standoffs-close](/img/posts/tp-mk/standoffs-close.jpg) 392 393 ### 16. keycaps 394 395 #### a) trim keycaps 396 397 To make room for the trackpoint stem outside of the cause and allow it to 398 freely move the edges might have to be trimmed out of the surrounding keycaps. 399 I did this by simply pressing hard on the corner with a sharp blade, but 400 similar results could be achieved with a dremel, drill, or file. For me only 401 the G and H keys needed to be modified, but depending on the trackpoint's 402 position the top of the B key might also need to be filed down. 403 404 ![cut-keycaps](/img/posts/tp-mk/cut-keycaps.jpg) 405 406 #### b) place keycaps 407 408 ![finish-top](/img/posts/tp-mk/finish-top.jpg) 409 410 The rest of the keycaps can now be placed according to the layout below. 411 412 ![keylayout](/img/posts/tp-mk/keylayout.jpg) 413 414 More silicone type might be required to get the keycaps with stabilizers to fit 415 correctly. 416 417 ![stabilizers](/img/posts/tp-mk/stabilizers.jpg) 418 419 ![keycaps-silicone](/img/posts/tp-mk/keycaps-silicone.jpg) 420 421 422 ## future 423 424 [![https://xkcd\.com/243/][1]](https://xkcd.com/243/) 425 426 [1]: https://imgs.xkcd.com/comics/appropriate_term.png "I know a lot of people hate these, but I prefer them to touchpads." 427 428 In future projects I probably won't choose to use a teensy 3.0 again unless 429 there is significant shift away from the currently popular 2.3 non-ARM 430 architecture supported by most firmwares. 431 432 I also need a micro USB port to attach to the case so the cable can be removed 433 and reattached from outside, currently there is just a hole leading to 434 the microcontroller directly. 435 436 If I were doing it over I would also think more careful about where I position 437 the microcontroller and wires since right now the USB port on the board is 438 facing away from the case's opening making the cable be a little tangled 439 inside. 440 441 Overall I am extremely happy with how the keyboard turned out and learned a lot 442 from making it myself. Feel free to [contact](/contact) me with any questions 443 or advice with your own keyboard! 444 445 ## see also 446 447 Here are some other useful guides which I used: 448 449 * [A different hand wiring build log][26] 450 * [Another hand wiring log][27] 451 * [Keyboard matrix tutorial][28] 452 * [QMK's hand wiring guide][29] 453 * [Trackpoint keyboard build][30] 454 * [Trackpoint keyboard tutorial][31] 455 456 [26]: https://deskthority.net/workshop-f7/brownfox-step-by-step-t6050.html 457 [27]: http://www.davecooper.org/i-built-a-keyboard 458 [28]: http://www.dribin.org/dave/keyboard/one_html/ 459 [29]: https://github.com/qmk/qmk_firmware/blob/master/docs/hand_wire.md 460 [30]: https://imgur.com/a/O6BdH 461 [31]: https://github.com/alonswartz/trackpoint