]> git.armaanb.net Git - atreides.git/blob - README.org
Link to Conkeror customization for C-i as tab.
[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 switches on the
81 modifier keys (ctrl, alt, super, shift, and fn). [[http://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=102][Cherry MX red switches]]
82 are nice and light but are expensive and difficult to
83 find. [[http://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=103][Cherry MX black switches]] are cheaper and easier to source, but
84 may be too heavy, especially for keys under pinky fingers.
85
86 One trick is take the springs from some of your blue switches and
87 trade them with the springs from your black switches. The blacks then
88 become the equivalent of reds, and the blues become MX green switches,
89 which are a heavier variant of blues. These are typically used for
90 space bars on boards that otherwise use blues. They could be suitable
91 for non-modifier thumb keys like backspace, space, and enter. However,
92 the recommended layout above has all its modifiers under the thumbs,
93 so this is not an issue.
94
95 *** Diodes
96
97 In order to avoid ghosting, each switch needs a [[https://www.radioshack.com/product/index.jsp?productId=2062587][1N4148 diode]].
98
99 *** Microcontroller
100
101 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
102 without headers so it will fit in between the bottom layer and the plate.
103
104 *** Keycaps
105
106 This [[http://keyshop.pimpmykeyboard.com/product/dsa-pbt-blank-sets][DSA-shaped base set]] (spherical indentations on the key, same
107 profile for each row) from Signature Plastics has 52 1x keys plus a
108 few extras we won't use. There are two "deep dish" keys in that set
109 which you can place under your index fingers on the home row to help
110 guide your hands to the right spot without looking. However, you only
111 get a single 1.5x keycap, and the middle two thumb keys both use them,
112 so you might want to pick up an extra. (You can buy a single DSA 1.5x
113 keycap from [[http://www.keycapsdirect.com/key-capsinventory.php][Signature Plastics]].)
114
115 If you want labels on your keycaps, you can get a full labelled
116 standard 104-key set from [[http://elitekeyboards.com/products.php?sub=access#cherrymxkeys][Elite Keyboards]] as well. However, the
117 modifiers in that set are larger than what the Atreus uses, so you'll
118 have to place some mis-labelled caps on the bottom row.
119
120 ** Case
121
122 Layered laser-cut acrylic; see [[file:./case.svg][the =case.svg= file]].
123
124 [[./layers.jpg]]
125
126 The first two shapes in the case file are the top and bottom covers;
127 these should be cut on 3mm acrylic (black in the photo). The third is
128 the spacer that goes under the fourth, which is the plate on which the
129 switches are mounted. These should be cut in 6mm, especially the
130 spacer, which needs to be at least as thick as the mini USB cable you
131 connect to the microcontroller. I recommend using a mini USB cable
132 with as thin a connector as you can find or sanding the connector
133 down to the required thickness. The switch plate could be thinner, but
134 not under 3mm.
135
136 On a 100W Epilog laser, the 3mm layers cut in about a minute and a
137 half. I did a run with 6mm acrylic of the other layers which took
138 nearly 6 minutes.
139
140 ** Firmware
141
142 My [[https://github.com/technomancy/tmk_keyboard/tree/atreus][fork of the tmk firmware]] has support for the Atreus layout.  You
143 should be able to change into the =keyboard/atreus= directory and run
144 =make KEYMAP=atreus= (or whichever variant you want) to produce a
145 qwerty =atreus.hex= file. You will probably want to create your own
146 layout once you've gotten a chance to try it and see what works for
147 you. Use the =.hex= file with the [[http://www.pjrc.com/teensy/loader.html][teensy loader]] or Arduino tools to
148 upload to the microcontroller.
149
150 Once the firmware is loaded and the keyboard is assembled, pressing
151 the onboard reset button to update new versions of the firmware is
152 pretty cumbersome; instead use the "reset" button on the lower left
153 of the layout which has the same effect.
154
155 I'm working on an experimental Forth-based firmware in the [[https://github.com/technomancy/orestes][Orestes]]
156 project, but that project is still in its infancy at the time of this
157 writing.
158
159 ** Bill of Materials
160
161 - 50 MX Blue switches: $29.00 (mechanicalkeyboards.com)
162 - 50 diodes: $3.45 (radio shack, should be able to buy in-person)
163 - Base blank DSA keycap set: $18.00 (signatureplastics.com)
164 - Teensy 2: $16 (pjrc.com or mechanicalkeyboards.com)
165 - Acrylic materials: $11
166 - Acrylic laser cutting: 7.5 at $3/min (varies by thickness of acrylic)
167
168 - Labelled 104 keycap set: $20.00 (optional, replaces DSA set above)
169 - 5 MX Black switches: $8.50 (optional)
170 - 5 MX Red switches: $10.00 (optional)
171 - additional 1.5x DSA keycap: $1 (optional)
172
173 =(+ 29 3.45 18 16 11 (* 3 7.5))= $99.95 plus tax/shipping
174
175 - mechanicalkeyboards.com: free shipping in the US
176 - Signature Plastics (keycaps) US shipping: $8.00
177 - PJRC (teensy) shipping: $3.03
178
179 *** Cost-saving Options
180
181 There are a few ways to lower the cost further.  Using [[http://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=482][Matias]] key
182 switches could save you a fair bit if you go in on a 90-pack with
183 someone else, but they're a little harder to find keycaps for; the MX
184 caps won't work on them. Using wood for the case will reduce both the
185 materials cost as well as the amount of time needed to cut the case.
186
187 Replacing the colored acrylic with transparent might also save a few
188 dollars. You could also use thinner acrylic for the switch plate too;
189 I cut mine in 4.5mm. A thinner spacer is inadvisable; even with 6mm
190 it's pretty tight.
191
192 Another common trick is scavenging keycaps and switches from used
193 keyboards; something with Cherry or Alps switches should work. This
194 can be time-consuming though.
195
196 *** Other Tools
197
198 You'll need a soldering iron, solder, a glue gun, a multimeter, wire,
199 wire strippers, and a 5-pin USB Mini-B cable. You'll also need seven M3
200 machine screws with nuts; the length of the screws depends on the
201 thickness of the acrylic you use. You can add rubber feet to the
202 bottom to prevent the board from sliding around when placed on a desk.
203
204 ** Assembly
205
206 Once you have all the parts, the first thing to do is glue the
207 switches to the switch plate since there's no PCB to hold them in
208 place. Be aware that the screw holes unfortunately are not
209 symmetrical, so before inserting the switches it's important to ensure
210 that the plate is right-side-up. Use a drop of hot glue on the top and
211 bottom of each switch to affix it in place.
212
213 [[./wires.jpg]]
214
215 Once the switches are in place, the matrix must be created. I
216 recommend getting red wire for the (positive) rows and black for the
217 (negative) columns. The rows need eight wires with the insulation
218 exposed at intervals matching the spacing of the switches; see the
219 above photo for details. You could also just use many short stripped
220 segments of wire instead of a contiguous piece.
221
222 [[./thumb-diagram.png]]
223
224 Most of the row wires will need four segments of insulation, but
225 you'll need two with five for the rows with the inner thumb
226 keys. Physically the inner thumb keys look like two additional
227 columns, but logically they are treated as if they're both in column
228 number 6; the left key in row 3 and the right one in row 4.
229
230 [[./matrix.jpg]]
231
232 The exposed sections of row wire should be connected to the higher of
233 the pins on the switch using a diode. Be aware that diodes are
234 directional! The band around the diode should point to the top of the
235 board. Take care with the upper row that you don't let the wire go too
236 close to the top edge of the board; avoid getting in the way of the
237 spacer layer. Once the rows are wired, the remaining (negative) pin of
238 each switch should be wired into the negative pin of the switch above
239 and below it with black wire. This should be slightly easier since no
240 diode is necessary. The photo above shows the completed matrix for one
241 side. Test each row and column as you go with a multimeter. You should
242 be able to get continuity from row to column when the corresponding
243 switch is activated.
244
245 After the matrix has been wired on both sides, the next step is to
246 connect the microcontroller. The TMK firmware has the rows in pins D0,
247 D1, D2, and D3 of the microcontroller.
248
249 |------------+----+----+----+----|
250 | row number |  1 |  2 |  3 |  4 |
251 |------------+----+----+----+----|
252 | pin number | D0 | D1 | D2 | D3 |
253
254 You'll need to connect the rows
255 from both the left and right sides into the proper pin. There are more
256 columns than rows, so I used ribbon cable to bring the column
257 connections back to the microcontroller from the outside in. The
258 columns go to pins F0, F1, E6, C7, C6, B6, D4, B1, B0, B5, and
259 B4.
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's important to realize that when you flip over the board
267 in order to solder it, you have to flip over the schematic in your
268 mind too. If you count your columns from the left, you'll get them
269 backwards. (Which I actually did for the first half.)
270
271 [[./controller.jpg]]
272
273 Once you've wired one side of the microcontroller in, it would be a
274 good time to test it. You'll need to compile and upload as per the
275 "Firmware" section above. At this point you should be reading real
276 keycodes from the half of the keyboard that you've wired. Once you've
277 confirmed that's working, continue with the other half. Then screw the
278 other layers in place and you're all set!
279
280 ** Inspiration
281
282 These fine projects all provided inspiration for various aspects of
283 the Atreus, as well as the folks on the =#geekhack= freenode channel.
284
285 - [[http://ergodox.org][Ergodox]]
286 - [[http://deskthority.net/workshop-f7/onehand-20-keyboard-t6617.html][OneHand]]
287 - [[http://blog.fsck.com/2013/12/better-and-better-keyboards.html][keyboard.io]]
288 - [[http://geekhack.org/index.php?topic=48718][ErgoT]]
289
290 ** Builds
291
292 If you've built an Atreus, please let us know (pull request or
293 otherwise) and get your name and link added here:
294
295 - [[http://technomancy.us/173][Phil Hagelberg]]
296 - [[http://blog.tarn-vedra.de/2014/04/reproducing-keyboard-science_1707.html][Moritz Ulrich]]
297 - [[http://geekhack.org/index.php?topic=57007.0][Constantine]]
298
299 ** License
300
301 Copyright © 2014 Phil Hagelberg
302
303 Released under the [[https://www.gnu.org/licenses/gpl.html][GNU GPL version 3]]