■ FIGURE 4.
Breadboard setup
before connecting
the touchpad.
pin B. 3 which gave me four touch
inputs in a row on that side also.
Figure 4 is a photo of my final
breadboard setup for the stripboard
touchpad, before I connected the
two ribbon cable assemblies. In it,
you can see the two four-pin, double-ended male headers into which the
ribbon cables will be inserted. If you
use this approach, don’t forget to
make sure that you are using the
same four out of five positions on
both ends of each ribbon cable. The
simplest way to do this is to align the
first pin of each male header with the
first position on each end of the
cable (marked with the red stripe), as
shown in the photo of the complete
breadboard setup in Figure 5.
TESTING THE
COMPLETED MATRIX
TOUCHPAD
Hoping to improve the situation,
I switched to the touch16 command
which was, in fact, somewhat better.
Using it, I could reliably detect which
column was being pressed, but the
row measurements were still
unreliable. In addition, my software
frequently failed to detect a touch
input at all if I pressed the key a little
too quickly. I spent several frustrating
hours trying various adjustments in
the touch16 command’s
configuration byte, including several
attempts that defined two different
configuration bytes for the row and
column inputs to see if I could
improve the reliability of the row
measurements using that approach.
However, I was never able to
reliably detect which row was being
pressed. I did learn a fair amount
about the configuration byte, though.
Most importantly, I was able to speed
up the touch measurements
sufficiently enough to eliminate the
problem of quick key-presses being
undetected by the software.
Changing bits 7-5 of the
configuration byte from the default of
“000” to “111” easily corrected the
problem. If you want to explore these
issues on your own, the last test
program that I worked with
(TouchMatrix Test.bas) is available in
the downloads.
Last time, we worked with the
18M2’s touch command. Similarly to
the PICAXE ADC
commands, there
are actually two
different touch
commands: touch
and touch16. As
you might suspect,
For my first test of the stripboard
keypad, I used the touch command
to simply measure the values for the
eight touch inputs that we are using,
and sent them to the terminal
window for viewing. I was
disappointed when I couldn’t find
any reliable differences in the touch
measurements, no matter which key I
pressed. This was especially true for
the row inputs. Of course, that isn’t
surprising, since those inputs are
connected to the bottom stripboard
which means that the row traces (as
compared to the column traces) are
further away from my finger
whenever I touch a key.
touch uses an eight-bit variable, while
touch16 uses a 16-bit variable which
gives it more precision of
measurement. In addition, touch16
also includes an optional
configuration byte that can be used
to “fine tune” the operation of the
touch16 command when necessary.
(For details, see the documentation
for the touch16 command in Section
2 of the PICAXE manual).
A LITTLE THEORY
■ FIGURE 5. Breadboard setup after
connecting the touchpad.
In addition to experimenting with
stripboard-based touch inputs, I have
also done some web-based research
on the topic of designing a PCB
version of a touch-sensitive keypad. I
didn’t find much useful information
until I read a message on the PICAXE
forum that mentioned an Application
Note (AN1104) published by
Microchip Technology, and titled
Capacitive Multibutton
Configurations. (This is just one more
example of how valuable the PICAXE
forum can be. If you aren’t already a
member, it’s well worth joining!) If
you’re interested in reading this
application note, go to the Microchip
website ( www.microchip.com) and
search for “AN1104.”
16
February 2011