www.nutsvolts.com/index.php?/magazine/article/february2011_PICAXEPrimer
PICAXE PRIMER
as possible. (In the top view,
LochMaster has rotated the key labels
180 degrees for some strange reason;
just ignore that!) The construction of
the second stripboard in the
sandwich is identical to the first one.
Of course, there’s no need to add
key labels to it.
The key arrangement on the
touchpad is one that I have used
before. The “B” key is intended to be
used as a “Back” button, the “E” key
is “Enter,” and the four arrow keys
are for cursor movements (left, right,
up, and down). Even though the 10
digits are in a somewhat nonstandard arrangement, the layout
works well for me; mainly because
the four arrow keys are spaced
correctly, and Enter is in the lower
right corner where it belongs. Of
course, you can easily redefine the
key layout in software if you prefer a
different arrangement.
The reason for the double-row
header at the top of the stripboard is
that I like to use ribbon cable
assemblies for connections like this. If
you also use this approach, you will
need to use male headers with
slightly longer pins so they can be
reverse-mounted. This is because in
the final assembly, both boards will
be used with their bottom sides
facing up. If you prefer, you can use
female headers on the stripboards,
and just connect jumper wires to
your breadboard. In that case, single-row headers would be sufficient. Of
course, you can also skip the headers
altogether, solder jumper wires
directly to the stripboards, and just
plug the other ends of the jumper
wires into the breadboard.
As I have already mentioned, the
construction of the two stripboards is
identical, and the layout is simple
enough to not require a formal
schematic. Essentially, each column
(and row) consists of four traces that
are electrically connected to one (or
two, for ribbon cables) pin(s) on the
header. Similarly to our previous
touch sensor experiments, the two
traces between each column (or row)
just spread out the keys to make
them easier to press reliably.
In my first attempt at soldering
the boards, I tried to
solder short bare
jumpers on the bottom
of the board at the
appropriate locations in
row 4 of the layout
shown earlier in Figure
1. However, even with a
small spring clamp
holding it in place, a
jumper would
frequently slide out of
position as I tried to
solder it which was very
frustrating! It finally
dawned on me that it
would be easier to
insert a 0.3 inch jumper
wire (with excess length
on one end) from
the top of the board
into the ends of
each set of four holes, and then bend
the excess lead back to the other
end of the jumper on the bottom of
the board. The jumpers were quick
and easy to install using this
approach; just be sure to solder the
lead on the bottom of the board to
all four traces.
When both boards are
completed, refer to Figure 2 to
assemble the sandwich. The bottom
board — which is used for the row
inputs — is oriented so that its header
is on the left with the bottom of the
board facing up. It’s difficult to see in
the photograph, but the header pins
are protruding from the trace-side of
both boards, so a ribbon cable can
easily be attached to each board.
The top board — which is used
for the column inputs — is placed on
top of the bottom board (again, with
its bottom side facing up) so that its
header is at the top. The two boards
are aligned so that their bottom and
right edges line up. On top of
the “column” board, I placed a
paper template for the key
layout (actually, a full-size
printout of the LochMaster
layout), trimmed it to fit, and
then taped the entire assembly
together with transparent
packing tape.
In addition to identifying
the key locations, the label and
■ FIGURE 2. Assembled 4x4 matrix touchpad.
tape also serve to insulate the traces
from direct contact by a finger.
Because the PICAXE touch inputs
actually measure capacitance, it’s
important to always insulate touch
sensors from the possibility of direct
contact.
As soon as my keypad was
completed, I set up a simple 18M2
breadboard circuit to test it. Figure 3
shows the pin connections I used for
the two headers. I chose this specific
pin arrangement to make the
breadboard connections as simple as
possible. On one side of the 18M2,
pins B. 4 through B. 7 are all touch
inputs (see the 18M2 pin-out from
the previous Primer column); I
connected those inputs to the
“column” header pins. On the other
side of the 18M2, there are only
three contiguous touch inputs, so I
ran a jumper wire from pin C. 2 (the
only other touch input on that side of
the chip) down to one position below
■ FIGURE 3.
I/O pin
connections
for row and
column
inputs.
Column 1
Column 2
Column 3
Column 4
Row 1
Row 2
Row 3
Row 4
Matrix Pin
I/O Pin
B. 5
B. 4
B. 7
B. 6
B. 3
C. 2
B.1
B. 2
February 2011 15