Though the following example uses the Circuit Playground Express to demonstrate, the code works exactly the same way with the Circuit Playground Bluefruit. Simply copy the code and follow along with your Circuit Playground Bluefruit!

A wise man once said, "Nothing sounds better than an Eight-O-Eight."

(That wise man was Adam Horovitz of the Beastie Boys.)

The 808 to which Ad-Rock was referring is the Roland TR-808 drum machine. Let's build a little Circuit Playground Express tribute to the venerable 808! Instead of a full-blown drum pattern sequencer, we'll just focus on the machine's pads which are used for finger drumming to play back sampled drum sounds.

We can use the capacitive touch pads on the Circuit Playground Express as triggers, and small .wav files for our drum sounds! 

Installing Project Code

To use with CircuitPython, you need to first install a few libraries, into the lib folder on your CIRCUITPY drive. Then you need to update with the example script.

Thankfully, we can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the file in a zip file. Extract the contents of the zip file, open the directory Introducing_CircuitPlaygroundExpress/CircuitPlaygroundExpress_808_Drum_Machine/ and then click on the directory that matches the version of CircuitPython you're using and copy the contents of that directory to your CIRCUITPY drive.

Your CIRCUITPY drive should now look similar to the following image:

# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT

# Circuit Playground 808 Drum machine
import time
import board
import touchio
import digitalio

    from audiocore import WaveFile
except ImportError:
    from audioio import WaveFile

    from audioio import AudioOut
except ImportError:
        from audiopwmio import PWMAudioOut as AudioOut
    except ImportError:
        pass  # not always supported by every board!

bpm = 120  # Beats per minute, change this to suit your tempo

# Enable the speaker
speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
speaker_enable.direction = digitalio.Direction.OUTPUT
speaker_enable.value = True

# Make the input capacitive touchpads
capPins = (board.A1, board.A2, board.A3, board.A4, board.A5,
           board.A6, board.TX)

touchPad = []
for i in range(7):

# The seven files assigned to the touchpads
audiofiles = ["bd_tek.wav", "elec_hi_snare.wav", "elec_cymbal.wav",
              "elec_blip2.wav", "bd_zome.wav", "bass_hit_c.wav",

audio = AudioOut(board.SPEAKER)

def play_file(filename):
    print("playing file " + filename)
    file = open(filename, "rb")
    wave = WaveFile(file)
    time.sleep(bpm / 960)  # Sixteenth note delay

while True:
    for i in range(7):
        if touchPad[i].value:

Try it out! When you tap the capacitive pads, the corresponding drum sample is triggered!!

Things are a bit crammed, admittedly, so you can try adding foil, copper tape, alligator clips, etc. in order to increase the surface area and physical space you have for your drumming!

Capacitance is calibrated at startup, so you may need to reset the board after attaching leads to the pads!

If you want to use your own sound files, you can! Record, sample, remix, or simply download files from a sound file sight, such as Then, to make sure you have the files converted to the proper specifications, check out this guide here that'll show you how! Spoiler alert: you'll need to make a small, 22Khz (or lower), 16 bit PCM, mono  .wav file!

Want to listen to your Drum Machine at body movin' volumes? No problem! Hook up an 1/8" or 1/4" phono output to the GND and A0/Audio pads, then plug in to an amp!! I tried it on a small guitar amp and it sounds great.

This guide was first published on Oct 12, 2017. It was last updated on Oct 12, 2017.

This page (Playground Drum Machine) was last updated on Oct 02, 2023.

Text editor powered by tinymce.