]> git.armaanb.net Git - atreides.git/blob - README.org
Remove outdated firmware.
[atreides.git] / README.org
1 * Atreus Keyboard
2
3 The [[http://ergodox.org][Ergodox]] keyboard is an absolutely fantastic design; I use it every
4 day at my office. However, I like to work away from the office
5 frequently, and I thought I might try my hand at designing something a
6 little more portable. The great thing about assembling my Ergodox is
7 that it taught me there's really nothing magical about it; it's just a
8 piece of circuitry with a bunch of switches read by a microcontroller
9 that speaks the USB HID interface.
10
11 The Atreus is meant to be complementary to the Ergodox as something
12 smaller, cheaper, and more travel-friendly. The case measures 25x11cm
13 and lacks even a number row, relying heavily upon the fn key. There is
14 no PCB in this design, requiring [[http://wiki.geekhack.org/index.php?title=Hard-Wiring_How-To][a manual matrix wiring approach]].
15 However, given that there are only 4 rows and 11 columns, this isn't
16 as daunting as it could be.
17
18 I've seen a number of existing DIY 40% keyboard designs, but most of
19 them stagger the rows, which I find very annoying now that I've gotten
20 used to the columnar layout of the Ergodox. In addition, many of the
21 designs I've seen waste a lot of room on the space bar, failing to
22 take into account the fact that the thumb is the strongest and most
23 versatile of the fingers. This design avoids both these problems while
24 taking a more couch-friendly single-piece approach.
25
26 [[./atreus.jpg]]
27
28 Having so few keys, this board is pretty idiosyncratic. It works very
29 well for the kind of work that I do, but it probably wouldn't be a
30 good fit for you if you do a lot of numerical data entry or make heavy
31 use of function keys, arrows, or home/end. If you primarily use
32 [[https://github.com/technomancy/dotfiles/commit/856a638350a26b0cdb0bcc82042ed77a3fa4bdea][programs with good key rebinding functionality]], you're probably in
33 good shape. For instance, =enter= and =tab= are in a bit of an awkward
34 position, but many programs treat =control-m= and =control-i= as
35 =enter= and =tab= respectively.
36
37 ** Layout
38
39 Only a handful of punctuation marks (and no digits) are available
40 unshifted, and all the modifiers are on the bottom row:
41
42  :    '     ,     .     p     y       ||       f     g     c     r    l
43  :    a     o     e     u     i       ||       d     h     t     n    s
44  :    ;     q     j     k     x       ||       b     m     w     v    z
45  :   esc   tab  super shift bksp ctrl || alt space  fn     -     /  enter
46
47 The numbers and most of the punctuation are on the fn layer with a
48 numpad-style arrangement under the right hand:
49
50  :    !     @     {     }     |       ||     pgup    7     8     9    *
51  :    #     $     (     )     `       ||     pgdn    4     5     6    +
52  :    %     ^     [     ]     ~       ||       \     1     2     3    ?
53  :  reset paste                       ||     hwdv          .     0    =
54
55 An alternate layout has the numbers in a more traditional row across the top:
56
57  :    1     2     3     4    5        ||       6     7     8     9    0
58  :    -     +     (     )    =        ||       .     [     ]     {    }
59  :    !     @     #     $    %        ||       ^     &     *     ~    ?
60  :  reset paste              `        ||     hwdv        pgup  pgdn   \
61
62 I type in Dvorak but prefer to do the remapping in software rather
63 than hardware so I don't have to change layouts when I switch to my
64 laptop's internal keyboard. However, the =hwdv= key switches it to
65 hardware Dvorak mode, which is useful for attaching to computers that
66 may not have software Dvorak set up. The =paste= key sends
67 shift+insert, while the =reset= button activates the bootloader,
68 allowing easy reprogramming without opening the case.
69
70 This is all a matter of firmware though; the layout is easy to change
71 after the fact.
72
73 ** Parts
74
75 *** Switches
76
77 This layout has five modifiers and 37 non-modifiers.
78
79 I strongly prefer the feel and sound of tactile [[http://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=651][Cherry MX blue]]
80 switches for typing. However, I like having linear [[http://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=103][Cherry MX black
81 switches]] switches on the modifier keys (ctrl, alt, super, shift, and
82 fn) because the tactile effect has no benefit for keys that are held
83 down, and giving a different response helps you learn the layout more
84 quickly.
85
86 *** Diodes
87
88 In order to avoid ghosting, each switch needs a [[https://www.radioshack.com/product/index.jsp?productId=2062587][1N4148 diode]].
89
90 *** Microcontroller
91
92 An [[http://www.digikey.com/product-search/en/programmers-development-systems/evaluation-boards-embedded-mcu-dsp/2621773?k=arduino%20micro][Arduino Micro]] or [[http://www.pjrc.com/teensy/index.html][Teensy 2]] is recommended. Be sure to get one
93 without headers so it will fit in between the bottom layer and the plate.
94
95 *** Keycaps
96
97 This [[http://keyshop.pimpmykeyboard.com/product/dsa-pbt-blank-sets][DSA-shaped base set]] (spherical indentations on the key, same
98 profile for each row) from Signature Plastics has 52 1x keys plus a
99 few extras we won't use. There are two "deep dish" keys in that set
100 which you can place under your index fingers on the home row to help
101 guide your hands to the right spot without looking. However, you only
102 get a single 1.5x keycap, and the middle two thumb keys both use them,
103 so you might want to pick up an extra. (You can buy a single DSA 1.5x
104 keycap from [[http://www.keycapsdirect.com/key-capsinventory.php][Signature Plastics]].)
105
106 ** Case
107
108 Layered laser-cut wood or acrylic; see [[file:./case.svg][the =case.svg= file]].
109
110 TODO: mention the difference between mk. I and mk. II cases.
111
112 [[./layers.jpg]]
113
114 The first two shapes in the case file are the top and bottom covers;
115 these should be cut on 3mm acrylic (black in the photo). The third is
116 the spacer that goes under the fourth, which is the plate on which the
117 switches are mounted. These should be cut in 6mm, especially the
118 spacer, which needs to be at least as thick as the mini USB cable you
119 connect to the microcontroller. I recommend using a mini USB cable
120 with as thin a connector as you can find or sanding the connector
121 down to the required thickness. The switch plate could be thinner, but
122 not under 3mm.
123
124 On a 100W Epilog laser, the 3mm layers cut in about a minute and a
125 half. I did a run with 6mm acrylic of the other layers which took
126 nearly 6 minutes.
127
128 TODO: describe finishing process for wood.
129
130 ** Firmware
131
132 The [[https://gitlab.com/technomancy/atreus-firmware/blob/master/readme.md][custom Atreus firmware]] is a small C project which
133 implements matrix scanning and debouncing with user-customizeable
134 layers and macro functions. Another option is the much more complex
135 TMK firmware. My [[https://github.com/technomancy/tmk_keyboard/tree/atreus][fork of the tmk firmware]] has support for the Atreus
136 layout. You should be able to change into the =keyboard/atreus=
137 directory and run =make KEYMAP=atreus= (or whichever variant you want)
138 to produce a qwerty =atreus.hex= file. You will probably want to
139 create your own layout once you've gotten a chance to try it and see
140 what works for you.
141
142 In either case you would use the =.hex= file produced with the [[http://www.pjrc.com/teensy/loader.html][teensy
143 loader]] or Arduino tools to upload to the microcontroller.
144
145 Once the firmware is loaded and the keyboard is assembled, pressing
146 the onboard reset button to update new versions of the firmware is
147 pretty cumbersome; instead use the "reset" button on the lower left
148 of the layout which has the same effect.
149
150 ** Bill of Materials
151
152 - 50 MX Blue switches: $29.00 (mechanicalkeyboards.com)
153 - 50 diodes: $3.45 (radio shack, should be able to buy in-person)
154 - Base blank DSA keycap set: $18.00 (signatureplastics.com)
155 - Teensy 2: $16 (pjrc.com or mechanicalkeyboards.com)
156 - Acrylic materials: $11
157 - Acrylic laser cutting: 7.5 at $3/min (varies by thickness of acrylic)
158
159 - 5 MX Black switches: $8.50 (optional)
160 - 5 MX Red switches: $10.00 (optional)
161 - additional 1.5x DSA keycap: $1 (optional)
162
163 - mechanicalkeyboards.com: free shipping in the US
164 - Signature Plastics (keycaps) US shipping: $8.00
165 - PJRC (teensy) shipping: $3.03
166
167 I haven't found a way to add the 1.5x keycap to an order of the DSA
168 base set, so you might be stuck paying Signature Plastics shipping
169 twice.
170
171 *** Other Tools
172
173 You'll need a soldering iron, solder, a glue gun, a multimeter, wire,
174 wire strippers, and a 5-pin USB Mini-B cable. You'll also need seven M3
175 machine screws with nuts; the length of the screws depends on the
176 thickness of the acrylic you use. You can add rubber feet to the
177 bottom to prevent the board from sliding around when placed on a desk.
178
179 ** Assembly
180
181 Once you have all the parts, the first thing to do is glue the
182 switches to the switch plate since there's no PCB to hold them in
183 place. Place all the switches in their holes, taking care to place the
184 black switches where the modifiers go if applicable. Once the switches
185 have been placed, flip the board over and place hot glue along the
186 left and right side of each switch hole.
187
188 [[./diodes.jpg]]
189
190 Once the switches are in place, you'll need to solder the diodes
191 in. For each side of the board start on the outside and work your way
192 inward. Each switch has two metal contacts. The higher one is where
193 you'll want to attach the diode. Each diode has a black ring on
194 it. Cut the leg on the other side away from the ring and solder it to
195 the higher switch contact. The other leg should point inward to the
196 next switch. Once you've attached a diode to each switch in the row,
197 you can start connecting them together. Solder the long leg of the
198 diode to the long leg of the next diode in the row. The innermost
199 diodes can have their long leg trimmed a bit; that's where you'll
200 attach the hookup wire to connect it into the microcontroller.
201
202 [[./wires.jpg]]
203
204 I recommend getting red wire for the (positive) rows and black for the
205 (negative) columns. The rows need eight wires with the insulation
206 exposed at intervals matching the spacing of the switches; see the
207 above photo for details. You could also just use many short stripped
208 segments of wire instead of a contiguous piece.
209
210 [[./thumb-diagram.png]]
211
212 Most of the row wires will need four segments of insulation, but
213 you'll need two with five for the rows with the inner thumb
214 keys. Physically the inner thumb keys look like two additional
215 columns, but logically they are treated as if they're both in column
216 number 6; the left key in row 3 and the right one in row 4.
217
218 [[./matrix.jpg]]
219
220 The exposed sections of row wire should be connected to the higher of
221 the pins on the switch using a diode. Be aware that diodes are
222 directional! The band around the diode should point to the top of the
223 board. Take care with the upper row that you don't let the wire go too
224 close to the top edge of the board; avoid getting in the way of the
225 spacer layer. Once the rows are wired, the remaining (negative) pin of
226 each switch should be wired into the negative pin of the switch above
227 and below it with black wire. This should be slightly easier since no
228 diode is necessary. The photo above shows the completed matrix for one
229 side. Test each row and column as you go with a multimeter. You should
230 be able to get continuity from row to column when the corresponding
231 switch is activated.
232
233 After the matrix has been wired on both sides, the next step is to
234 connect the microcontroller. Both the Atreus and TMK firmwares have
235 the rows in pins D0, D1, D2, and D3 of the microcontroller.
236
237 |------------+----+----+----+----|
238 | row number |  1 |  2 |  3 |  4 |
239 |------------+----+----+----+----|
240 | pin number | D0 | D1 | D2 | D3 |
241
242 You'll need to connect the rows from the right side to the left side,
243 which then should be wired to the proper pin. There are more
244 columns than rows, so I used ribbon cable to bring the column
245 connections back to the microcontroller from the outside in.
246
247 Depending on the firmware you want to use, you'll wire the columns
248 differently. The simpler Atreus firmware simply starts at B0 and goes
249 up to F4-6, while the more featureful TMK firmware jumps all over the
250 place.
251
252 Atreus:
253
254 |---------------+----+----+----+----+----+----+----+----+----+----+----|
255 | column number |  0 |  1 |  2 |  3 |  4 |  5 |  6 |  7 |  8 |  9 | 10 |
256 |---------------+----+----+----+----+----+----+----+----+----+----+----|
257 | pin number    | B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 | F4 | F5 | F6 |
258
259 TMK:
260
261 |---------------+----+----+----+----+----+----+----+----+----+----+----|
262 | column number |  1 |  2 |  3 |  4 |  5 |  6 |  7 |  8 |  9 | 10 | 11 |
263 |---------------+----+----+----+----+----+----+----+----+----+----+----|
264 | pin number    | F0 | F1 | E6 | C7 | C6 | B6 | D4 | B1 | B0 | B5 | B4 |
265
266 (It may be possible to adapt the TMK firmware to the consecutive pinout.)
267
268 It's important to realize that when you flip over the board
269 in order to solder it, you have to flip over the schematic in your
270 mind too. If you count your columns from the left, you'll get them
271 backwards. (Which I actually did for the first half.)
272
273 [[./controller.jpg]]
274
275 Once you've wired one side of the microcontroller in, it would be a
276 good time to test it. You'll need to compile and upload as per the
277 "Firmware" section above. At this point you should be reading real
278 keycodes from the half of the keyboard that you've wired. Once you've
279 confirmed that's working, continue with the other half. Then screw the
280 other layers in place and you're all set!
281
282 ** Inspiration
283
284 These fine projects all provided inspiration for various aspects of
285 the Atreus, as well as the folks on the =#geekhack= freenode channel.
286
287 - [[http://ergodox.org][Ergodox]]
288 - [[http://deskthority.net/workshop-f7/onehand-20-keyboard-t6617.html][OneHand]]
289 - [[http://blog.fsck.com/2013/12/better-and-better-keyboards.html][keyboard.io]]
290 - [[http://geekhack.org/index.php?topic=48718][ErgoT]]
291
292 ** Builds
293
294 If you've built an Atreus, please let us know (pull request or
295 otherwise) and get your name and link added here:
296
297 - [[http://technomancy.us/173][Phil Hagelberg]]
298 - [[http://blog.tarn-vedra.de/2014/04/reproducing-keyboard-science_1707.html][Moritz Ulrich]]
299 - [[http://geekhack.org/index.php?topic=57007.0][Constantine]]
300
301 ** License
302
303 Copyright © 2014 Phil Hagelberg
304
305 Released under the [[https://www.gnu.org/licenses/gpl.html][GNU GPL version 3]]