28 November 2013
BUILD IT YOURSELF
QUICK AND EASY USB
KEYBOARD
INPU T By William Pippin Post comments on this article and find any associated files and/or downloads at www.nutsvolts.com/index.php?/magazine/ article/november2013_Pippin.
Ever want a physical trigger to
manipulate keyboard inputs?
Then, this is the circuit for you.
A while ago, I was asked by a
friend if I could design a simple
USB input device to allow
substituting keyboard inputs with
mechanical micro-switch inputs to
operate his TIC-TAC-TOE video
game. It was written in BASIC and
he didn’t want to re-write any of
the program. He also had a
wooden box with nine [in a 3x3
matrix] square holes through
which a player would throw a
beanbag. As the beanbag went
through the opening, a small
switch in the bottom of the hole
would trigger a contact closure.
He then wanted that to somehow
trigger the keyboard keys from 0-9,
and a foot pedal to send a
<backspace> character to reset the
game. He had taken an old
keyboard and wired into that, but
it was clunky, broke easily, and
didn't look very nice when he took
the game to retirement centers to
entertain the people there.
Throw a beanbag through a
wooden slot and get a keystroke
on a PC. Yes, engineering usually
comes in the form of simple
problem-solving. So, here goes —
let's solve this problem.
■ FIGURE 1. Original prototype.
Implementation
Now that we know what this
project is meant to do, let’s get into
the technical aspects of
implementation.
I’ve been designing circuits for a
long time now, so I have a sizeable
stash of circuit building blocks which
get used over and over because they
are well known to me and work every
time. I’ll be using one of these general-purpose PCBs (printed circuit boards)
that’s based on a Microchip
PIC18LF2550 that pretty much acts
like a small USB thumb drive with
several pins of analog or digital I/O.
Figure 1 shows my off-the-shelf PCB
being used in the original prototype.
Notice the simplicity and flow of
this design. Starting on the left, we
have our connection to a PC or USB
cable, a five-pin programming port,