"From Payroll to Body Scanners"
PC Services (Electronics)
Arduino - Hardware Libraries
Tel: 0118 946 3634
This collection of libraries are for handling all aspects of the PS/2 Keyboard protocol and each library has examples. Each library has different levels of capabilities depending on your requirements from basic keycode for all keys, through handling keyboard functionality to converting keycodes to UTF-8 (single byte) codes for localisation support.
By all keycodes, the libraries can cope with PS/2 keycodes from any layout, even ones with multi-media, internet or even 24 function keys (yes they do exist). There are many variants and all keycodes includes the special keys for localisations (different countries).
There are many resources detailing the cabling, connectors, voltage levels and protocol for PS/2 Keyboards, so that information is not going to be repeated here, but links to the main online resources, as follows -
Special Hardware Note
PS/2 keyboards are 5V, and even though they use open collector (or open drain) outputs on the keyboard, most have a pull-up resistor to 5V inside the keyboard, so will produce 5V signals.
When using 3V3 boards like the Due and similar, you must put in some form of bidirectional level translator, to protect your board. Many exist, but FET based or IC based ones perform the best.
We found the Texas Instruments 2 port translator TXS0102DCU, to perform well, they are also available in 4 and 8 port versions if you need to convert other 5V signals as well.
Background On Requirements Collection
These libraries have been tested on Uno, Mega and Due boards using Arduino IDE 1.6.7 initially.
The first phase of this library set creation was a lot of research, gathering all known PS/2 keycodes and control codes, with particular tests on how some keys function on actual keyboards. Did you know the <Pause> key has an four byte code sequence on FIRST press but if held down (for auto-repeat) or used with <Alt> key on many keyboards then only gives the last TWO bytes?
When handling internationalisation and other keyboard layouts, we have all seen the multi-media or internet special keys, but did you know you can have -
Having collated data together, and some data on other country layouts. We reviewed other libraries out there and find that most suffered from
So a set of libraries and examples were built up (and tested), to cover varying levels of need and provide simple testing abilities. All libraries have an examples, starting with output to serial to where appropriate output to attached LCD display.
The Library set
The libraries are split into three separate libraries, (one is an extension of another).
Example of Serial output for each library using the following Key press sequence only pressing ONCE
Obtaining the libraries
The libraries and documentation are available from the Library Manager in the Arduino IDE V1.6.x and above. By following method -
Code and Documentation
The source repository for the files if updated and not available from Arduino IDE is Github repository.
Interested in something similar contact sales.
|© 2016 onwards by PC Services, Reading UK||Last Updated: 17th May 2018|
|If you encounter problems with this page please email your comments to webmaster|