MIDI Arduino Drums

156,236

510

107

Intro: MIDI Arduino Drums

I've always wanted to learn how to play a drum kit, but my parents never let me because 'it takes up too much space' and 'it makes too much noise'.

So now, many years and some electrical knowledge later, I've decided to make my own electronic drum kit!

This project is pretty easy to make and you do not really need any special knowlegde or skills.

Step 1: What You'll Need

Here's what you'll need to make 4 drums:

- 4x Piezo

- 4x CD

- Mouse pads (enough to cut 8 circles as big as the CD)

- Arduino + USB cable

- 4x 1M Ohm resistor

- PCB or breadboard

- some wire


Optional:

- 4x 3.5mm plug

- 4x 3.5mm socket

Step 2: Soldering Piezos

The first step is to solder long wires to the piezos.

My piezos came with a little metal cap and short wires. You can cut the metal cap of and simply solder longer wires to those short little wires.

If you chose to use plugs and sockets, you obviously have to solder your plug to the other side of your wire.

Step 3: Breadboard/PCB

After you soldered wires to your piezos it's time to connect everything.

Connect the resistor to the wires of the piezo as shown in the diagram above. Then connect the GND wire of the piezo to GND on Arduino. Connect the other wire of the piezo to an analog pin on your Arduino. (If you're using plugs and sockets, you obviously use the wires of the socket and not the wires of the piezo)

When you're not using all of the analog pins, you should connect the 'empty' pins with GND. Otherwise you might get false values because of noise.

You can either connect everything on a breadboard as shown in the diagram. Or you can solder everything on a piece of PCB like I did.

Step 4: The Drum Pads

Now that everything is soldered, it's time to make the drum pads.

Take your CD and put it on the mouse pad. Draw a circle around the CD and then cut it out. Next stick the piezo to the CD with a piece of tape.Once that's done you'll need to glue the mousepads to the CD. I used a tiny bit of super glue. Make sure the glue doesn't get on the piezo! It'll ruin your piezo. I had to learn that the hard way.

ruined piezo

Use a bit of glue on the edges of the CD and stick the plastic part of the mouse pad to it. Do the same for the other side. The foam sides of the mouse pad have to be on the outside.

Use some extra glue around the part where the wires stick out of the drum pad to close it nicely.

Step 5: Connect With PC

That's pretty much it. Everything has now been put together and the only step left is to connect everything with the computer.

There are a few possible ways to connect. After some research and trying different programs I found Ardrumo (Mac OS X only) the easiest to work with. Simply load the sketch to your Arduino and then open Ardrumo and Garageband.You can choose different drums in Ardumo as you can see in the video in the first step.

But like I said, this is not the only possible way to connect. There are a lot of other ways, for example using Hairless as explained in this Instructable. Just play around a bit and find a method that suits your needs :)

This is the code for Ardrumo. Download Ardrumo by clicking here.

/*
 * Ardrumo sketch
 *
 * Use with the Ardrumo software here:
 * <a href="http://code.google.com/p/ardrumo/" rel="nofollow"> <a href="http://code.google.com/p/ardrumo/"> <a href="http://code.google.com/p/ardrumo/"> <a href="http://code.google.com/p/ardrumo/" rel="nofollow"> <a href="http://code.google.com/p/ardrumo/" rel="nofollow"> http://code.google.com/p/ardrumo/
</a>
</a>
</a>
</a>
</a>
 * This is designed to let an Arduino act as a drum machine
 * in GarageBand (sorry, Mac OS X only).
 */

#define LEDPIN     13     // status LED pin
#define PIEZOTHRESHOLD 5  // analog threshold for piezo sensing
#define PADNUM 6          // number of pads

int val;

void setup() {
  pinMode(LEDPIN, OUTPUT);
  Serial.begin(57600);   // set serial output rate
}

void loop() {

  // Loop through each piezo and send data
  // on the serial output if the force exceeds
  // the piezo threshold
  for(int i = 0; i < PADNUM; i++) {
    val = analogRead(i);
    if( val >= PIEZOTHRESHOLD ) {
      digitalWrite(LEDPIN,HIGH);  // indicate we're sending MIDI data
      Serial.print(i);
      Serial.print(",");
      Serial.print(val);
      Serial.println();
      digitalWrite(LEDPIN,LOW);
    }
  }
}

This is the code for Hairless. The code is from an Arduino Xylophone Instructable.

//Xylophone
//Adapted for an ArduinoMega 
//from Jenna deBoisblanc and Spiekenzie Labs initial code

//*******************************************************************************************************************
// User settable variables
//*******************************************************************************************************************

int pinRead;
char pinAssignments[16] ={
  'A0','A1','A2','A3','A4','A5','A6','A7','A8','A9','A10','A11'};
byte PadNote[16] = {
  57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72};         // MIDI notes from 0 to 127 (Mid C = 60)
