The Official Raspberry Pi Projects Book - Projects_Book_v4

(singke) #1

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


TOUGH PI-ANO Projects


>STEP-01
Wooden chassis
Brian constructed the chassis from pine lumber,
and drilled holes in both the wooden panel and the
protective plastic layer to house the arcade buttons.

>STEP-02
Buttons for keys
While the original design featured conventional
wooden piano keys, these were replaced with
heavy-duty arcade buttons and switches.

>STEP-03
Wiring it up
For each octave, the arcade buttons are wired
to a resistor board, which is connected to a Pi Zero.
A USB sound card is used to output the audio.

MAKE A


TOUGH PIANO


Brian wrote a Python program
using the Pygame library to read the
arcade button presses and play WAV
piano samples. While he considered
adding a 3.5mm jack to each Pi Zero,


he eventually opted to use cheap
USB sound cards to output the audio.
The biggest problem was electrical
noise. “The first octave I built
didn’t have any pull-up resistors


on the keys so they were, of course,
prone to floating. At that point, I
had inadvertently built a touchless
piano,” recalls Brian. 1K resistors
were added to each input to solve
the problem. “There is still some
noise on the audio despite using a
clean power supply and line filter.
Maybe using $0.99 USB audio cards
is to blame.”
While Brian admits it would
have been possible to use a single
Raspberry Pi and remote I/O to
power the piano, the use of one Pi
Zero per octave has some benefits:
“If any part was to break, it would
be possible to shuffle working
hardware around for a three-octave
Tough Pi-ano, at least until repairs
could be made. So there is still an
advantage to the redundancy.”
Brian’s Tough Pi-ano is now set to
be used in his aunt and uncle’s new
centre for local families with kids on
the autism spectrum and those with
Down’s syndrome. While he doesn’t
plan to build another piano, he has
some advice for would-be makers.
“I would recommend building the
speakers into the enclosure, but
be sure to ventilate the amplifier.

Also, buy one of the tools used to
fasten arcade button washers, or
you’ll regret it when you get to the
50th button and your knuckles
are bloody.”

In the end, arcade buttons were


the best solution since they


were easy to source and replace


The 1 kΩ resistor
boards were added
to reduce issues
with electrical noise
Free download pdf