Electronic Drum Toy Built From Scratch

Drum kits used to be key to any serious band, however, these days, much of our music is created on computer or using a drum machine instead. [spanceac] has built a simple example of the latter, using a microcontroller to build a basic sample-based drum toy.

The brains of the operation is the STM32F100VET6B, which comes complete with a 12-bit DAC for outputting sound. It’s also got a healthy 512 KB of flash, enabling it to store the drum samples onboard without the need for extra parts. Samples are stored at a sample rate of 22,050 Hz in 16-bit resolution – decent quality for a tiny little build, even if the DAC chops that back down to 12-bits later.

[spanceac] was sure to code proper mixing into the drum machine, so that triggering a second sample doesn’t stop the first one playing. With a kick, snare, two toms, and crash and ride samples onboard, there’s plenty to get a solid beat going on the kit.  It’s all built up on a small PCB with tactile buttons to activate each sound.

The demo video shows the kit performing ably; it’s not clear if there’s an issue with latency on the samples or that’s just from the difficulty of [spanceac] playing one-handed. If the former, likely some code tweaks or simply trimming silence at the start of samples would be all that was needed. Overall, it’s a neat little groovebox, and the kind of thing that’s great fun to use when jamming with other musicians. Video after the break.

9 thoughts on “Electronic Drum Toy Built From Scratch

  1. This is where I head the opposite direction from “coulda’ done it with a 555”: the Raspberry Pi Pico has two 12-bit DACs, 2MB of flash and 264kB of RAM, and if latency is an issue (which it sounds like it may be), about six times the clock speed. All for $4, which includes a boost/buck regulator to run off of practically any power source.

    1. Hey!

      I’m the guy that created this. I started this project in 2018, then put it on pause for a while.

      The project was finished at the beginning of 2021.

      RPi Pico was not an option then but it would definitely be fitted for this type of project.

  2. In “the old days”, a sharp pulse to a damped oscillator (or an active filter with some feedback) wouod generate each drum. Multiple filters of course. A white noise generator for the hissing type drums.

  3. It’s got 32Kb of ram. Seems quite enough to implement a sequencer. But it also has a RAM controller onboard, so adding more ram is easy.

    It also has 80 I/O’s, so it’s quite trivial to add a few more buttons, leds, and maybe some rotary encoders. Also would need some way to attenuate the individual sequence entries so that you can actually program a beat.

    With a little bit of extra hardware, a bunch of more coding, and tweaking of the user-interface to something intuitive, this could be a complete and useful drum sequencer.

    Challenge delivered. :)

  4. Hey,

    I’m the creator of this project.

    I want to say that this is not a drum machine since you can’t program any pattern in it.

    Quoting from the project page:

    This project is not:

    a MIDI controller
    a drum machine
    a drum sound synthesizer

    Also, I didn’t observe latency when playing.
    I think that the latency in the video is caused by the video processing stage that I used to make the video smaller, in order to fit on github.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.