E Drum Kit With Speaker
I made an e-drum kit with the Rasperry Pi Pico W. The Pico has preloaded drum sounds which are triggered by hitting the drum pads. The drum pads use Piezo pickups to recognise a hit, which then sends an analog signal to the Pico. The Maker Pi Pico base has been used as a board and an external speaker was used to amplify the sound. Everything is powered by a chargeable battery.
Supplies
- Rasperry Pi Pico
- Maker Pi Pico Board
- Anker Soundcore Speaker + Audio cable
- 3x Piezo Pickups
- Portable battery
- Different kind of wood and screws for the actual drum set and box for electronics
- 1/4 Baltic Birch
- 3mm Cardboard
- Copper tape for the drum pads (optional)
Preparation
First, the different wood pieces have been cut and screwed together to built the frame.
The second step was the design of the drum pads. Three drum pad shapes have been designed with Adobe Illustrator. The designs then have been cut by using a laser cutter. First 1/4 baltic birch was used for the basic shape and then the same shapes have been cut with 3mm cardboard material for an extra layer. The layers have been glued together and covered in golden copper tape for a better visual look. The second layer's function is to absorb a hit so that the Piezo pickups don't get triggered too fast.
The third step was construction of the box for the electronics. A template from boxes.py has been used to generate a design. In Adobe Illustrator the stroke lines have been changed to 0.01mm in RGB red for the laser cutter. The lid of the box is detachable to access the electronics, additionally, a whole has been added to for easier access and for the wires of the Piezo pickups.
Assembly
After the design of the parts and the woodwork the parts have been constructed together. The frame was build with screws and wood glue. The Piezo pickups have been taped to the back of the drum pads. The wires have been connected to the Maker Pi Pico board with ground, signal and 3.3V inputs. Note that the Pico only has 3 analog inputs which are GP26, 27 and 28. The battery pack has been glued next to the box and powers the whole device. The speaker has been glued next to the pads and is connected with an 3.5mm aux cable to the Pico board.
Code
import board
from analogio import AnalogIn
# import lines needed to play sound files
from audiopwmio import PWMAudioOut as AudioOut
from audiocore import WaveFile
# set up the speaker
audio = AudioOut(board.GP18)
path = "sounds/"
def play_sound(filename):
with open(path + filename, "rb") as wave_file:
wave = WaveFile(wave_file)
audio.play(wave)
while audio.playing:
pass
piezo_1 = AnalogIn(board.A0)
piezo_2 = AnalogIn(board.A1)
piezo_3 = AnalogIn(board.A2)
kick_start = 6000
snare_start = 7000
hat_start = 6000
while True:
adc_piezo_1 = piezo_1.value
adc_piezo_2 = piezo_2.value
adc_piezo_3 = piezo_3.value
if adc_piezo_1 > kick_start:
print((adc_piezo_1, adc_piezo_2, adc_piezo_3))
play_sound("0.wav")
if adc_piezo_2 > snare_start:
print((adc_piezo_1, adc_piezo_2, adc_piezo_3))
play_sound("1.wav")
if adc_piezo_3 > hat_start:
print((adc_piezo_1, adc_piezo_2, adc_piezo_3))
play_sound("2.wav")