int PadCutOff[16] = 
{
  400,400,200,800,400,400,400,400,400,400,400,400,400,400,400,400};           // Minimum Analog value to cause a drum hit
int MaxPlayTime[16] = {
  90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90};               // Cycles before a 2nd hit is allowed
#define  midichannel 1;                              // MIDI channel from 0 to 15 (+1 in "real world")
boolean VelocityFlag  = true;                           // Velocity ON (true) or OFF (false)

//*******************************************************************************************************************
// Internal Use Variables
//*******************************************************************************************************************
boolean activePad[16] = {
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};                   // Array of flags of pad currently playing
int PinPlayTime[16] = {
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};                     // Counter since pad started to play
byte status1;

int pin = 0;     
int hitavg = 0;
//*******************************************************************************************************************
// Setup
//*******************************************************************************************************************
void setup() 
{
  Serial.begin(57600);                                  // SET HAIRLESS TO THE SAME BAUD RATE IN THE SETTINGS

}
//*******************************************************************************************************************
// Main Program
//*******************************************************************************************************************
void loop() 
{
  for(int pin=0; pin < 16; pin++)                          //
  {
    //int pin = 3;
    //   for (pinRead=0; pinRead < 16, pin++){
    hitavg = analogRead(pinAssignments[pin]);  
    //Serial.println(hitavg);   
    // read the input pin

    if((hitavg > PadCutOff[pin]))
    {
      if((activePad[pin] == false))
      {
        if(VelocityFlag == true)
        {
          //          hitavg = 127 / ((1023 - PadCutOff[pin]) / (hitavg - PadCutOff[pin]));    // With full range (Too sensitive ?)
          hitavg = (hitavg / 8) -1 ;                                                 // Upper range
        }
        else
        {
          hitavg = 127;
        }
        MIDI_TX(144,PadNote[pin],hitavg); //note on

        PinPlayTime[pin] = 0;
        activePad[pin] = true;
      }
      else
      {
        PinPlayTime[pin] = PinPlayTime[pin] + 1;
      }
    }
    else if((activePad[pin] == true))
    {
      PinPlayTime[pin] = PinPlayTime[pin] + 1;
      if(PinPlayTime[pin] > MaxPlayTime[pin])
      {
        activePad[pin] = false;
        MIDI_TX(144,PadNote[pin],0); 
      }
    }
  } 
}

//*******************************************************************************************************************
// Transmit MIDI Message
//*******************************************************************************************************************
void MIDI_TX(byte MESSAGE, byte PITCH, byte VELOCITY) 
{
  status1 = MESSAGE + midichannel;
  Serial.write(status1);
  Serial.write(PITCH);
  Serial.write(VELOCITY);

}

Step 6: Have Fun!

That's it!

Everything is now connected and put together.

Have fun and annoy your parents with your new drum kit! :)

2 People Made This Project!

Recommendations

  • Fix It! Contest

    Fix It! Contest
  • Tiny Home Contest

    Tiny Home Contest
  • Furniture Contest 2018

    Furniture Contest 2018

107 Discussions

0
None
LuiseK1

Question 2 months ago

So I tried the whole Ardrumo & GarageBand thing. the led on the Arduino is blinking, so does the Ardrumo Software. But sadly I get no sound. What am I doing wrong, can someone please help me. May this be caused by the new Garage Band update?

0
None
ukalar

1 year ago

Could anyone please help with the code for Hairless. I want to assign different pin readouts to different midi channels... According to the code written above, all piezzo signals join into one channel... I hope anyone can help. :) Thanks!

1 reply
0
None
RAFALAMAOukalar

Reply 2 months ago

Yes dude!

You only need to change tone number, check this example of my modiffication code:

//Xylophone

//Adapted for an ArduinoMega

//from Jenna deBoisblanc and Spiekenzie Labs initial code

//*******************************************************************************************************************

// User settable variables

//*******************************************************************************************************************

int pinRead;

char pinAssignments[5] ={'A0','A1','A2','A3','A4'};

byte PadNote[5] = {53,69,11,57,36}; // MIDI notes from 0 to 127 (Mid C = 60)

//53 Campana

//69 Tarola

//11 Hithat cerrado

//57 Crash

//36 Bombo

int PadCutOff[5] = {500,200,350,300,400}; // Minimum Analog value to cause a drum hit

int MaxPlayTime[5] = {90,90,90,90,90}; // Cycles before a 2nd hit is allowed

#define midichannel 1; // MIDI channel from 0 to 15 (+1 in "real world")

boolean VelocityFlag = true; // Velocity ON (true) or OFF (false)

//*******************************************************************************************************************

// Internal Use Variables

//*******************************************************************************************************************

boolean activePad[5] = {0,0,0,0,0}; // Array of flags of pad currently playing

