Drum HAT review
By Russell Barnes. Posted

Hot on the heels of Pimoroni’s successful Piano HAT comes this hot drum machine. Discover the joy of code-based finger drumming
Advertisement
Starter electronics: how to build and program circuits with a Raspberry Pi or Raspberry Pi Pico.
A while ago we came across the Piano HAT, a snazzy piece of hardware based on Zachary Igielman’s PiPiano and turned into a HAT (hardware on top) device by Pimoroni.
The full article can be found in The MagPi 45 and was written by Lucy Hattersley
The Drum HAT is its funky brother, capable of quickly transforming a Raspberry Pi into a drum machine. On top of the board sit eight capacitive sensor pads; you tap the beat out with your fingers. Each pad also sports an LED that lights up when you tap (or can be programmed separately).
Installation is easy thanks to a command listed on the Drum HAT’s GitHub page. Just enter curl -sS get.pimoroni.com/drumhat | bash to get started. This script installs the Python modules and downloads a bunch of sample WAV files and programs Enter python drums.py and you’ll quickly have a drum machine ready to play. A file called direct.py links the samples in the drums2 folder, and you can edit the Python code to link to any folder you want. Then it’s just a case of creating some drum samples, or downloading sample files from a site like looperman.com.
Amen to that
We started by recreating ‘Boots and Cats’ using our sampled voices, then grabbed a bunch of samples of the ‘Amen Break’ and set to turning a Raspberry Pi into a kick-ass drum-and-bass machine.
Taking apart the sample code (and reading the GitHub page) enabled us to figure out the Drum HAT code. You can set the pads to react when hit, or released, and you can get the pads to call a function that can do anything.
Building a drum machine is where it’s at, though, and we had an awesome amount of fun with the Drum HAT (much more than with the seemingly more complex Piano HAT). A good project to try out.
Last word
4/5
Easy to set up and fun to bash around on, the Drum HAT turns a Raspberry Pi into a home-made 808 drum machine.

Russell runs Raspberry Pi Press, which includes The MagPi, Hello World, HackSpace magazine, and book projects. He’s a massive sci-fi bore.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles

PETmachine
The machine itself is 3D-printed and cuts a PET bottle into a continuous strip.
Read more →

Unusual tools: corner‑cutting shear
The tool that makes cutting corners at work an acceptable practice.
Read more →

‘Friends’ – a Raspberry Pi-powered self‑balancing sculpture
This trio of robots was part of an exhibition called ‘Que Rien Ne Bouge’, which means ‘Let Nothing Move’.
Read more →
Sign up to the newsletter
Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.