Hardware dvorak HHKB.

JBert

24 Jul 2012, 21:17

fossala wrote:Just to let people know. If you hold both shifts and try to type "the quick brown fox....." the controller seems to crash and I have to unplug it then put it back in.
Don't do that stupid test then. It only tests whether the matrix supports both shift keys + one extra and is not a conclusive test for xKRO. And most of all, it is highly synthetic: it is not often that you press both Shift keys.

User avatar
fossala
Elite +1

28 Jul 2012, 17:05

I ended up securing it in place with no more nails double sidded tape. Seems to do the job.

dfxdx

29 Jul 2012, 00:52

Any chance of some photos? Thanks.

User avatar
Soarer

14 Aug 2012, 14:07

Soarer wrote:The only code changes needed to make it work on the non++ Teensy were in hhkb/matrix.c, to use PF0 and PF1 instead of PE6 and PE7. And of course changing the MCU definition in hhkb/Makefile.pjrc to atmega32u4. Any pins could be used, but those worked out nicely for the wiring.

I was asked in a PM for more detail about the code changes I made for the non++ Teensy, so here they are! These defines match the wiring diagram I posted. It looks a lot more than it really is because this is a single chunk to paste over the existing defines. Just match the first and last lines of the chunk in hhkb/matrix.c...

Code: Select all

#ifdef HOST_PJRC
#if defined(__AVR_AT90USB1286__)
// Ports for Teensy++ 2.0
// row:     PB0-2
// col:     PB3-5,6
// key:     PE6(pull-uped)
// prev:    PE7
#define KEY_INIT()              do {    \
    DDRB |= 0x7F;                       \
    DDRE |=  (1<<7);                    \
    DDRE &= ~(1<<6);                    \
    PORTE |= (1<<6);                    \
} while (0)
#define KEY_SELECT(ROW, COL)    (PORTB = (PORTB & 0xC0) |       \
                                         (((COL) & 0x07)<<3) |    \
                                         ((ROW) & 0x07))
#define KEY_ENABLE()            (PORTB &= ~(1<<6))
#define KEY_UNABLE()            (PORTB |=  (1<<6))
#define KEY_STATE()             (PINE & (1<<6))
#define KEY_PREV_ON()           (PORTE |=  (1<<7))
#define KEY_PREV_OFF()          (PORTE &= ~(1<<7))
#define KEY_POWER_ON()
#define KEY_POWER_OFF()
#else
// Ports for Teensy 2.0
// row:     PB0-2
// col:     PB3-5,6
// key:     PF0(pull-uped)
// prev:    PF1
#define KEY_INIT()              do {    \
    DDRB |= 0x7F;                       \
    DDRF |=  (1<<1);                    \
    DDRF &= ~(1<<0);                    \
    PORTF |= (1<<0);                    \
} while (0)
#define KEY_SELECT(ROW, COL)    (PORTB = (PORTB & 0xC0) |       \
                                         (((COL) & 0x07)<<3) |    \
                                         ((ROW) & 0x07))
#define KEY_ENABLE()            (PORTB &= ~(1<<6))
#define KEY_UNABLE()            (PORTB |=  (1<<6))
#define KEY_STATE()             (PINF & (1<<0))
#define KEY_PREV_ON()           (PORTF |=  (1<<1))
#define KEY_PREV_OFF()          (PORTF &= ~(1<<1))
#define KEY_POWER_ON()
#define KEY_POWER_OFF()
#endif // MCU
#else
// Ports for V-USB
And in hhkb/Makefile.pjrc, change the MCU setting like this...

Code: Select all

#MCU = at90usb162       # Teensy 1.0
MCU = atmega32u4       # Teensy 2.0
#MCU = at90usb646       # Teensy++ 1.0
#MCU = at90usb1286      # Teensy++ 2.0
The other detail is which way round to wire the connector, since it only fits one way. In fossala's Pro 2, the cable to the stock controller had coloured wires, so I used the same colours for the build and the wiring diagram. It's easy to check if you have the keyboard and connector in front of you, so this is just a reminder to check before starting to solder :lol:

This improved wiring diagram now includes the connector. It is from my memory and notes... I will not accept responsibility for any mistakes!!

Please double and triple check, because wiring it backwards would probably be fatal for your precious!!
teensy_pinout_hhkb_pro2_with_conn.png
teensy_pinout_hhkb_pro2_with_conn.png (161.92 KiB) Viewed 7441 times

User avatar
Soarer

16 Aug 2012, 13:28

Oops! Looks like hasu has changed that part of his code since I did fossala's!

In the latest code, try inserting this block instead, just before the line #elif defined(__AVR_ATmega328P__) in matrix.c.

Code: Select all

#elif defined(__AVR_ATmega32U4__)
// Ports for Teensy 2.0
// row:     PB0-2
// col:     PB3-5,6
// key:     PF0(pull-uped)
// prev:    PF1
#define KEY_INIT()              do {    \
    DDRB |= 0x7F;                       \
    DDRF |=  (1<<1);                    \
    DDRF &= ~(1<<0);                    \
    PORTF |= (1<<0);                    \
} while (0)
#define KEY_SELECT(ROW, COL)    (PORTB = (PORTB & 0xC0) |       \
                                         (((COL) & 0x07)<<3) |    \
                                         ((ROW) & 0x07))
#define KEY_ENABLE()            (PORTB &= ~(1<<6))
#define KEY_UNABLE()            (PORTB |=  (1<<6))
#define KEY_STATE()             (PINF & (1<<0))
#define KEY_PREV_ON()           (PORTF |=  (1<<1))
#define KEY_PREV_OFF()          (PORTF &= ~(1<<1))
#define KEY_POWER_ON()
#define KEY_POWER_OFF()

dfxdx