int PinPlayTime[5] = {0,0,0,0,0}; // Counter since pad started to play

byte status1;

int pin = 0;

int hitavg = 0;

//*******************************************************************************************************************

// Setup

//*******************************************************************************************************************

void setup()

{

Serial.begin(57600); // SET HAIRLESS TO THE SAME BAUD RATE IN THE SETTING

}

//*******************************************************************************************************************

// Main Program

//*******************************************************************************************************************

void loop()

{

for(int pin=0; pin < 5; pin++) //

{

//int pin = 3;

// for (pinRead=0; pinRead < 16, pin++){

hitavg = analogRead(pinAssignments[pin]);

//Serial.println(hitavg);

// read the input pin

if((hitavg > PadCutOff[pin]))

{

if((activePad[pin] == false))

{

if(VelocityFlag == true)

{

hitavg=127;

//hitavg = 127 / ((1023 - PadCutOff[pin]) / (hitavg - PadCutOff[pin])); // With full range (Too sensitive ?)

//hitavg = (hitavg / 8) -1 ; //8 // Upper range

}

else

{

hitavg = 127;

}

MIDI_TX(144,PadNote[pin],hitavg); //note on

PinPlayTime[pin] = 0;

activePad[pin] = true;

}

else

{

PinPlayTime[pin] = PinPlayTime[pin] + 1;

}

}

else if((activePad[pin] == true))

{

PinPlayTime[pin] = PinPlayTime[pin] + 1;

if(PinPlayTime[pin] > MaxPlayTime[pin])

{

activePad[pin] = false;

MIDI_TX(144,PadNote[pin],0);

}

}

}

}

//*******************************************************************************************************************

// Transmit MIDI Message

//*******************************************************************************************************************

void MIDI_TX(byte MESSAGE, byte PITCH, byte VELOCITY)

{

status1 = MESSAGE + midichannel;

Serial.write(status1);

Serial.write(PITCH);

Serial.write(VELOCITY);

}

Regards :D

1
None
bhrendun

11 months ago

Confused about the part with GarageBand and Ardumo. How do these sync with the Arudino sketch code?

Do I simply run the Arduino code and then leave GarageBand and Ardumo open? Are there any other settings or configuration I need to make between these programs? Thanks!

1 reply
0
None
RAFALAMAObhrendun

Reply 2 months ago

Hi dude :D

Can did you can do it works or need help? :)

0
None
RAFALAMAO

2 months ago

Thank you very much dude! :D

I made my own :3, and i used Xylophone code for only 5 piezo.

This is the Arduino's code :D

//Xylophone

//Adapted for an ArduinoMega

//from Jenna deBoisblanc and Spiekenzie Labs initial code

//*******************************************************************************************************************

// User settable variables

//*******************************************************************************************************************

int pinRead;

char pinAssignments[5] ={'A0','A1','A2','A3','A4'};

byte PadNote[5] = {53,69,11,57,36}; // MIDI notes from 0 to 127 (Mid C = 60)

//53 Campana

//69 Tarola

//11 Hithat cerrado

//57 Crash

//36 Bombo

int PadCutOff[5] = {500,200,350,300,400}; // Minimum Analog value to cause a drum hit

int MaxPlayTime[5] = {90,90,90,90,90}; // Cycles before a 2nd hit is allowed

#define midichannel 1; // MIDI channel from 0 to 15 (+1 in "real world")

boolean VelocityFlag = true; // Velocity ON (true) or OFF (false)

//*******************************************************************************************************************

// Internal Use Variables

//*******************************************************************************************************************

boolean activePad[5] = {0,0,0,0,0}; // Array of flags of pad currently playing

int PinPlayTime[5] = {0,0,0,0,0}; // Counter since pad started to play

byte status1;

int pin = 0;

int hitavg = 0;

//*******************************************************************************************************************

// Setup

//*******************************************************************************************************************

void setup()

{

Serial.begin(57600); // SET HAIRLESS TO THE SAME BAUD RATE IN THE SETTING

}

//*******************************************************************************************************************

// Main Program

//*******************************************************************************************************************

void loop()

{

for(int pin=0; pin < 5; pin++) //

{

//int pin = 3;

// for (pinRead=0; pinRead < 16, pin++){

hitavg = analogRead(pinAssignments[pin]);

//Serial.println(hitavg);

// read the input pin

if((hitavg > PadCutOff[pin]))

{

if((activePad[pin] == false))

{

if(VelocityFlag == true)

{

hitavg=127;

//hitavg = 127 / ((1023 - PadCutOff[pin]) / (hitavg - PadCutOff[pin])); // With full range (Too sensitive ?)

//hitavg = (hitavg / 8) -1 ; //8 // Upper range

}

else

{

hitavg = 127;

}

MIDI_TX(144,PadNote[pin],hitavg); //note on

PinPlayTime[pin] = 0;

activePad[pin] = true;

}

else

{

PinPlayTime[pin] = PinPlayTime[pin] + 1;

}

}

else if((activePad[pin] == true))

{

PinPlayTime[pin] = PinPlayTime[pin] + 1;

if(PinPlayTime[pin] > MaxPlayTime[pin])

{

activePad[pin] = false;

MIDI_TX(144,PadNote[pin],0);

}

}

}

}

