Main Content

Here is an electronic drum kit where an Arduino Uno does all the sounds. This is achieved without audio hat and without extra storage. Most Arduino based drum kits use the Arduino as input listener and midi controller for a connected midi sound device. I was wondering whether the Arduino alone can be both, controller and sound device, even with only 32KiB of memory. Turns out, it can! With some trickery and clever programming that is. Features: - five sensitive drum pads and two pedals - seven instruments: double bass drum, snare drum, 2 x tom tom, hi hat and crash cymbal - all instruments playable at the same time due to clever software audio mixing - audio data stored as uncompressed 5-bit wav data and converted to 7 bits before mixing and playing on the 8-bit R2R DAC - amplified headphone out All details and a demo song in the videos below!

The sound samples are free samples from They are assembled in one 8-bit, 11.025 KHz mono wav file with silence as separator. I slowed the samples down and toned them lower before converting them to 8 bit, because the drum kit can run at 16KHz sampling rate. This runs the samples (which are at 11.025KHz) faster/higher, which improves the sound quality a bit.

A Python script converts the file into 5-bit data, where 5 bytes each contain the data for 8 samples. It also finds the starts and ends for each sample. It converts the samples into 7-bit and then uses a optimized nonlinear mapping to convert them into 5-bit. The output from that script is an Arduino type data array which is copied into the source code of the drum kit, together with the arrays for start and stop. Note that I cannot re-publish the drum samples that I used, and hence, the Arduino code that is online uses dummy data.

The Arduino code (see “files”) used a lookup table to convert the 5-bit data back into 7 bits. It then adds the samples that are playing at the moment and outputs them to the 8-bit DAC.

The code uses the digital (and some analog) ports as GPIO to detect the drumpad hits, and the digital ports 0-7 (PORTD) are connected to a 8-bit R2R DAC.

The electronics are trivial:

- At rest the switches under the drum pads are closed, and the VCC pulls the lines up to 5V against 10K pulldown resistors. When a drumpad is hit, the line goes to 0. Debouncing is done in software.

- The R2R DAC is made from 10K and 4.99K resistors, and its output goes into a 2 stage RC element and then into the headphone amplifier. The RC element has a 10K resistor, behind that 100nF to ground, then again a 10K resistor and another 100nF to ground.

- The amplifier is based on a TDA2822.”

Link to article