Instructables

The Arduino PS/2 Keyboard Smart Interface

Picture of The Arduino PS/2 Keyboard Smart Interface
The Problem:

Many of my arduino projects need keyboard data entry. The library needed to process keyboard scan codes is hefty, not leaving much space and cpu time for the "real" project.

The Solution:

Off load the scancode processing to another Arduino, that can then pass characters to a host microcontroller (Arduino, Pic, Basic Stamp, etc.)

Welcome to the world of smart shields!

To start this project you will need two Arduino boards and a PS/2 Keyboard Jack. At the end, you can build a DIY Barebones Arduino to host the keyboard interface and code.
 
Remove these adsRemove these ads by Signing Up

Step 1: Reading the keyboard scans

Picture of Reading the keyboard scans
For this step you will need a ps/2 mini din, full size (xt) din, or usb jack (only some usb keyboards are backwards compatible). Connect it to an Arduino using 4 wires, for Interrupt (Clk - D3 on the arduino or pin 5 on the atmel328P-PU), Data (D4 or pin 6) , +5v, and Gnd.

Download the keyboard library and upload the TX sketch to the Arduino. Check to see that you are reading the keystrokes in the serial monitor. 

The schematic shows D5 as the TX port to the host Arduino, but we will be using D10 (Atmel pin 16) eventually. Just make sure you edit the code for whatever digital pin you choose to use.

Step 2: Receiving the characters on the Host Arduino

Picture of Receiving the characters on the Host Arduino
On your second Arduino (or whatever your host controller is), you need to read the serial data from the smart shield. This example will show the code for the Arduino. We are using pin 10 to receive the data. RX Code is available at  

http://arduinotronics.blogspot.com/2013/09/arduino-keyboard-shield-part-3.html

Open the serial monitor for this Arduino, and you should see the keystrokes being transmitted from the smart shield. You may have to press reset on the smart sensor to get everything to sync up.






audreyobscura9 months ago
Sweet! thanks for publishing this.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!