aboutsummaryrefslogtreecommitdiff
path: root/docs/hand_wire.md
diff options
context:
space:
mode:
authorskullY <skullydazed@gmail.com>2017-07-03 12:11:13 -0700
committerskullY <skullydazed@gmail.com>2017-07-03 12:11:13 -0700
commitff47ca7a46263978dba2e02d3dfd481bc84e361b (patch)
tree59f3d184c8aae599619cef8e8e255712e7170867 /docs/hand_wire.md
parentdff5708b075e917c3cbeb384aba98a3a9008db32 (diff)
downloadqmk_firmware-ff47ca7a46263978dba2e02d3dfd481bc84e361b.tar.gz
qmk_firmware-ff47ca7a46263978dba2e02d3dfd481bc84e361b.zip
update hand_wire
Diffstat (limited to 'docs/hand_wire.md')
-rw-r--r--docs/hand_wire.md66
1 files changed, 38 insertions, 28 deletions
diff --git a/docs/hand_wire.md b/docs/hand_wire.md
index 0d3372815..9f6309542 100644
--- a/docs/hand_wire.md
+++ b/docs/hand_wire.md
@@ -100,9 +100,9 @@ Things act as they should! Which will get us the following data:
100 100
101The firmware can then use this correct data to detect what it should do, and eventually, what signals it needs to send to the OS. 101The firmware can then use this correct data to detect what it should do, and eventually, what signals it needs to send to the OS.
102 102
103## The actual hand-wiring 103# The actual hand-wiring
104 104
105### Getting things in place 105## Getting things in place
106 106
107When starting this, you should have all of your stabilisers and keyswitches already installed (and optionally keycaps). If you're using a Cherry-type stabiliser (plate-mounted only, obviously), you'll need to install that before your keyswitches. If you're using Costar ones, you can installed them afterwards. 107When starting this, you should have all of your stabilisers and keyswitches already installed (and optionally keycaps). If you're using a Cherry-type stabiliser (plate-mounted only, obviously), you'll need to install that before your keyswitches. If you're using Costar ones, you can installed them afterwards.
108 108
@@ -112,27 +112,31 @@ Get your soldering iron heated-up and collect the rest of the materials from the
112 112
113Before continuing, plan out where you're going to place your Teensy. If you're working with a board that has a large (6.25u) spacebar, it may be a good idea to place it in-between switches against the plate. Otherwise, you may want to trim some of the leads on the keyswitches where you plan on putting it - this will make it a little harder to solder the wire/diodes, but give you more room to place the Teensy. 113Before continuing, plan out where you're going to place your Teensy. If you're working with a board that has a large (6.25u) spacebar, it may be a good idea to place it in-between switches against the plate. Otherwise, you may want to trim some of the leads on the keyswitches where you plan on putting it - this will make it a little harder to solder the wire/diodes, but give you more room to place the Teensy.
114 114
115### Preparing the diodes 115## Preparing the diodes
116 116
117It's a little easier to solder the diodes in place if you bend them at a 90º angle immediately after the black line - this will help to make sure you put them on the right way (direction matters), and in the correct position. The diodes will look like this when bent (with longer leads): 117It's a little easier to solder the diodes in place if you bend them at a 90º angle immediately after the black line - this will help to make sure you put them on the right way (direction matters), and in the correct position. The diodes will look like this when bent (with longer leads):
118 118
119```
119 ┌─────┬─┐ 120 ┌─────┬─┐
120 ───┤ │ ├─┐ 121 ───┤ │ ├─┐
121 └─────┴─┘ │ 122 └─────┴─┘ │
122 123
124```
123 125
124We'll be using the long lead at the bent end to connect it to the elbow (bent part) of the next diode, creating the row. 126We'll be using the long lead at the bent end to connect it to the elbow (bent part) of the next diode, creating the row.
125 127
126### Soldering the diodes 128## Soldering the diodes
127 129
128Starting at the top-left switch, place the diode (with tweezers if you have them) on the switch so that the diode itself is vertically aligned, and the black line is facing toward you. The straight end of the diode should be touching the left contact on the switch, and the bent end should be facing to the right and resting on the switch there, like this: 130Starting at the top-left switch, place the diode (with tweezers if you have them) on the switch so that the diode itself is vertically aligned, and the black line is facing toward you. The straight end of the diode should be touching the left contact on the switch, and the bent end should be facing to the right and resting on the switch there, like this:
129 131
132```
130 │o 133 │o
131 ┌┴┐ o 134 ┌┴┐ o
132 │ │ O 135 │ │ O
133 ├─┤ 136 ├─┤
134 └┬┘ 137 └┬┘
135 └───────────── 138 └─────────────
139```
136 140
137Letting the diode rest, grab your solder, and touch both it and the soldering iron to the left contact at the same time - the rosin in the solder should make it easy for the solder to flow over both the diode and the keyswitch contact. The diode may move a little, and if it does, carefully position it back it place by grabbing the bent end of the diode - the other end will become hot very quickly. If you find that it's moving too much, using needle-nose pliers of some sort may help to keep the diode still when soldering. 141Letting the diode rest, grab your solder, and touch both it and the soldering iron to the left contact at the same time - the rosin in the solder should make it easy for the solder to flow over both the diode and the keyswitch contact. The diode may move a little, and if it does, carefully position it back it place by grabbing the bent end of the diode - the other end will become hot very quickly. If you find that it's moving too much, using needle-nose pliers of some sort may help to keep the diode still when soldering.
138 142
@@ -142,18 +146,20 @@ After soldering things in place, it may be helpful to blow on the joint to push
142 146
143When the first diode is complete, the next one will need to be soldered to both the keyswitch, and the previous diode at the new elbow. That will look something like this: 147When the first diode is complete, the next one will need to be soldered to both the keyswitch, and the previous diode at the new elbow. That will look something like this:
144 148
149```
145 │o │o 150 │o │o
146 ┌┴┐ o ┌┴┐ o 151 ┌┴┐ o ┌┴┐ o
147 │ │ O │ │ O 152 │ │ O │ │ O
148 ├─┤ ├─┤ 153 ├─┤ ├─┤
149 └┬┘ └┬┘ 154 └┬┘ └┬┘
150 └────────────────┴───────────── 155 └────────────────┴─────────────
156```
151 157
152After completing a row, use the wire cutters to trim the excess wire from the tops of the diodes, and from the right side on the final switch. This process will need to completed for each row you have. 158After completing a row, use the wire cutters to trim the excess wire from the tops of the diodes, and from the right side on the final switch. This process will need to completed for each row you have.
153 159
154When all of the diodes are completely soldered, it's a good idea to quickly inspect each one to ensure that your solder joints are solid and sturdy - repairing things after this is possible, but more difficult. 160When all of the diodes are completely soldered, it's a good idea to quickly inspect each one to ensure that your solder joints are solid and sturdy - repairing things after this is possible, but more difficult.
155 161
156### Soldering the columns 162## Soldering the columns
157 163
158You'll have some options in the next process - it's a good idea to insulate the column wires (since the diodes aren't), but if you're careful enough, you can use exposed wires for the columns - it's not recommended, though. If you're using single-cored wire, stripping the plastic off of the whole wire and feeding it back on is probably the best option, but can be difficult depending on the size and materials. You'll want to leave parts of the wire exposed where you're going to be solder it onto the keyswitch. 164You'll have some options in the next process - it's a good idea to insulate the column wires (since the diodes aren't), but if you're careful enough, you can use exposed wires for the columns - it's not recommended, though. If you're using single-cored wire, stripping the plastic off of the whole wire and feeding it back on is probably the best option, but can be difficult depending on the size and materials. You'll want to leave parts of the wire exposed where you're going to be solder it onto the keyswitch.
159 165
@@ -163,7 +169,7 @@ Before beginning to solder, it helps to have your wire pre-bent (if using single
163 169
164If you're not using any insulation, you can try to keep the column wires elevated, and solder them near the tips of the keyswitch contacts - if the wires are sturdy enough, they won't short out to the row wiring an diodes. 170If you're not using any insulation, you can try to keep the column wires elevated, and solder them near the tips of the keyswitch contacts - if the wires are sturdy enough, they won't short out to the row wiring an diodes.
165 171
166### Wiring things to the Teensy 172## Wiring things to the Teensy
167 173
168Now that the matrix itself is complete, it's time to connect what you've done to the Teensy. You'll be needing the number of pins equal to your number of columns + your number of rows. There are some pins on the Teensy that are special, like D6 (the LED on the chip), or some of the UART, SPI, I2C, or PWM channels, but only avoid those if you're planning something in addition to a keyboard. If you're unsure about wanting to add something later, you should have enough pins in total to avoid a couple. 174Now that the matrix itself is complete, it's time to connect what you've done to the Teensy. You'll be needing the number of pins equal to your number of columns + your number of rows. There are some pins on the Teensy that are special, like D6 (the LED on the chip), or some of the UART, SPI, I2C, or PWM channels, but only avoid those if you're planning something in addition to a keyboard. If you're unsure about wanting to add something later, you should have enough pins in total to avoid a couple.
169 175
@@ -179,48 +185,55 @@ When you're done with the columns, start with the rows in the same process, from
179 185
180As you move along, be sure that the Teensy is staying in place - recutting and soldering the wires is a pain! 186As you move along, be sure that the Teensy is staying in place - recutting and soldering the wires is a pain!
181 187
182### Getting some basic firmware set-up 188# Getting some basic firmware set-up
183 189
184From here, you should have a working keyboard with the correct firmware. Before we attach the Teensy permanently to the keyboard, let's quickly get some firmware loaded onto the Teensy so we can test each keyswitch. 190From here, you should have a working keyboard once you program a firmware. Before we attach the Teensy permanently to the keyboard, let's quickly get some firmware loaded onto the Teensy so we can test each keyswitch.
185 191
186To start out, download [the firmware](https://github.com/qmk/qmk_firmware/) - we'll be using my (Jack's) fork of TMK called QMK/Quantum. We'll be doing a lot from the Terminal/command prompt, so get that open, along with a decent text editor like [Sublime Text](http://www.sublimetext.com/). 192To start out, download [the firmware](https://github.com/qmk/qmk_firmware/) - we'll be using my (Jack's) fork of TMK called QMK/Quantum. We'll be doing a lot from the Terminal/command prompt, so get that open, along with a decent text editor like [Sublime Text](http://www.sublimetext.com/).
187 193
188The first thing we're going to do is create a new project using the script in the root directory of the firmware. In your terminal, run this command with `<project_name>` replaced by the name of your project - it'll need to be different from any other project in the `keyboards/` folder: 194The first thing we're going to do is create a new project using the script in the root directory of the firmware. In your terminal, run this command with `<project_name>` replaced by the name of your project - it'll need to be different from any other project in the `keyboards/` folder:
189 195
196```
190 util/new_project.sh <project_name> 197 util/new_project.sh <project_name>
198```
191 199
192You'll want to navigate to the `keyboards/<project_name>/` folder by typing, like the print-out from the script specifies: 200You'll want to navigate to the `keyboards/<project_name>/` folder by typing, like the print-out from the script specifies:
193 201
194 cd keyboards/<project_name> 202 cd keyboards/<project_name>
195 203
196#### config.h 204### config.h
197 205
198The first thing you're going to want to modify is the `config.h` file. Find `MATRIX_ROWS` and `MATRIX_COLS` and change their definitions to match the dimensions of your keyboard's matrix. 206The first thing you're going to want to modify is the `config.h` file. Find `MATRIX_ROWS` and `MATRIX_COLS` and change their definitions to match the dimensions of your keyboard's matrix.
199 207
200Farther down are `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`. Change their definitions to match how you wired up your matrix (looking from the top of the keyboard, the rows run top-to-bottom and the columns run left-to-right). Likewise, change the definition of `UNUSED_PINS` to match the pins you did not use (this will save power). 208Farther down are `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`. Change their definitions to match how you wired up your matrix (looking from the top of the keyboard, the rows run top-to-bottom and the columns run left-to-right). Likewise, change the definition of `UNUSED_PINS` to match the pins you did not use (this will save power).
201 209
202#### \<project_name\>.h 210### \<project_name\>.h
203 211
204The next file you'll want to look at is `<project_name>.h`. You're going to want to rewrite the `KEYMAP` definition - the format and syntax here is extremely important, so pay attention to how things are setup. The first half of the definition are considered the arguments - this is the format that you'll be following in your keymap later on, so you'll want to have as many k*xy* variables here as you do keys. The second half is the part that the firmware actually looks at, and will contain gaps depending on how you wired your matrix. 212The next file you'll want to look at is `<project_name>.h`. You're going to want to rewrite the `KEYMAP` definition - the format and syntax here is extremely important, so pay attention to how things are setup. The first half of the definition are considered the arguments - this is the format that you'll be following in your keymap later on, so you'll want to have as many k*xy* variables here as you do keys. The second half is the part that the firmware actually looks at, and will contain gaps depending on how you wired your matrix.
205 213
206We'll dive into how this will work with the following example. Say we have a keyboard like this: 214We'll dive into how this will work with the following example. Say we have a keyboard like this:
207 215
216```
208 ┌───┬───┬───┐ 217 ┌───┬───┬───┐
209 │ │ │ │ 218 │ │ │ │
210 ├───┴─┬─┴───┤ 219 ├───┴─┬─┴───┤
211 │ │ │ 220 │ │ │
212 └─────┴─────┘ 221 └─────┴─────┘
222```
213 223
214This can be described by saying the top row is 3 1u keys, and the bottom row is 2 1.5u keys. The difference between the two rows is important, because the bottom row has an unused column spot (3 v 2). Let's say that this is how we wired the columns: 224This can be described by saying the top row is 3 1u keys, and the bottom row is 2 1.5u keys. The difference between the two rows is important, because the bottom row has an unused column spot (3 v 2). Let's say that this is how we wired the columns:
215 225
226```
216 ┌───┬───┬───┐ 227 ┌───┬───┬───┐
217 │ ┋ │ ┋ │ ┋ │ 228 │ ┋ │ ┋ │ ┋ │
218 ├─┋─┴─┬─┴─┋─┤ 229 ├─┋─┴─┬─┴─┋─┤
219 │ ┋ │ ┋ │ 230 │ ┋ │ ┋ │
220 └─────┴─────┘ 231 └─────┴─────┘
232```
221 233
222The middle column is unused on the bottom row in this example. Our `KEYMAP` definition would look like this: 234The middle column is unused on the bottom row in this example. Our `KEYMAP` definition would look like this:
223 235
236```
224 #define KEYMAP( \ 237 #define KEYMAP( \
225 k00, k01, k02, \ 238 k00, k01, k02, \
226 k10, k11, \ 239 k10, k11, \
@@ -229,19 +242,23 @@ The middle column is unused on the bottom row in this example. Our `KEYMAP` defi
229 { k00, k01, k02 }, \ 242 { k00, k01, k02 }, \
230 { k10, KC_NO, k11 }, \ 243 { k10, KC_NO, k11 }, \
231 } 244 }
245```
232 246
233Notice how the top half is spaced to resemble our physical layout - this helps us understand which keys are associated with which columns. The bottom half uses the keycode `KC_NO` where there is no keyswitch wired in. It's easiest to keep the bottom half aligned in a grid to help us make sense of how the firmware actually sees the wiring. 247Notice how the top half is spaced to resemble our physical layout - this helps us understand which keys are associated with which columns. The bottom half uses the keycode `KC_NO` where there is no keyswitch wired in. It's easiest to keep the bottom half aligned in a grid to help us make sense of how the firmware actually sees the wiring.
234 248
235Let's say that instead, we wired our keyboard like this (a fair thing to do): 249Let's say that instead, we wired our keyboard like this (a fair thing to do):
236 250
251```
237 ┌───┬───┬───┐ 252 ┌───┬───┬───┐
238 │ ┋ │ ┋│ ┋ │ 253 │ ┋ │ ┋│ ┋ │
239 ├─┋─┴─┬┋┴───┤ 254 ├─┋─┴─┬┋┴───┤
240 │ ┋ │┋ │ 255 │ ┋ │┋ │
241 └─────┴─────┘ 256 └─────┴─────┘
257```
242 258
243This would require our `KEYMAP` definition to look like this: 259This would require our `KEYMAP` definition to look like this:
244 260
261```
245 #define KEYMAP( \ 262 #define KEYMAP( \
246 k00, k01, k02, \ 263 k00, k01, k02, \
247 k10, k11, \ 264 k10, k11, \
@@ -250,10 +267,11 @@ This would require our `KEYMAP` definition to look like this:
250 { k00, k01, k02 }, \ 267 { k00, k01, k02 }, \
251 { k10, k11, KC_NO }, \ 268 { k10, k11, KC_NO }, \
252 } 269 }
270```
253 271
254Notice how the `k11` and `KC_NO` switched places to represent the wiring, and the unused final column on the bottom row. Sometimes it'll make more sense to put a keyswitch on a particular column, but in the end, it won't matter, as long as all of them are accounted for. You can use this process to write out the `KEYMAP` for your entire keyboard - be sure to remember that your keyboard is actually backwards when looking at the underside of it. 272Notice how the `k11` and `KC_NO` switched places to represent the wiring, and the unused final column on the bottom row. Sometimes it'll make more sense to put a keyswitch on a particular column, but in the end, it won't matter, as long as all of them are accounted for. You can use this process to write out the `KEYMAP` for your entire keyboard - be sure to remember that your keyboard is actually backwards when looking at the underside of it.
255 273
256#### keymaps/default.c 274### keymaps/default.c
257 275
258This is the actual keymap for your keyboard, and the main place you'll make changes as you perfect your layout. `default.c` is the file that gets pull by default when typing `make`, but you can make other files as well, and specify them by typing `make KEYMAP=<variant>`, which will pull `keymaps/<variant>.c`. 276This is the actual keymap for your keyboard, and the main place you'll make changes as you perfect your layout. `default.c` is the file that gets pull by default when typing `make`, but you can make other files as well, and specify them by typing `make KEYMAP=<variant>`, which will pull `keymaps/<variant>.c`.
259 277
@@ -261,26 +279,30 @@ The basis of a keymap is its layers - by default, layer 0 is active. You can act
261 279
262Using our previous example, let's say we want to create the following layout: 280Using our previous example, let's say we want to create the following layout:
263 281
282```
264 ┌───┬───┬───┐ 283 ┌───┬───┬───┐
265 │ A │ 1 │ H │ 284 │ A │ 1 │ H │
266 ├───┴─┬─┴───┤ 285 ├───┴─┬─┴───┤
267 │ TAB │ SPC │ 286 │ TAB │ SPC │
268 └─────┴─────┘ 287 └─────┴─────┘
288```
269 289
270This can be accomplished by using the following `keymaps` definition: 290This can be accomplished by using the following `keymaps` definition:
271 291
272 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 292```
293const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
273 [0] = KEYMAP( /* Base */ 294 [0] = KEYMAP( /* Base */
274 KC_A, KC_1, KC_H, \ 295 KC_A, KC_1, KC_H, \
275 KC_TAB, KC_SPC \ 296 KC_TAB, KC_SPC \
276 ), 297 ),
277 }; 298};
299```
278 300
279Note that the layout of the keycodes is similar to the physical layout of our keyboard - this make it much easier to see what's going on. A lot of the keycodes should be fairly obvious, but for a full list of them, check out [tmk_code/doc/keycode.txt](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/doc/keycode.txt) - there are also a lot of aliases to condense your keymap file. 301Note that the layout of the keycodes is similar to the physical layout of our keyboard - this make it much easier to see what's going on. A lot of the keycodes should be fairly obvious, but for a full list of them, check out [tmk_code/doc/keycode.txt](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/doc/keycode.txt) - there are also a lot of aliases to condense your keymap file.
280 302
281It's also important to use the `KEYMAP` function we defined earlier - this is what allows the firmware to associate our intended readable keymap with the actual wiring. 303It's also important to use the `KEYMAP` function we defined earlier - this is what allows the firmware to associate our intended readable keymap with the actual wiring.
282 304
283#### Compiling your firmware 305## Compiling your firmware
284 306
285After you've written out your entire keymap, you're ready to get the firmware compiled and onto your Teensy. Before compiling, you'll need to get your [development environment set-up](build_guide.md) - you can skip the dfu-programmer instructions, but you'll need to download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to get the firmware on your Teensy. 307After you've written out your entire keymap, you're ready to get the firmware compiled and onto your Teensy. Before compiling, you'll need to get your [development environment set-up](build_guide.md) - you can skip the dfu-programmer instructions, but you'll need to download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to get the firmware on your Teensy.
286 308
@@ -288,7 +310,7 @@ Once everything is installed, running `make` in the terminal should get you some
288 310
289Once you have your `<project_name>.hex` file, open up the Teensy loader application, and click the file icon. From here, navigate to your `QMK/keyboards/<project_name>/` folder, and select the `<project_name>.hex` file. Plug in your keyboard and press the button on the Teensy - you should see the LED on the device turn off once you do. The Teensy Loader app will change a little, and the buttons should be clickable - click the download button (down arrow), and then the reset button (right arrow), and your keyboard should be ready to go! 311Once you have your `<project_name>.hex` file, open up the Teensy loader application, and click the file icon. From here, navigate to your `QMK/keyboards/<project_name>/` folder, and select the `<project_name>.hex` file. Plug in your keyboard and press the button on the Teensy - you should see the LED on the device turn off once you do. The Teensy Loader app will change a little, and the buttons should be clickable - click the download button (down arrow), and then the reset button (right arrow), and your keyboard should be ready to go!
290 312
291#### Testing your firmware 313## Testing your firmware
292 314
293Carefully flip your keyboard over, open up a new text document, and try typing - you should get the characters that you put into your keymap. Test each key, and note the ones that aren't working. Here's a quick trouble-shooting guide for non-working keys: 315Carefully flip your keyboard over, open up a new text document, and try typing - you should get the characters that you put into your keymap. Test each key, and note the ones that aren't working. Here's a quick trouble-shooting guide for non-working keys:
294 316
@@ -302,20 +324,8 @@ Carefully flip your keyboard over, open up a new text document, and try typing -
302 324
303If you've done all of these things, keep in mind that sometimes you might have had multiple things affecting the keyswitch, so it doesn't hurt to test the keyswitch by shorting it out at the end. 325If you've done all of these things, keep in mind that sometimes you might have had multiple things affecting the keyswitch, so it doesn't hurt to test the keyswitch by shorting it out at the end.
304 326
305#### Securing the Teensy, finishing your hardware, getting fancier firmware 327# Securing the Teensy, finishing your hardware, getting fancier firmware
306 328
307Now that you have a working board, it's time to get things in their permanent positions. I've often used liberal amounts of hot glue to secure and insulate things, so if that's your style, start spreading that stuff like butter. Otherwise, double-sided tape is always an elegant solution, and electrical tape is a distant second. Due to the nature of these builds, a lot of this part is up to you and how you planned (or didn't plan) things out. 329Now that you have a working board, it's time to get things in their permanent positions. I've often used liberal amounts of hot glue to secure and insulate things, so if that's your style, start spreading that stuff like butter. Otherwise, double-sided tape is always an elegant solution, and electrical tape is a distant second. Due to the nature of these builds, a lot of this part is up to you and how you planned (or didn't plan) things out.
308 330
309There are a lot of possibilities inside the firmware - check out the [readme](https://github.com/qmk/qmk_firmware/blob/master/readme.md) for a full feature list, and dive into the different project (Planck, Ergodox EZ, etc) to see how people use all of them. You can always stop by [the OLKB subreddit for help!](http://reddit.com/r/olkb) 331There are a lot of possibilities inside the firmware - check out the [readme](https://github.com/qmk/qmk_firmware/blob/master/readme.md) for a full feature list, and dive into the different project (Planck, Ergodox EZ, etc) to see how people use all of them. You can always stop by [the OLKB subreddit for help!](http://reddit.com/r/olkb)
310
311## Trouble-shooting compiling
312
313### Windows
314
315#### fork: Resource temporarily unavailable
316
317http://www.avrfreaks.net/forum/windows-81-compilation-error
318
319### Mac
320
321### Linux