The Official Raspberry Pi Projects Book - Projects_Book_v4

(singke) #1

Review


raspberrypi.org/magpi The Official Raspberry Pi Projects Book 181


Six touch-
sensitive
buttons
to use for
whatever
your heart
desires
Pimoroni

Maker
Says

TOUCH PHAT


eed to add some button
controls to a project you’re
making? Pimoroni’s
Touch pHAT makes it easy. This Pi
Zero-sized board boasts six touch-
sensitive buttons which light up
when pressed; white LEDs located
on the underside produce a yellow/
green glow through the translucent
board sections. While the buttons
are marked A, B, C, D, Back, and
Enter (and referred to as such when
coding), each has a large white area
for custom labelling with a sticker
or dry-wipe marker.
The pHAT is supplied with a
female header which you’ll need
to solder in place. While the board
has a Pi Zero form factor, it can be
used with any 40-pin Pi model.
Equipped with a CAP1166 capacitive
touch and LED driver chip, it
uses I^2 C for communication, and
therefore requires only two GPIO
pins. No standoffs are supplied,
but you may want to add some to

keep the pHAT rock steady on top
of the Pi as you press the buttons.
Alternatively, you could combine
it with Pimoroni’s neat-looking
Pibow Zero W case.
Like most Pimoroni add-ons,
the Touch pHAT has its own
Python library, which is easily
installed – along with any missing
dependencies – using a single
Terminal command. A couple of
examples are supplied: a simple
button-press demo and a GUI app
launcher. The code syntax is simple
enough, using on_press and
on_release events to register the
relevant touch actions. It’s then
completely up to you as to what
these will trigger. Possible uses
for the Touch pHAT include as a
control panel for a robot, a remote
control for home automation, a
drum machine / mini piano, and
a Simon game.
Most importantly, the buttons
are very responsive to touch

and will stay triggered/lit until
released; you can press as many
as you like simultaneously,
too. They can even be activated
through a thin transparent
layer if needed. Note that if you
wanted to attach alligator clips
to the buttons to attach remote
triggers (such as pieces of fruit),
you’d have to scrape down to the
copper on each button to make the
connection work.

Last word


The Touch pHAT makes it a lot
easier to add input buttons
to projects, instead of having
to wire up push-buttons
individually. What you use it
for is completely up to you, but
the touch-sensitive buttons
are really responsive and the
light-up effect is a nice bonus.

An easy way to add button inputs to your projects


N


RAINBOW
HAT
Compatible with
Android Things
and Python,
this full-size
HAT features
three capacitive
buttons, a four-
digit display,
LEDs, buzzer,
and sensor.

magpi.cc/2lX1r6h

Related


£24 / $26


TOUCH PHAT


magpi.cc/2pafoP9


£8 /$9

Free download pdf