MIDI Drum Kit

The following page is the write-up for the Final Project of MUMT 306 – Music and Audio Computing I, for which the MIDI Drum Kit was designed.


This project aims to develop a prototype electronic drum kit using sensors, an Arduino, and Max 7. These tools will create MIDI data for this drum kit and output audio.

Design criteria

The following list outlines all the design criteria of the project:

  • Have an electronic drum kit with at least 5 drum pads, that outputs audio on a connected computer.
  • Presets for different virtual drum kits should exist, changing the note played by each of the drum pads.
  • A looping mechanism should exist, allowing someone to play a phrase on the drum kit and then loop it for as long as necessary.
  • Physical buttons should be used to control the start and stop of recording and playback of the above loop.

Design overview

In order to create drum pads, sensors designed to convert a vibration into an electronic signal were necessary. Specifically, piezoelectric sensors that put out an analog voltage when vibrated were chosen. The model 7BB-35-3L0 was chosen for it’s size, voltage range, and cost.

Figure 1: 7BB-35-3L0 Sensors back (left) and front (right)

The sensors are, however, quite small and some material was needed to increase their areas. This material would also require giving the sensors a drum-like feel. After testing out various materials, a prototype that met both requirements was developed. Using a section of sonotube (cardboard tube used as mold for concrete pillars), a hose clamp,¬† and a type of paper known as “rock paper”, a drum pad that could be hit with drum sticks was created. As well, to add a bit of strength to the paper top, a layer of adhesive laminating paper was added to the underside of the paper. Tape was used to carefully mount the sensor to the underside of the paper, without impacting the look or feel of the drum pad. This was found to work quite well in increasing the amount of area that can be hit, as well as providing a drum-like feel.

Figure 2: Drum pad used for final project

The sensor generates an analog voltage depending on the amount of force applied to the drum pad. This can correlate with MIDI velocity, such that the force applied to the drum pad will determine how loud the MIDI note generated will sound. The analog pins on the Arduino can read the analog voltage generated by the sensor and then map it to a value between 0 and 127, which can be used to represent the MIDI velocity.

The Arduino writes to a serial port which sensor was struck and the corresponding MIDI velocity. A Max patch, created with Max 7, reads the data from the same serial port and takes in these two numbers. With a value for the MIDI velocity and a sensor number, the Max patch generates MIDI data that is output as audio using the computer’s internal synthesizer. The MIDI data is sent out on channel 10, the reserved percussion channel of the General MIDI standard.

A looping mechanism was also made available by using the seq object in the Max patch. Using a physical push-button on the breadboard, you can start and stop recording of the MIDI data. To read the buttons, the Arduino uses an interrupt service routine (ISR) attached to its second digital pin. If a rising edge occurs on the pin, the ISR will automatically be called. The ISR will write a value to the serial port. When this value is read by Max, it triggers the recording of any MIDI data that gets generated when playing the drum kit. Pressing the same button again will stop the recording.

Pressing another button will start playback of the recorded MIDI data. The button uses an ISR in much the same way as was mentioned above, only it is attached to the third digital pin. The playback will loop until the same button is pressed again.

The Max patch has presets to choose different virtual drum kits. As well, knobs are provided in the Max patch for a user to choose which notes they would like for each drum pad.


Figure 3: The completed drum kit

Figure 4: A view from above of the completed drum kit

The circuit and 4 drum pads are placed on a common folding table. Another drum pad is mounted vertically on a type of easel, so it can be struck by a drum pedal from an actual drum kit. The buttons are available on the shield on top of the Arduino; blue is to start and stop recording and red is to start and stop playback.

The schematic of the circuit used can be seen in the following figure, where the row of sensors at the top of the breadboard represent the piezoelectric sensors:

Figure 5: Schematic of final circuit for drum kit

The following is a snippet of code uploaded to the Arduino which illustrates what occurs when a sensor is struck (click here to download the entire code uploaded to the Arduino):

void loop() {
  // read the first sensor and store it in the variable sensorReading1:
  sensorReading1 = analogRead(sensor1);
  //... do for 4 other sensors...
  // if the sensor reading is greater than the threshold:
  if (sensorReading1 > threshold) {
    maxValue = getMaxValue(sensor1, sensorReading1);
    writeData(sensor1, maxValue);
  //... do for 4 other sensors...
//Writes data to the serial buffer so that it can then be read by Max 7
void writeData (int sensor, int velocity)
  velocity = map(velocity, 0, 1023, 32, 127); //map ADC value to between 32 and 127
  Serial.print( sensor );
  Serial.print( " ");
  Serial.print( velocity );
  delay(50);  //delay 50 msecs to help debounce the analog signal

At the start of every loop, the Arduino reads the ADC for any voltage coming from the piezoelectric sensors. If it does read a value, and this value is above a minimum threshold, then it will attempt to find the maximum value output by the sensor. This ensures that only the maximum force of the impact is measured. The Arduino will then write the sensor number and the maximum value returned to the serial port. The maximum value is mapped to a value between 32 and 127 before being written to the serial port. A lower bound of 32 was chosen to ensure that the note can still be heard if struck with a minimum amount of force. A delay of 50 milliseconds is used to help debounce the signal and prevent any additional voltages from being read in by the ADC.

The following is an image of the final Max patch used for the drum kit:

Figure 6: Image of the main Max patch used to interface with the drum kit

The Max patch above uses three abstractions to simplify the overall look of the patch. The following images show the patch for each abstraction:

Figure 7: Image of the arduino_2in abstraction

Figure 8: Image of the note_number_selector abstraction

Figure 9: Image of the sequence_control abstraction

The resulting hardware works rather well with the completed software, as can be seen by the video below of the project in action:

There is, however, some room for improvement. The very minimal debouncing for the analog sensors, which is performed by waiting 50 milliseconds after writing data to the serial port, is not very effective. The use of a more complex conditioning circuit might be necessary to improve the response of the sensors and to output one and only one value to the ADC of the Arduino. The current debouncing solution occasionally produces an echo effect to some of the sensors that is unwanted, but a longer delay would potentially lose notes if the drums were played at a very fast tempo. Another issue with the drum kit is that it has trouble playing two notes at the same time. This might be an issue with ADC reading speed on the Arduino or might be caused by the current debouncing solution. A protoboard would have improved the usability of the buttons, because it would have prevented them from being lost in the wires on the Arduino breadboard shield. Finally, when filming the video above, it was noticed that the very small delay between hitting the sensors and the note being played out made the drum kit rather difficult to play rhythmically. It is difficult to pinpoint where the bottleneck occurs, so more exacting testing would need to be performed.


In conclusion, the goals of the project were met. An electronic drum kit, that uses sensors to interface with an Arduino, which then sends the data to a Max patch that outputs MIDI drum data, was developed. The look and feel of the completed drum kit met my expectations. The software interface with Max 7 also very much met my expectations. The responsiveness between the drum kit and software, however, does need some improvement. However, for a prototype, I believe this drum kit works quite well and I am happy with the results.


Many thanks to Laura and Karen Den Hertog for the use of studio space and their help with finding materials to make the drum pads with. Also, many thanks to Dirk and Annie Dubois for their help in making the drum pads and Annie’s incredible video shooting and editing skills. I could not have done it without you all.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s