Let's Build a DIY Drum Machine!

Let's Build a DIY Drum Machine!

Takumi Ogata · 06/11/26

A sequencer allows musicians to create a beat by toggling notes on or off. While software sequencers do exist and are fun to make music with, it's also nice to have a physical drum machine that allows a pattern to be changed in a more immediate tactile way!

So today, let's build a standalone DIY drum machine!

Items Needed

Software

  • Plugdata
  • CAD software such as Blender (free) and Rhino (commercial)

Project File

The project files (download zipped folder) includes:

  • Plugdata patches
  • Schematic
  • STL
  • Dimensions

Hardware Design

Drum machine typically consists of:

  • Toggle for turning a step/note on or off
  • Visual indicator that shows which step the sequencer is currently on

Therefore, you would need a switch to toggle a step and an LED for visual feedback. The LED can light up when you turn on a step with a button for example. For this project, let's use a button that has an LED in it! Fancy!

LED Button (Adafruit)

You also need a knob to control the speed of the sequence. Let's have a total of four knobs and use the other three for controlling audio effects (such as reverb!).

Potentiometer (Adafruit)

Ok, what about the audio? This drum machine will be standalone and not a MIDI controller so the sound will come from the device itself! For that, the Daisy Seed is a microcontroller that’ll get the job done.

Daisy Seed

The Seed has audio out pins and you can also connect the switches, LEDs, and potentiometers to it. How it’ll work is that you program a drum machine firmware and then flash that to the Seed. Then, you can power it via a computer's USB port (note that USB power from a laptop can be noisy) or a USB power bank battery (recommended) and connect the audio output to an interface or an amp.

Multiple Rows or a Single Row?

Drum machines have multiple percussion instrument sounds to play with. For example, you can have three instruments, kick, snare, and hi-hat. For this project, let's have 8-steps for each instrument. This means that you would need 24 steps total!

Software Drum Machine Made with MaxMSP

So, do you need to get 24 of these LED buttons for this project? Now, the project has gotten a bit more costly. And there will be a lot more soldering and wiring than expected too. Most importantly, what if you end up wanting to add more percussion sounds? Are you forever stuck with only 3 instruments? There must be another approach!

Let's look at the past for hints. A drum machine like the Roland TR-808 only has a single row of 16 steps.

808 Demo By Perfect Circuit

How you program a beat with the 808 is to switch between an instrument and its corresponding pattern. For example, you can put together a kick pattern and then use the onboard encoder to switch to a snare pattern. This switch is indicated by the change in the displayed LED pattern (unless your kick and snare patterns are exactly the same but you know what I mean!).

So! Let's include a shift button for switching between instruments. While you hold down this button and press the step one button, the drum machine switches to the kick pattern.

And if you press step two instead, you go to the snare pattern.

And step three is for hi-hat. Let’s make the most out of a single row!

With all these in mind, the layout of the front panel of this drum machine will look something like this!

Next, let's put together a proof-of-concept on a breadboard.

Turning an LED On/Off with a Switch

Let’s first turn the LED on by pressing the switch. For this tutorial, let's use Plugdata as it is quick to set up and easy to program with any Daisy board. You can install it from their download page. Connect the Daisy Seed, a switch, and an LED plugged into a breadboard as follows.

Here's a patch that maps the switch to the LED. This patch, along with other files in this blog, can be downloaded from this link.

1_Switch_LED_Test.pd

Here's what switch_led_test.json looks like:

{
  "name": "switch_led_test",
    "som": "seed",
    "audio": {
        "channels": 2
    },
    "components": {
        "led1": {
            "component": "Led",
            "pin": 15,
            "invert": "false"
        },
        "sw1": {
            "component": "Switch",
            "pin": 14
        }
    }
}

This json file maps the hardware switch connected to the Daisy's pin D14 and LED to pin D15.

Let’s flash this program to the Daisy Seed!

Click the "Main menu" icon at the top and select "Compile". After installing the toolchain, select "Custom JSON..." as the target board and open the custom JSON file mentioned earlier. Before flashing a program, the Daisy needs to be put into a flash-able state. Hold down the BOOT button while inserting the USB cable into the Daisy. Now, click the "Flash" button in Plugdata.

Once this firmware is flashed to the Seed, the LED should turn on when you press down the switch!

4-Step Sequencer

Next, let’s put together a 4-step sequencer on the breadboard. Here are 4 pairs of switches and LEDs and an audio jack.

Ok, how to go about programming a step sequencer? Since you're building a 4-step sequencer at the moment, there are, well, 4 steps! The step increments by one at a constant interval. And once the sequence reaches 4, it loops back to 1.

At each step, the sequencer will check whether it’s on or not. If it’s on, a note will be outputted. Otherwise, no note is played. Ok, let’s program this step by step!

The [metro] object outputs a bang at a set interval (every 500 milliseconds in this example).

The following counter algorithm increments by one every time it receives that bang. And by using a modulo set at 4 ([% 4]), there is now a loop of a sequence going from 1 to 4!

To trigger each step individually, you need [select] objects. When the input matches, it outputs a bang. So, [sel 1] outputs a bang when the sequence is at 1 for example.

It’s starting to look like a sequencer! For now, let's output a beep sound. And you could connect like this...

But, the issue is that there will be a beep every step. This isn’t what you want! You want to have the ability to decide which step will play or not. This is where the [spigot] object comes in! You can think of it like a gate that opens or closes. When you toggle the second input on, the first input can go through. And vice versa.

[spigot] is closed in this example

You can now put together a pattern!

Next, you need to map each switch on the breadboard to the corresponding toggle object for each step. And you also need to map the LED on the breadboard to the toggle’s output.

Let's flash the firmware to test.

2_Step_Seq.pd

Ok, it’s very close! What's missing here?

You want the LED to blink so that you know which step you're on. Having the following abstraction results in the LED blinking at each step.

 

Step_Simple.pd

To blink a step that is on, the LED is turned off first and then on again after 160 milliseconds ([delay 160]). To blink a step that is off, the LED is turned on first and then off again after 200 milliseconds ([delay 200]).

3_Drum_Machine_4_Steps.pd

While at it, let's add a simple kick drum, which consists of a square wave oscillator and a lowpass filter.

And now, you have a 4-step sequencer on a breadboard!!

Flash this patch with drum_machine_4_steps.json and see if it works!

{
  "name": "4_Step_Seq",
    "som": "seed",
    "audio": {
        "channels": 2
    },
    "components": {
        "led1": {
            "component": "Led",
            "pin": 18,
            "invert": "false"
        },
        "led2": {
            "component": "Led",
            "pin": 17,
            "invert": "false"
        },
        "led3": {
            "component": "Led",
            "pin": 16,
            "invert": "false"
        },
        "led4": {
            "component": "Led",
            "pin": 15,
            "invert": "false"
        },
        "sw1": {
            "component": "Switch",
            "pin": 11
        },
        "sw2": {
            "component": "Switch",
            "pin": 12
        },
        "sw3": {
            "component": "Switch",
            "pin": 13
        },
        "sw4": {
            "component": "Switch",
            "pin": 14
        }
    }
}

Enclosure

Got it working? Great! You're ready to put together the 8-step drum machine. Let's start by 3D printing an enclosure! If you have access to a 3D printer, here are the STL files for this project. If you don't have access to a 3D printer at home, see if your local library, maker space, or school have one available. There are also services online that can 3D print a project and deliver it to you.

When designing an enclosure, you can begin by measuring the components. The main dimension that you need is the radius for the hole that each component will be inserted into. These components were specifically chosen because you can insert each into a hole and then screw in place.

After measuring the components, you can layout the front panel in a CAD software. The following screenshots of the CAD model are included in the download folder linked earlier.

The rest of the enclosure is just making sure you have enough space to house the wires and the breadboard with the Seed plugged in.

And you need to make sure that there are openings for the audio jack and USB port. Note that the front panel is put at an angle of 35 degrees.

The left side of the drum machine looks like this.
And there is a lid at the top.

In order to screw the lid, you need to have heat-set inserts.

McMaster-Carr

This insert works by using a soldering iron to heat it up and melt the surrounding plastic. Once the temperature drops, the insert is locked in there.

As for the LED button's pins, bottom sets are for the switch. And top sets are for the LED (right + and left -).

After wiring the components together and attaching them to the enclosure, the hardware portion of this project is complete!

Shift Button

Ok, it's time to resume patching! For this section, please refer to the patch named 4_Drum_Machine_Main.pd.

First, let’s get the secondary function button working so that you can have two more instrument sounds - snare and hi-hat! Again, the goal with the shift button is to switch between an instrument and its pattern. For example, while you hold down the function button and press down on the step one button, you switch over to the kick pattern. So, each step button now has two separate functions. It can either set a step on/off or change instruments.

To achieve this, you need two gates. One is connected to the step and the other is connected to the instrument selector.

If you are not holding down on the shift button, the instrument selector is closed off and pressing the step button will simply just toggle the note on or off. When you are holding down the shift button, pressing the step button will change the instrument but it won’t affect the pattern itself. The instrument selector value will decide which instrument pattern you're changing. 1 is kick, 2 is snare, and 3 is hi-hat. If you select the snare, each step button’s output is routed to the snare pattern and it is closed off from the kick and hi-hat. So only the snare pattern can be changed.

Instrument Selector's Value Set At 2 (Snare)

Pattern Display

One final key point is the pattern display. Because there’s only a single row of LEDs, you can’t simultaneously display the patterns for all three instruments. You would need 24 LEDs! To switch between what’s displayed, you need to store and be able to recall the pattern for each instrument. For example, if you have this pattern for the kick and this pattern for the snare, the drum machine’s eight LEDs will look like this when you select the kick.

And it will change to this when you switch to the snare.

To accomplish this, each of the 24 [Step] abstractions can store and recall the step state using the [float] object.

Step.pd

Here's a simplified diagram for explaining how [float] works.

Let’s say you start with the kick and turn on step 1. The [float] for that step will remember that it is on and the LED will turn on.

And when you switch to the snare, the [float] of the snare’s step one will output whatever that was stored. Let’s say that step was off. The LED will turn off.

And when you switch back to kick, the first step’s [float] will output a value of one, which is on.

Knobs

Finally, let's program the potentiometers! First potentiometer is mapped to the tempo. Note that it is also mapped to the blink speed.

The second potentiometer is mapped to a lowpass filter's cutoff frequency.

And the third potentiometer is mapped to the dry/wet of a reverb abstraction [Space].

Ok, you're ready to flash the firmware and jam!

Here's what the json file for this patch (drum_machine_main.json) looks like:

 

{
    "name": "drum_machine",
    "som": "seed",
    "audio": {
        "channels": 2
    },
    "components": {
        "knob1": {
            "component": "AnalogControl",
            "pin": 15
        },
        "knob2": {
            "component": "AnalogControl",
            "pin": 16
        },
        "knob3": {
            "component": "AnalogControl",
            "pin": 17
        },
        "knob4": {
            "component": "AnalogControl",
            "pin": 18
        },
        "led1": {
            "component": "Led",
            "pin": 19,
            "invert": "false"
        },
        "led2": {
            "component": "Led",
            "pin": 20,
            "invert": "false"
        },
        "led3": {
            "component": "Led",
            "pin": 21,
            "invert": "false"
        },
        "led4": {
            "component": "Led",
            "pin": 22,
            "invert": "false"
        },
        "led5": {
            "component": "Led",
            "pin": 23,
            "invert": "false"
        },
        "led6": {
            "component": "Led",
            "pin": 24,
            "invert": "false"
        },
        "led7": {
            "component": "Led",
            "pin": 25,
            "invert": "false"
        },
        "led8": {
            "component": "Led",
            "pin": 26,
            "invert": "false"
        },
                "led9": {
            "component": "Led",
            "pin": 27,
            "invert": "false"
        },
        "led10": {
            "component": "Led",
            "pin": 28,
            "invert": "false"
        },
        "sw1": {
            "component": "Switch",
            "pin": 14
        },
        "sw2": {
            "component": "Switch",
            "pin": 12
        },
        "sw3": {
            "component": "Switch",
            "pin": 11
        },
        "sw4": {
            "component": "Switch",
            "pin": 10
        },
        "sw5": {
            "component": "Switch",
            "pin": 9
        },
        "sw6": {
            "component": "Switch",
            "pin": 8
        },
        "sw7": {
            "component": "Switch",
            "pin": 7
        },
        "sw8": {
            "component": "Switch",
            "pin": 6
        },
        "sw9": {
            "component": "Switch",
            "pin": 1
        },
        "sw10": {
            "component": "Switch",
            "pin": 0
        }
    }
}

Since this patch has large file size, you would need to change the `Patch size` setting in the Compiler window to `Big + SDRAM`.

Conclusion

If you want to see this drum machine in action, you can watch the video version of this tutorial linked at the start of this blog!

To further improve this, you could add more instruments like a crash cymbal! And you still have one unused potentiometer.

Hope you have fun building this drum machine and jamming with it!

 

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.