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

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


Easy to set up and fun to bash around on, the Drum HAT turns a Raspberry Pi into a home-made 808 drum machine.

From The MagPi store


Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.