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 github(http://github.com/tmk/tmk_keyboard)
12 This firmware is a port of my previous project:
13 HHKB style Mod(http://geekhack.org/showwiki.php?title=Island:11930)
15 Teensy++/Teensy(http://www.pjrc.com/teensy/)
19 * without pattern cutting, 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".
40 I'm not a professional for electronics and MCU programming. This may damage your HHKB.
41 And my English writing is poor, I'm not sure I can convey my notions accurately.
46 Angled USB mini B adapter is used to install Teensy++ laterally.
49 Bread baord wires are used to connect Teensy++.
51 (connector_contact.jpg)
56 HHKB pro has some chips on separate two PCBs.
59 M38K07M4 Renesas MCU with USB function
60 http://documentation.renesas.com/eng/products/mpumcu/rej03b0192_38k0ds.pdf
65 HC4051 Analog Multiplexer: select a row line.
66 http://www.alldatasheet.com/datasheet-pdf/pdf/203989/KODENSHI/KK74HC4051A.html
67 LS145 BCD Decoder: select a column line.
68 http://www.alldatasheet.com/datasheet-pdf/pdf/27373/TI/SN74LS145D.html
69 BU9831 Non-volatile electronic potentiometer: for calibration?
70 http://www.alldatasheet.com/datasheet-pdf/pdf/36387/ROHM/BU9831.html
71 TP1684 Capacitive Sensing controller: no datasheet available.
79 Two PCBs are connected by 15 lines. Vcc and GND use 3 lines each, other 9 lines are for keyboard signaling.
81 Keyswitch PCB connector Teensy++ pins
82 -------------------------------------------------------------------------------
86 4 TP1684 KEY: Low(0) when key pressed PE6 input(with pullup)
87 5 TP1684 KEY_PREV: assert previous key state??? PE7 output
88 6 HC4051 A(bit0) select 8 rows(0 to 7) PB0 output
89 7 HC4051 B(bit1) PB1 output
90 8 HC4051 C(bit2) PB2 output
91 9 LS145 A(bit0) select 8 columns(0 to 7) PB3 output
92 10 LS145 B(bit1) PB4 output
93 11 LS145 C(bit2) PB5 output
94 12 LS145 D(enable) Low(0) enable selected column PB6 output
104 60 keyswitches in 8*8 matrix. It is ghost-free and bounce-free.
107 ROW ---------------------------------------------------------------
110 2| 5 6 y t g h n _NONE_
111 3| 1 Esc Tab Control LShift LAlt LMeta Space
112 4| 7 8 u i k j m _NONE_
113 5| \ ` Delete Return Fn RShift RAlt RMeta
114 6| 9 0 o p ; l , _NONE_
115 7| - + ] [ ' / . _NONE_
119 +-------------------------+-+-+-+-+-+-+-+ Vcc
120 |bias control? - - - - - - - - ---
121 | 3.9K*8 R R R R R R R R |
122 +--------^+ +--------+ - - - - - - - - |
123 | TP 1684 | | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
124 | |capa. | <1-------|-|-|-|-|-|-|-|--|R|-+
125 | |sense | <2-------|-|-|-|-|-|-|-|--|R|-+
126 | <------| <3-------|-|-|-|-|-|-|-|--|R|-+
127 | | | <4-------|-|-|-|-|-|-|-|--|R|-+
128 | | | <5-------|-|-|-|-|-|-|-|--|R|-+
129 | |calib.| <6-------|-|-|-|-|-|-|-|--|R|-+
130 | <-+? | <7-------|-|-|-|-|-|-|-|--|R|-+
131 +---V-----+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
132 KEY ??? | A B C +-----------------+
133 | | +-^----+ | | | | LS145 |
134 Vcc | | |BU9831| | | | +-^--^--^--^------+
135 --- | | +------+ | | | A B C D +------+
136 | | | | | | | | | | | |
137 1-3 4 5 6 7 8 9 10 11 12 13-15 |
138 +--------------------------------------------------+ |
140 +--------------------------------------------------+ GND
145 While pressing space bar, watched HHKB original controller signals by logic analyzer.
146 Row and column is looping between 0-7 each for selecting a key.
147 A key is scaned every about 15ms, so scan rate is 66Hz.
151 Space bar locate at ROW:3 COL:7. A key is selected by HC4051(C,B,A) and LS145(C,B,A).
152 Key state can be read on TP1684(4/KEY) while asserting low on LS145(D).
154 Usage of TP1684(5) is not clear. Controller seemed to output previous key state on this line.
155 However key state can be read without using this signal.
160 Matrix scan pseudo code:
162 SELECT_ROW(row); // set HC4051(A,B,C)
165 SELECT_COL(col); // set LS145(A,B,C)
169 if (prev_key_state(row, col)) {
175 ENALBLE_COL(); // set LS145(D) to low
179 if (KEY == 0) { // read TP1684(KEY)
186 UNALBLE_COL(); // set LS145(D) to high
195 Followings are added layers with additional Fn keys.