Arduino isn’t limited to taking input from sensors: you can even connect up a full-size PS/2 keyboard just as if it were a “real” computer and type away! Connecting a keyboard to an Arduino may sound a bit odd (after all, it’s just a little microcontroller) but keep in mind that an Arduino actually has more processing power and memory than a complete desktop machine of not so many years ago. Adding some peripherals that you would normally associate with a full-size computer opens up some interesting possibilities.
Perhaps PS/2 seems a bit dated and you’d rather use a modern USB keyboard with your Arduino. After all, even finding a PS/2 keyboard can be tricky now and you may have to go dumpster-diving or hunting through that pile of old hardware in the company storeroom to find one. Using a USB keyboard may sound like the obvious solution but unfortunately an Arduino just isn’t up to the job of acting as a USB host – it’s simply not fast enough. All is not lost however because many USB keyboards are designed for backward compatibility and come with a little purple “USB to PS/2” adapter that allows them to be plugged into a PS/2 port. Keyboards that come with those adapters are designed to detect when they are plugged into a PS/2 port rather than a USB port and automatically revert to acting as a PS/2 device, so this project should work just as well with a modern USB keyboard connected via an adapter as with a genuine antique PS/2 keyboard.
Or if you want to go even more retro you can even use this same circuit with an old-style “AT” keyboard because even though they use a different connector they have the same electrical interface as a PS/2 keyboard.
Source Code
github.com/practicalarduino/Ps2Keyboard
github.com/kristopher/PS2-Mouse-Arduino
www.arduino.cc/playground/uploads/Main/PS2Keyboard_014A.zip
Qty | Description |
1 | Arduino Duemilanove, Arduino Pro, Seeeduino, or equivalent |
1 | Prototyping shield |
1 | PS/2 extension cable or 6-pin mini-DIN socket |
1 | PS/2 keyboard or PS/2 mouse |
10cm | Hookup wire |
Source: PS/2 Keyboard Or Mouse using Arduino