08 Sep 2012, 11:54

Just replicated this mod last night. To my incredible surprise it worked first time - I thought that my not-yet-that-proficient soldering skills would let me down. A very big thanks to Soarer for the excellent instructions and the Teensy++ to Teensy mod, Fossala for the write-up and Hasu for the original code etc. Much respect to Soarer - soldering the wires to the header and still leaving enough room for the heatshrink tubing is quite tricky - good job! If I can add my little contribution to the knowledge base. Should be filed in the 'Difference between a pro and a dumb-ass' section:
1/ Definitely get a decent soldering iron. I am currently using a 12 W model that I bought from Argos years ago. I can only get needle-nosed tips which in itself is not a big issue but the iron has problems heating the end of the tip meaning that I had to continually apply heat from a spot about 3mm from the end. Absolute pain.
2/ Did this late last night and while I did double-check the pin-mappings, I did not double check the direction of the wires going into the Teensy. Managed to solder everything down before I realised the orientation of the header connection and the Teensy. Everything matched the excellent pin-out that Soarer documented but I had the wires going into the top of the Teensy which meant I had to twist the wires 180deg to get the USB connector to match the hole in the case and header connection from the keyboard.
Thanks again everyone.

belanger

15 Sep 2012, 01:06

Hello,

I'm new here and after seeing this mod and others, I just ordered myself a HHKB Pro 2 .

I have Mac and PC ... with the original controller, there are dip switches. How does it work with this controller to switch between Mac and PC?

Thank you,
PBR

dfxdx

17 Sep 2012, 14:21

Works just as any normal USB keyboard would. On my Mac when I first plugged it in I got a wizard that asked me to press some keys on the keyboard (just follow the on-screen prompts). After that it just configured itself as a US keyboard. Works great.

User avatar
uberben

26 Nov 2012, 05:41

megnin wrote:An HHKB with embedded numpad... that's almost the perfect keyboard.

If I could get mine modded into a dual Bluetooth/corded with embedded numpad I'd carry it with me everywhere I went.
I'm currently working on a bluetooth mod for my Kinesis right now based on hasu's firmware. If all goes well and there is the interest, I'm thinkig of making a dev board like the teensy that has built in bluetooth and li-po charger, as well as mounting holes.

User avatar
fossala
Elite +1

26 Nov 2012, 07:45

I would be down for one.

User avatar
Jim66

30 Nov 2012, 11:58

uberben wrote:
megnin wrote:An HHKB with embedded numpad... that's almost the perfect keyboard.

If I could get mine modded into a dual Bluetooth/corded with embedded numpad I'd carry it with me everywhere I went.
I'm currently working on a bluetooth mod for my Kinesis right now based on hasu's firmware. If all goes well and there is the interest, I'm thinkig of making a dev board like the teensy that has built in bluetooth and li-po charger, as well as mounting holes.
That does sounds pretty awesome.

HelgeG

30 Nov 2012, 15:59

I am glad I found this post, a Teensy is in place (and programmed), and now I am just waiting for a header and a ribbon cable from DigiKey. Looking forward to getting the mod done!

HelgeG

04 Dec 2012, 12:38

uberben wrote:I'm currently working on a bluetooth mod for my Kinesis right now based on hasu's firmware. If all goes well and there is the interest, I'm thinkig of making a dev board like the teensy that has built in bluetooth and li-po charger, as well as mounting holes.
That would be the perfect solution. I would get the dev board in a heartbeat.

HelgeG

20 Dec 2012, 02:15

I have successfully built the project, and I am very happy with it. Many thanks to hasu, soarer and fossala for the code and the write-ups.

The fact that I can jump to the bootloader by pressing SHIFT+SHIFT+PAUSE is nice, I am constantly modifying keymaps at the moment, and having to open the enclosure every time would be maddening. My one remaining doubt now is how I can get access to the console mode. Can anyone shed some light on this?

User avatar
uberben

20 Dec 2012, 16:38

HelgeG wrote:My one remaining doubt now is how I can get access to the console mode. Can anyone shed some light on this?
I have not yet used the console mode, but as I understand it, you need to connect a USB-serial adapter to the serial port of your microcontroller. One of the many things I want to do is use the USB-serial endpoint of the ATmega32U4 so a second USB connection isn't needed. Hopefully I can get around to that soon (and it doesn't require too much work).

User avatar
hasu

21 Dec 2012, 01:16

To get access to console you need to use PJRC's hid_listen utility. http://www.pjrc.com/teensy/hid_listen.html
Debug console uses PJRC specific protocol and utility, you need no extra hardware, just use hid_listen.
To get help message press LShift+RShift+?orH.

uberben, interesting. USB-serial(CDC) may be better option because its protocol has open specific and we can use existing tools for serial.

HelgeG

04 Jan 2013, 10:42

If anyone is interested, I did a little write up on how my HHKB firmware project went. I am incredibly grateful to hasu, Soarer and fossala for the work they did, without which my own project would not have been possible.

User avatar
hasu

04 Jan 2013, 17:12

Nice write up! I'm overwhelmed by your Fn key on F and J :)

HelgeG

04 Jan 2013, 17:34

hasu wrote:Nice write up! I'm overwhelmed by your Fn key on F and J :)
Thanks, I am glad you liked it. The one thing that bothers me about the HHKB is the clunky access to arrow keys, where the hand has to leave the home row to get to them. Having arrow keys (and other functions) available without having to take my hands off the home row is alone a sufficient reason to use your firmware code!

HelgeG

02 Oct 2013, 12:56

I have just updated my fork to use the latest functionality available in the firmware code, and I am very happy. The firmware can now do everything I wanted to. I did a small post about my update: http://grumpylemming.com/blog/2013/10/0 ... revisited/

Post Reply

Return to “Workshop”