This is a PS/2 to USB keyboard converter with some nice features.
HISTORY- 2011/01/23 Initial version
- 2011/01/24 FIX: handle keys which need exceptional treatment
- 2011/02/25 added V-USB support
- 2011/05/31 PS/2 Multimedia key support.
- 2011/12/05 ISO/JIS keyboard support.
FEATURES- Mouse keys
You can emulates mouse move and button click using keyboard.
- Multimedia keys
You can send key event like: system control(Power down, sleep,...), Volume down/up and Mute, Media control, Application launch, Browser control.
- USB NKRO(actually 120KRO+8Modifiers)
You can tolggles NKRO/6KRO feature.
- Keymap customization
You can customize keymaps easily by editing source code. See keymap.c
BUILD CONVERTERConnect
CLOCK line to
PF0 pin and
DATA line to
PF1 pin. Needless to say, you need to wire
Vcc and
GND line too. You can change pin configuration by editing config.h.
This is my PS/2 harness which connect a keyboard to Teensy. Vcc is yellow, GND is green, Data is red and Clock is black in this case.
NOTE: Pullup resistors(1k-10k) on both Data and Clock line are recommended though my converter doesn't has them.
BUILD FIRMWARE- $ git clone git://github.com/tmk/tmk_keyboard.git
Or download from here: https://github.com/tmk/tmk_keyboard/downloads
- $ cd ps2_usb
- Edit config_pjrc.h to macros to define macros for PS/2 signal lines. This is probably not needed.
- Edit Makefile for build options and MCU setting. Use 'atmega32u4' for Teensy 2.0 or 'at90usb1286' for Teensy++ 2.0.
- Edit your keymaps in keymap.c if needed.
- Make. Just type 'make' in a terminal if AVR GCC toolset is properly setup.
- Write a firmware with your Teensy with Teensy Loader.
http://www.pjrc.com/teensy/loader.html[/LIST]
DEMONSTRATION OF FEATURESIn default configuration, you can try several keymaps, mousekeys and USB NKRO.
Use following magic key combinations to enable some features.
Special functions- Magic+0: Qwerty layout with mousekeys
- Magic+1: Qwerty layout(use if you mind mousekeys)
- Magic+2: Colemak layout
- Magic+3: Dvorak layout
- Magic+4: Workman layout
- Magic+N: toggles NKRO/6KRO(6KRO by default)
- Magic+Esc: sends Power Event/Remote wakeup
where
Magic=
(LShift+RShift) or
(LControl+RShift)Fn layer function- Fn0+(hjkl): Mouse key move(vi cursor)
- Fn0+(yuio): Mouse wheel(left,down,up,right)
- Fn0+space: Mouse button1
- Fn0+(mnb): Mouse buttons(1,2,3)
- Fn0+(zxc): Media control(Volup, Voldown, Mute)
- Fn1+(hjkl): Cursor move(vi cursor)
- Fn1+(nm,.): Cursor move(Home,PageDown,PageUp,End)
where
Fn0=
;,
Fn1=
/KEYMAP LAYERSLayer 0: Qwerty with mousekeys
,-----------------------------------------------------------.
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
|-----------------------------------------------------------|
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|-----------------------------------------------------------|
|CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return |
|-----------------------------------------------------------|
|Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift |
|-----------------------------------------------------------|
|Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
`-----------------------------------------------------------'
; = Fn0(to Layer 5)
/ = Fn1(to Layer 6)
Layer 1: Qwerty
,-----------------------------------------------------------.
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
|-----------------------------------------------------------|
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \|
|-----------------------------------------------------------|
|CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return |
|-----------------------------------------------------------|
|Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift |
|-----------------------------------------------------------|
|Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
`-----------------------------------------------------------'
Layer 2: Colemak
,-----------------------------------------------------------.
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
|-----------------------------------------------------------|
|Tab | Q| W| F| P| G| J| L| U| Y| ;| [| ]| \|
|-----------------------------------------------------------|
|BackSp| A| R| S| T| D| H| N| E| I| O| '|Return |
|-----------------------------------------------------------|
|Shift | Z| X| C| V| B| K| M| ,| ,| /|Shift |
|-----------------------------------------------------------|
|Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
`-----------------------------------------------------------'
Layer 3: Dvorak
,-----------------------------------------------------------.
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa|
|-----------------------------------------------------------|
|Tab | '| ,| .| P| Y| F| G| C| R| L| /| =| \|
|-----------------------------------------------------------|
|BackSp| A| O| E| U| I| D| H| T| N| S| -|Return |
|-----------------------------------------------------------|
|Shift | ;| Q| J| K| X| B| M| Wl V| Z|Shift |
|-----------------------------------------------------------|
|Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
`-----------------------------------------------------------'
Layer 4: Workman
,-----------------------------------------------------------.
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa|
|-----------------------------------------------------------|
|Tab | Q| D| R| W| B| J| F| U| P| ;| [| ]| \|
|-----------------------------------------------------------|
|CapsLo| A| S| H| T| G| Y| N| E| O| I| '|Return |
|-----------------------------------------------------------|
|Shift | Z| X| M| C| V| K| L| ,| ,| /|Shift |
|-----------------------------------------------------------|
|Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
`-----------------------------------------------------------'
Layer 5: Mousekeys
,-----------------------------------------------------------.
|Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backspa|
|-----------------------------------------------------------|
|Tab |MwL|MwU|McU|WwU|WwR|MwL|MwD|MwU|MwR| | | | \|
|-----------------------------------------------------------|
|CapsLo| |McL|McD|McR| |McL|McD|McU|McR|Fn0| |Return |
|-----------------------------------------------------------|
|Shift |VoD|VoU|Mut|Mb2|Mb3|Mb2|Mb1|VoD|VoU|Mut|Shift |
|-----------------------------------------------------------|
|Ctrl |Gui |Alt | Mb1 |Alt |Gui |Menu|Ctrl|
`-----------------------------------------------------------'
Mc = mouse cursor
Mw = mouse wheel
Mb = mouse button
Vo = Volume, Mut = Mute
Layer 6: Cusorkeys
,-----------------------------------------------------------.
|Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Backspa|
|-----------------------------------------------------------|
|Tab |Hom|PgU| Up|PgU|End|Hom|PgD|PgU|End| | | | \|
|-----------------------------------------------------------|
|CapsLo| |Lef|Dow|Rig| |Lef|Dow| Up|Rig| | |Return |
|-----------------------------------------------------------|
|Shift | | | | | |Hom|PgD|PgU|End|Fn1|Shift |
|-----------------------------------------------------------|
|Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl|
`-----------------------------------------------------------'
V-USB SUPPORTYou can also use this converter on
ATmega(168/328) or arduino with V-USB instead of Teensy.
The converter on V-USB lacks some features now:
USB NKRO and
System/Media control.
To build a firmware use Makefile.vusb instead of Makefile.
Circuit:
V-USB Circuit
-------------
+---+ +---------------+
USB GND | | ATmega168 |
=== C3 | |
5V <-------+--------+---|Vcc,AVCC | PS/2
R1 | | ====
D- <----+--+-----R2-----|INT1 RXD|------->DATA
D+ <----|---+----R3-----|INT0 XCK|------->CLOCK
Z1 Z2 | | ->5V
GND<----+---+--+--+-----|GND | ->GND
| | | |
| C2-+--|XTAL1 |
| X1 | |
+--C3-+--|XTAL2 |
+---------------+
R1: 1.5K Ohm
R2,R3: 68 Ohm
Z1,Z2: Zenner 3.6V
C1,C2: 22pF
C3: 0.1uF
X1: Crystal 20MHz(16MHz/12MHz)
This is my V-USB converter on breadboard.
