PS/2 support on modern USB keyboards
The short version: Two external pull-up resistors of 10 kΩ on the PS/2 DATA and CLK signal lines (corresponding to USB signal lines D- and D+, respectively) are sufficient to interface to a PS/2-capable USB keyboard. Say, to get a macro keyboard with more than 100 macro keys.
The internal pull-up resistors in a microcontroller are not suitable (the resistance is too high for the timing requirements).
Why PS/2?
A keyboard with a PS/2 interface is much easier to interface to with a microcontroller than USB due to the much lower complexity (and even the reception from the keyboard can be done using hardware support in the form of a UART (if the baud rate is known)). PS/2 keyboards are on the whole no longer available (there are exceptions).
But some USB keyboards also support PS/2. The reason is probably because the dedicated mouse and keyboard ports on PC motherboards are still PS/2. Or because some standard old cheap chipset is used. Adapters exist for the physical conversion between the two USB connector and PS/2 connector form factors. But the adapter is not sufficient; the USB keyboard must also support PS/2.
How does it work?
A PS/2-capable USB keyboard detects a PS/2 interface (and switches itself to PS/2 mode) by the presence of pull-up resistors on both USB D- and D+ (corresponding to PS/2 signal lines DATA and CLK).
I have found a pull-up resistor value of 10 kΩ to work fine. Though the original IBM PC has a value of 4.7 kΩ. But the typical internal pull-up resistor value of 50 kΩ in a microcontroller is too high (the effective capacitance makes the signal too slow for reliable operation).
Connection
The USB connector is a Type A connector.
Note that with the standard adapters, it isn’t necessary to know the signal mapping; using the two pull-up resistors, the USB keyboard will appear as any other PS/2 keyboard. But the information can be used to create your own adapters.
PS/2 pin# | PS/2 signal | USB pin# | USB signal | Notes |
---|---|---|---|---|
1 | DATA | 2 | D- | |
5 | CLK | 3 | D+ | |
4 | 5V | 1 | 5V | |
3 | GND | 4 | GND |
What USB keyboards support PS/2?
Ironically, it tends to be for the cheaper keyboards. I haven’t observed PS/2 support on any (expensive) mechanical keyboard.
There isn’t any way to know before a purchase—unless reading this very blog post, of course! PS/2 support (or lack of PS/2 support) is not documented anywhere. It needs to be established empirically.
Examples of keyboards that do support PS/2
Many of these cheap keyboards are names of import companies that buy on the spot market, put their own brand and model numbers on the keyboards, and sell to supermarkets or local distributors.
- Nohro (model number 1030075). A small form-factor rubber dome keyboard (without a numeric keypad).
- Altar “Anhur” gaming keyboard (model number 103008). Full-size cheap rubberdome keyboard. With backlight (but not on the keys themselves—thus of no help in darkness…)
- Nohro Forged (model number 1030449-1). A small form-factor cheap rubberdome keyboard (without a numeric keypad). With backlight, incl. the key legends themselves.
- Most separate (wired) numeric keypads, at least the cheap ones. Examples: Nohro (model number 1030094-S) and Deltaco TB-121.
Examples of keyboards not supporting PS/2
- Ducky Shine 7
- CK550 V2
- ASUS KB34211 (a slim wired rubberdome keyboard)
Leave a Reply