//*******************************************************************************************************************

// Transmit MIDI Message

//*******************************************************************************************************************

void MIDI_TX(byte MESSAGE, byte PITCH, byte VELOCITY)

{

status1 = MESSAGE + midichannel;

Serial.write(status1);

Serial.write(PITCH);

Serial.write(VELOCITY);

}

Regards :D

0
None
MEETJ4

1 year ago

can i install on windows or ubuntu machine

1 reply
0
None
rfern√°ndez valerioMEETJ4

Reply 6 months ago

What do you mean about install? The Arduino IDE environment is multiplatform. :)
Also you are making a MIDI interface (Which also is universal in terms of receiving signals), so you can change the pads to other things such as cymbals, tombs, etc.

0
None
ClashP

2 years ago

I have made it. It creates sound.

But i have a problem. I am Windows, loopMIDI, Hairless and addictivve drum. But when i hit the piezo it plays two instrument on the addictive drum. Like when I tap my first piezo, it plays the snare and the Hanging toms together. What to do???

I also tried this on EZDrums, the same problem occurs.

6 replies
0
None
ErmantoClashP

Reply 10 months ago

Hi there, i started this project and i have the exact same problem. When i hit piezzo hard it triggers too many notes at the same time.. For example (59, 62, 68) when i hit carefully it triggers only one note. When i analyse arduino codes it is impossible. I wonder that you solved this problem?

0
None
WadeE6Ermanto

Reply 7 months ago


Hey, so I was having the same problem with using the Hairless program. I was only using 1 pad for testing and I had 3 pins and 3 notes to play with. what I discovered is if I had the other pins sent to ground I wouldn't trigger the other notes. I did a test by which I would put my pad on A0 and have A1,A2 pins sent to ground, I would hit the pad and watch on the hairless monitor what notes I was triggering. I would do this for all the pins to see that I was triggering the right notes. then I was using my daw to confirm I was hitting the right notes. one thing I discovered is that I had an extra midi not on the very last key of my drum program but it was not being used by any sound so its not a problem. I know this is 2 years later but I hope someone finds this usefull

0
None
LeandroV19ClashP

Reply 2 years ago

because it's too sensitive o.o, you have to isolate each pad. (i guess)

0
None
ClashPLeandroV19

Reply 2 years ago

I tried that, but that did not work. I have the same problem

0
None
WadeE6ClashP

Reply 7 months ago

Hey, so I was having the same problem with using the Hairless program. I was only using 1 pad for testing and I had 3 pins and 3 notes to play with. what I discovered is if I had the other pins sent to ground I wouldn't trigger the other notes. I did a test by which I would put my pad on A0 and have A1,A2 pins sent to ground, I would hit the pad and watch on the hairless monitor what notes I was triggering. I would do this for all the pins to see that I was triggering the right notes. then I was using my daw to confirm I was hitting the right notes. one thing I discovered is that I had an extra midi not on the very last key of my drum program but it was not being used by any sound so its not a problem. I know this is 2 years later but I hope someone finds this usefull

0
None
ClashPLeandroV19

Reply 2 years ago

I tried that, but that did not work. I have the same problem

0
None
EwanV

1 year ago

Hey there, thank you so much for posting this. This is fantastic, it took me no time at all to get working with Logic Pro X and Superior Drummer! Only issue I'm having is that the drum sounds seem to get triggered twice in stronger hits? Did you have this problem at all?



Cheers!

0
None
vinayakpurohit1996

2 years ago

Hey there, I am on windows with hairless, but I am getting sounds of piano but not drums. Can please solve this...sorry for noob questions

1 reply
0
None
ukalarvinayakpurohit1996

Reply 1 year ago

Hey there. I'm just finishing the project on win 10. You can install tryout version of Ableton LIVE, it works great (you have to install loopMIDI, to create midi breadge and Hairless to connest midi to Ableton LIVE. My issue that remains is how to assign different midi channels in output. I tried useing 3 oiezzos, I get different tones, but I do not know, how to assign different instruments to a single piezzo since the signal from all piezzos comes to the same channel to Ableton LIVE... I hope first part helps a bit :D

0
None
franciscog34

1 year ago

Hello dear, I would like to know if there is any way to go through the midi port in receiving the messages of edrums, add messages of electrical piezo and all send it to the port midi out.

The intention is to make a trigger for edrums.

0
None
andtor

1 year ago

hey buddy nice one! Is it possible to use it with ableton as well?