E Drum Kit With Speaker

by calisb in Circuits > Raspberry Pi

245 Views, 3 Favorites, 0 Comments

E Drum Kit With Speaker

E154D116-95A8-4540-9A86-E6BC0978C0ED_1_105_c.jpeg

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

435D91A2-8FB7-426B-B1D2-C47B1CFBB553_1_105_c.jpeg
B811A3ED-9185-4761-A596-A0B2196A0FB2_1_105_c.jpeg
DE90E29C-D9CC-4E83-BE03-E17F34319D8A_1_105_c.jpeg

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

6F56C8C2-D823-4903-9419-0A03BE180A64_1_105_c.jpeg
A51B969B-3C0D-4291-BB11-364983B9754F_1_105_c.jpeg

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")