book collections email follower instructable user
Screenshot 2019-03-10 at 07.47.30.png

This Instructable will show you how to make a Raspberry Pi powered robotic drum machine. It really is a fun, creative, interactive project. I’ll show you how to make the internal workings, but the actual drums is going to be up to you, giving you the opportunity to make something completely unique to you. For my machine I have used as many found items as I can... hammers from a piano rescued from my neighbours skip, a fishing net I found on the beach, an empty bake bean can, wooden spoons, an empty beer bottle, beer bottle tops and a desk bell among other things, but let your imagination go crazy - see what you have around the house, just about anything that makes a noise when hit can be used, and it will really make your project your own.

To control it, you have 2 options:

  • A browser based step sequence which I have called PiBeat - This is great fun and lets you control your drum machine interactively from your Pi, or any device on the same network (such as your phone, tablet or computer). We will install it on your Pi later, but a preview can be seen here, and the code is in GitHub here.
  • A python script to program a drum pattern. This is a great way to create a rhythm for you to jam along with on your guitar etc.

I try to keep costs down and as you will see in the next step, no expensive specialist tools are required. I have also tried to explain how things work in every step, making it a great project even if you are a relative newcomer to the world of Pi's, coding and electronics and on a limited budget.

OK, let’s get to work!

Step 1: Go Shopping

To build the internal mechanism, you will need:

  • 1x 40 Pin Raspberry Pi with Raspbian installed on a SD, with power cable and ability to connect into it (I've used a Raspberry Pi Zero Wireless with pre-soldered header from ModMyPi)
  • 1x 5v 8 channel relay
  • 1x Pack of female to female jumper wires (10 wires needed)
  • 2x 3 Amp Terminal strips (You could use a breadboard or perfboard, but terminal strips are cheap and prevent cables coming loose, and when making this I didn't own a soldering iron)
  • 1x 12v 10a Power Supply
  • 8x 12v 2a Solenoids
  • 8x 1N5401 Rectifier diodes
  • 50cm of 0.5mm cable (I stripped the cores from some twin core cable as it was a cost effective way to get red, black and twin core), although you can just use 1 colour if you want. You may wan't to buy a bigger length depending on the housing you want to build.

You will also need the following tools:

  • Wire cutters
  • Wire strippers
  • Small flat head screwdriver, about 3mm
  • Depending on terminal strips you get, you may also need a small cross head screw driver

I have not listed any parts or tools to make the drums and any housing you wan't to put it in. I’ll show you how I made mine later, but as said before I’m leaving that part up to your imagination.

Hi there, I was wondering if anyone has had a similar error when they run "python3"
Traceback (most recent call last):

File "", line 6, in <module>

sio = socketio.AsyncServer()

AttributeError: module 'socketio' has no attribute 'AsyncServer'
I haven't modified the '' and everything seemed fine when I ran "pip3 install -r requirements.txt

banjowise (author)  GuyWithAMicrophone1 month ago
Hi GuyWithAMicrophone,

I reckon requirements.txt needs fixing - try replacing the line:

Rerun "pip3 install -r requirements.txt" and then "python3" and let me know if it fixes it.
Thank you that did the trick.
8931465552 months ago
Hello, if I want to control 4 8-way relays, what should I do?
banjowise (author)  8931465552 months ago
Hi there,

The Pi has 28 GPIO pins so you would first have to find a way around that, you could try this:

I have never used a port expander, but presuming they give access to the extra pins as additional GPIO numbers, then you can just add them to the pins array and update the defaultSequence in then compile the app using angular.
AndrésG623 months ago
Hello, I just jump on this reading the last issue of the HackSpace magazine. Very nice projet. I haven't study the codes or the Drum sequencer, I will, but I'm not good programing anyway so I have a question: Do you think if it is possible tu run this on an ESP8266 or an ESP32? Thank in advance.
banjowise (author)  AndrésG623 months ago
Hi Andrés,
I have never used either of those. You will have a much easier time if you stick with a Pi, but you might be able to get it to work if you rewrite a bit of the code... The html / css / js should work on any device, but is what you would have to rewrite to be compatible with Espressif. serves up the web interface and also the websocket server which listens for messages from the web interface and triggers the appropriate pins.
It is probably possible but I would stick to a Pi if you are new to programming.
Good luck!
Thank you very much for your answer… you are rigth, a Raspberry Zero W is on my way…
m_shannon6 months ago
Such a cool idea! :)
AussieAlf6 months ago
Hey that's pretty cool Banjowise, got a good rhythm going on there.

Best of luck in the comp.
seamster6 months ago
Very clever projects, so many neat ideas. Thanks for sharing!