1 Alternative Controller for HHKB pro
2 ===================================
3 I want to add vi cursor and mouse keys to HHKB. Original HHKB controller is not programmable and
4 firmware source code is not open. So, customizing HHKB needs to replace original controller with programmable one.
5 I used Teensy++ as alternative controller. Though a Teensy has enough ports to drive HHKB,
6 Teensy++ has clean pinout and it makes programing and wiring easier.
8 This is just a proof of concept for replacing controller of HHKB, not a complete firmware.
10 My prototype firmware source tree is here:
11 branch: hhkb(http://github.com/tmk/tmk_keyboard/tree/hhkb)
12 This firmware is a port of my previous project:
13 HHKB style Mod(http://geekhack.org/showwiki.php?title=Island:11930)
15 http://www.pjrc.com/teensy/
19 * without pattern cuting, case mod and soldering
20 * can keep original controller intact
21 * can change HHKB behaviour as you like(by C programming)
25 * unavailability of Teensy++/Teensy(because of PS3 cracking boom?)
30 * mouse keys for minimum mouse operation(never comfortable for normal use)
31 * and more...(in the future)
33 Any suggestions or ideas are welcome.
37 My HHKB is just "Professional". This means followings may not be applied to "Professional2".
39 I'm not a professional for electronics and MCU programming. This may damage your HHKB.
40 And my English writing is poor, I'm not sure I can convey my notions accurately.
45 Angled USB mini B adapter is used to install Teensy++ laterally.
48 Bread baord cables used for connect Teensy++.
50 (connector_contact.jpg)
55 HHKB pro has two PCBs and some chips.
58 M38K07M4 Renesas MCU with USB function
59 http://documentation.renesas.com/eng/products/mpumcu/rej03b0192_38k0ds.pdf
63 HC4051 Analog Multiplexer: select a row line.
64 http://www.alldatasheet.com/datasheet-pdf/pdf/203989/KODENSHI/KK74HC4051A.html
65 LS145 BCD Decoder: select a column line.
66 http://www.alldatasheet.com/datasheet-pdf/pdf/27373/TI/SN74LS145D.html
67 BU9831 Non-volatile electronic potentiometer: for calibration?
68 http://www.alldatasheet.com/datasheet-pdf/pdf/36387/ROHM/BU9831.html
69 TP1684 Capacitive Sensing controller: no datasheet available.
75 Two PCBs are connected by 15 lines. Vcc/GND uses 3 lines each, 9lines for keyboard signaling.
77 Keyswitch PCB connector Teensy++ pins
78 -------------------------------------------------------------------------------
82 4 TP1684 KEY: Low(0) when key pressed PE6 input w/o pullup
83 5 TP1684 unknown:how to use PE7 input w/o pullup
84 6 HC4051 A(bit0) select 8 rows(0 to 7) PB0 output
85 7 HC4051 B(bit1) PB1 output
86 8 HC4051 C(bit2) PB2 output
87 9 LS145 A(bit0) select 8 columns(0 to 7) PB3 output
88 10 LS145 B(bit1) PB4 output
89 11 LS145 C(bit2) PB5 output
90 12 LS145 D(enable) Low(0) enable selected column PB6 output
99 60 keyswitches in 8*8 matrix. ghost free. bounce free.
102 ROW ---------------------------------------------------------------
105 2| 5 6 y t g h n _NONE_
106 3| 1 Esc Tab Control LShift LAlt LMeta Space
107 4| 7 8 u i k j m _NONE_
108 5| \ ` Delete Return Fn RShift RAlt RMeta
109 6| 9 0 o p ; l , _NONE_
110 7| - + ] [ ' / . _NONE_
114 +-------------------------+-+-+-+-+-+-+-+ Vcc
115 |bias control? - - - - - - - - ---
116 | 3.9K*8 R R R R R R R R |
117 +--------^+ +--------+ - - - - - - - - |
118 | TP 1684 | | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
119 | |capa. | <1-------|-|-|-|-|-|-|-|--|R|-+
120 | |sense | <2-------|-|-|-|-|-|-|-|--|R|-+
121 | <------| <3-------|-|-|-|-|-|-|-|--|R|-+
122 | | | <4-------|-|-|-|-|-|-|-|--|R|-+
123 | | | <5-------|-|-|-|-|-|-|-|--|R|-+
124 | |calib.| <6-------|-|-|-|-|-|-|-|--|R|-+
125 | <-+? | <7-------|-|-|-|-|-|-|-|--|R|-+
126 +---V-----+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
127 KEY ??? | A B C +-----------------+
128 | | +-^----+ | | | | LS145 |
129 Vcc | | |BU9831| | | | +-^--^--^--^------+
130 --- | | +------+ | | | A B C D +------+
131 | | | | | | | | | | | |
132 1-3 4 5 6 7 8 9 10 11 12 13-15 |
133 +--------------------------------------------------+ |
135 +--------------------------------------------------+ GND
140 While pressing space bar, watched HHKB original controller signals by logic analyzer.
141 Row and column is looping between 0-7 each for selecting a key.
142 A key is scaned every about 15ms, so scan rate is 66Hz.
145 Space bar locate at ROW:3 COL:7. Key are selected by HC4051(C,B,A) and LS145(C,B,A).
146 Key state can be read on TP1684(4/KEY) while asserting low on LS145(D).
147 Usage of TP1684(5) is unknown. Key state can be read without using this signal.
151 Matrix scan pseudo code:
153 SELECT_ROW(row); // set HC4051(A,B,C)
156 SELECT_COL(col); // set LS145(A,B,C)
160 ENALBLE_COL(); // set LS145(D) to low
164 if (KEY == 0) { // read TP1684(KEY)
175 Followings are added layers with additional Fn keys. They are not final decision.
177 Layer0(Default Layer):
178 ,-----------------------------------------------------------.
179 |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
180 |-----------------------------------------------------------|
181 |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Backs|
182 |-----------------------------------------------------------|
183 |Contro| A| S| D| F| G| H| J| K| L| ;| '|Return |
184 |-----------------------------------------------------------|
185 |Shift | Z| X| C| V| B| N| M| ,| .| /|Fn2 |Fn1|
186 `-----------------------------------------------------------'
187 |Gui|Alt |Space |Fn3 |Gui|
188 `-------------------------------------------'
190 Layer1(Fn1) HHKB mode:
191 ,-----------------------------------------------------------.
192 |Pow| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
193 |-----------------------------------------------------------|
194 |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
195 |-----------------------------------------------------------|
196 |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
197 |-----------------------------------------------------------|
198 |Shift | | | | | | +| -|End|PgD|Dow|Shift |xxx|
199 `-----------------------------------------------------------'
200 |Gui |Alt |Space |Alt |Gui|
201 `--------------------------------------------'
203 Layer2(Fn2) mouse mode:
204 ,-----------------------------------------------------------.
205 |Esc| | | | | | | | | | | | | | |
206 |-----------------------------------------------------------|
207 |Tab | | | | | | | | | | | | |Backs|
208 |-----------------------------------------------------------|
209 |Contro| | | | | | | |MwL|MwD|MwU|MwR|Return |
210 |-----------------------------------------------------------|
211 |Shift | | | | | | |McL|McD|McU|McR|xxxxxx| |
212 `-----------------------------------------------------------'
213 |Gui |Alt |Mb1 |Mb1 |Mb2|
214 `--------------------------------------------'
217 ,-----------------------------------------------------------.
218 |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |
219 |-----------------------------------------------------------|
220 |Tab | | | | | |Hom|PgD|PgUlEnd| |MwD|MwU|Backs|
221 |-----------------------------------------------------------|
222 |Contro| | | | | |Lef|Dow|Up |Rig| | |Return |
223 |-----------------------------------------------------------|
224 |Shift | | | | | | |McL|McD|McU|McR|Mb1 | |
225 `-----------------------------------------------------------'
226 |Gui|Alt |Mb1 |xxxxx|Mb2|
227 `-------------------------------------------'
228 Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel