Introduction: Multi Touch/Force Midi Drum Pad (O-mat)

With this instructable you will learn how to build a modular and interactive musical midi instrument, in this case, an interactive Drum Set!

For the construction of the interactive mat (O-mat), we will use as reference the first steps of this instructable.

If you already build an interactive mat (O-mat) you could start from this step.

Step 1: Materials and Tools

Picture of Materials and Tools

For making the mat:

Materials:

Tools:

  • Ruler
  • Measuring tape
  • Cutter
  • Glue
  • Crayon/marker
  • Soldering Iron
  • Multimeter

For making the circuit:

Materials:

    Tools:

    • Wire strippers
    • Diagonal cutters

    Step 2: Mat - Part 1

    Use this Youtube video as a guide.

    The key component that makes O-mat work is the velostat. When pressure is applied to it, the velostat changes its resistance. Like you saw in the video, we are creating a matrix sensor, specifically a 15 by 15 sensor matrix (225 sensors!).

    Step 3: Mat - Part 2

    Picture of Mat - Part 2

    Summing up, you will end up having two sides of the mat, one with copper columns and one with copper rows. You will need to weld one by one (I recommend using a ribbon cable for ease of use). You will need to insert the velostat between the to sides of the mat. To finish, you will need to paste both sides of the mat. Now, you are ready to start the circuit.

    If you want to make a quick test, with the help of a multimeter, sense one of the pins of the ribbon cable connected to the copper rows of the mat with one of the pins of the ribbon cable connected to the copper columns of the mat. Apply some weight to the mat and see if the resistance changes, if you don't see the change in resistance, apply weight in another area. If still you don´t detect a change in the resistance check your welding in the copper areas and the velostat in between.

    Step 4: Circuit - Which Microcontroller?

    Picture of Circuit - Which Microcontroller?

    So, for this instructable we are proposing the use of another microcontroller, a teensy LC. This is mainly because the teensy can run natively midi, and with an arduino board we have to add a couple of extra steps to make the system work.

    Below is a list with the advantages/disadvantages of each microcontroller.

    Teensy LC or Teensy 3.0

    Advantages

    • This boards are pretty fast, the slowest (teensy LC) runs at 48 [Mhz] and both boards are 32 bit
    • They can run USB MIDI natively, there is no need to install additional Arduino libraries or special drivers for your computer.

    Disadvantages

    • You need to install an add-on for making them work with the arduino IDE
    • Not all the Arduino developed libraries are compatible for this boards.

    Arduino Boards

    Advantages

    • You probably already have one of these boards
    • You don't have to make special tweaks for making them run in the Arduino IDE

    Disadvantages

    • They are not as powerful in performance as the teensy boards (Arduino UNO, mini pro. etc)
    • You will have to use the MIDI arduino library, and install an app that translates the serial communication to MIDI commands

    Step 5: Circuit - in the Breadboard

    Picture of Circuit - in the Breadboard

    Depending of the microcontroller you chose, you can use as guidance the circuit diagrams that are shown above.

    When you finish connecting all the parts in your breadboard, connect the two ribbon cables to the mat. The orientation of the cables don't matter.

    Summarizing, this are the minimal connections for making the system work:

    • 4 digital outputs for mux 1
    • 1 analog input for mux 1
    • 5 digital outputs for mux 2
    • We are connecting 16 resistors to make voltage divisors in the multiplexor that is connected to the analog input.
    • In all the circuits we are suggesting to leave the pin 13 without connections to use the integrate led in the boards.

    Step 6: Circuit: One Step Further

    Picture of Circuit: One Step Further

    We wanted to have a "finished product" like, so we made a pcb for the circuit and a laser cut case, here are the files if you want to make the same as ours!

    Step 7: Code - Teensy Boards

    Picture of Code - Teensy Boards

    For programming the teensy board you will need to download the teensyduino add-on. Follow all the instructions of that page for a correct installation. After installing the add-on for flashing the teensy board, you will need to select your board in the menu tools -> board and then select in the menu tools -> USB type -> MIDI

    If you made the same connections as the circuit diagram showed in the previous step you will not need to make any changes to the sketch. If you wired the circuit differently you will have to make changes in the sketch in the following lines:

    //Mux control pins for analog signal (SIG_pin) default<br>const byte s0 = 19;
    const byte s1 = 18;
    const byte s2 = 17;
    const byte s3 = 16;
    
    //Mux control pins for Output signal (OUT_pin) default 
    const byte w0 = 7;
    const byte w1 = 6;
    const byte w2 = 5;
    const byte w3 = 4;		
    
    //Mux in "SIG" pin default 
    const byte SIG_pin = 1;		
    
    //Mux out "SIG" pin default
    const byte OUT_pin = 23;	
    
    //INTERNAL LED pin default
    const byte STATUS_pin = 13;

    where:

    • s0-s3 are the control pins of the multiplexer (the one that has an analog input and all the resistors connected to it) that reads the signals.
    • SIG_pin is the analog input of the above mentioned multiplexer.
    • w0-w3 are the control pins of the other multiplexer.
    • OUT_pin is the SIG connection in the other multiplexer.
    • STATUS_pin is the one that has connected the internal LED in the boards

    Below is the sketch file that you need to flash in your teensy, it has comments for a better understanding :)

    Step 8: Code - Arduino Boards

    Picture of Code - Arduino Boards

    For making it work in an Arduino board you will need to download and install the following:

    After installing the MIDI to Serial Bridge, you will need to do an extra step to make it work depending on the OS of your computer, use this FAQ as guidance.

    If you don't know how to install the Arduino library, here is a great tutorial for installing external Arduino libraries.

    If you made the same connections as the circuit diagram (the arduino mini pro diagram) showed in step 5 you will not need to make any changes to the sketch. If you wired differently the circuit you will have to make changes in the sketch in the following lines:

    //Mux control pins for analog signal (SIG_pin) default
    const byte s0 = A0;
    const byte s1 = 12;
    const byte s2 = 11;
    const byte s3 = 10;
    
    //Mux control pins for Output signal (OUT_pin) default 
    const byte w0 = 9;
    const byte w1 = 8;
    const byte w2 = 7;
    const byte w3 = 6;		
    
    //Mux in "SIG" pin default 
    const byte SIG_pin = 1;		
    
    //Mux out "SIG" pin default
    const byte OUT_pin = 5;		
    
    //INTERNAL LED pin default
    const byte STATUS_pin = 13;

    where:

    • s0-s3 are the control pins of the multiplexer (the one that has an analog input and all the resistors connected to it) that reads the signals.
    • SIG_pin is the analog input of the above mentioned multiplexer.w0-w3 are the control pins of the other multiplexer.
    • OUT_pin is the SIG connection in the other multiplexer.
    • STATUS_pin is the one that has connected the internal LED in the boards

    Below is the sketch file that you need to flash in your arduino, it has comments for a better understanding :)

    Step 9: Finishing Touches

    Picture of Finishing Touches

    Since in the code we are creating 9 virtual buttons in the O-mat, we designed a 3x3 button matrix with the instruments of the drums, below you can download the pdf image.

    For deciding witch midi tones we wanted to generate from the O-mat, we used as reference the notes that our software (garageband) identifies as the instruments of the drums. Knowing the notes that we wanted, using as reference the table from above, we finally founded the midi numbers that we needed to generate.

    • Instrument -> Note -> Midi number
    • Crash Cymbal -> A2 -> 57
    • Floor Tom -> F1 -> 41
    • Crash Cymbal -> C#2 -> 49
    • Tom Tom 1 -> C2 -> 48
    • Tom Tom 2 -> A1 -> 45
    • Ride Cymbal -> D#2 -> 51
    • Bass Drum -> C1 -> 36
    • Snare Drum -> D1 -> 38
    • Hi - Hat -> A#1 -> 46

    From the code, you could notice that there is a declared array with the midi tones that we already mention.

    const byte miditones[numofbuttons][numofbuttons] = {                                              				      {57,41,49},
                                                  {48,45,51},
                                                  {36,38,46} };       //Desired midi tones 								  	  //per button matrix

    Step 10: Test It!

    Teensy

    After having made all the previous steps (the construction of the mat an the teensy steps), launch your favourite music program an play with it!. In mi case I used garage band.

    Arduino

    So, by now you should have completed all the necessary steps for making it work!
    Connect your Arduino to the computerOpen the hairless midi serial bridgeSelect the serial port of your ArduinoCheck the Serial<->MIDI Bridge On boxOpen your favourite music program, in my case, garagebandPlay with it!

    Step 11: Troubleshooting &/or Tweaking

    Number of virtual buttons, you could change the number of virtual buttons, the maximum number of virtual buttons depends on the number of copper rows and columns you pasted in your mat. For this instructable we made a 15 rows by 15 columns mat so we could have a maximum of 15 by 15 virtual buttons.

    const int numofbuttons = 3;				//Num of desired buttons
    const byte miditones[numofbuttons][numofbuttons] = {    
                                                  {57,41,49},
                                                  {48,45,51},
                                                  {36,38,46} };       //Desired midi tones 								  	  //per button matrix
    • The numofbuttons constant determines the number of virtual buttons per row and column, in the example is a 3 by 3 virtual button matrix.
    • If you change the numofbuttons constant you will have to change the miditones array putting the desired notes in the array (I use as reference the table that is in the image above.

    Sensitivity, you can change the following parameters in the code:

    const int umbral = 10;         //Threshold percentage<br>const 
    int maximopeso = 300;         //Variable for detecting when no weight is on the mat
    • The umbral constant changes how hard you need to press the mat for making a button on or off.
    • The maximopeso constant changes what is the minimum pressure needed for active the mat.

    Step 12: I Don't Want to Build It (coming Soon!)

    Picture of I Don't Want to Build It (coming Soon!)

    If you are interested in having an O-mat, and you don't care how to build it. We are working on making teensy & arduino, designing different types of mats. So if you are liking the things that we are doing, stay alert!

    Comments

    bettiblue (author)2015-11-19

    This is awesome project! I have few questions.

    Do I have to modify source code if I use a Arduino Uno?

    Is there any react speed difference between Arduino uno and teensy board?

    OniriaMX (author)bettiblue2015-11-19

    Thank you!

    For the first question, you only need to change the first lines of the code that assign the pin connections between the arduino and the multiplexers, so if you are using as a guide the circuit diagram picture from step 5, in the code the following lines should look like this:

    //Mux control pins for analog signal (SIG_pin) default
    const byte s0 = A4;
    const byte s1 = A3;
    const byte s2 = A2;
    const byte s3 = A1;

    //Mux control pins for Output signal (OUT_pin) default
    const byte w0 = 6;
    const byte w1 = 5;
    const byte w2 = 4;
    const byte w3 = 3;

    //Mux in "SIG" pin default
    const byte SIG_pin = 0;

    //Mux out "SIG" pin default
    const byte OUT_pin = 2;

    //Row and Column pins default
    const byte STATUS_pin = 13; 


    For the react time between the teensy and the Arduino (We test a teensy LC VS an Arduino UNO) the results where the following:
    Arduino UNO: 22 Hertz
    Teensy LC: 222 Herz
    So in conclusion the Teensy exceeds in speed the Arduino UNO

    I hope with, all te mentioned above, I have had answered your questions

    Cheers!

    bettiblue (author)OniriaMX2015-12-20

    Thank you ! One more question, Do I have to do any settings in the Garageband? I connected everything and uploaded code but it doesn't work.

    LoganK8 (author)2015-11-23

    Hi Oniria ! Thank's for those great instructables !
    I plan to use this kind of matrix based FSR for a midi device I'm working on.
    I'd need to build a 15x24, or two 12x12 grid so as to get 360 pressure sensors.

    Columns would be connected to digital inputs of an Arduino Mega, rows would be connected to analog inputs and grounded via a voltage divider.

    As the controller is meant to act like a polyAftertouch keyboard, every sensor must be independant, and that causes a lot of problems.

    One of these is ghosting in the matrix. (http://pcbheaven.com/wikipages/How_Key_Matrices_Wo...

    What would you do to avoid this?
    I might be wrong, but I don't think there's a place to add diodes in this design..
    Are there other solutions? Or should I consider using a PCB?
    Or building a high resolution matrix, so as to get severals sensors per buttons?

    OniriaMX (author)LoganK82015-11-23

    You could have a high resolution matrix, and have various sensors per button, another solution that comes to mind is that you could have a considerable space between the copper rows/columns. If you want to have a small gap between the sensors I would suggest using conductive threat, for the ghost effect, the code is in this instructable is designed for not having that problem, because it reads ones column and one row at a time and analices always the maximum and minumn values in the matrix before making a decision. The drawback of always being analysing all te values, is that you need an speedy microcontroller including the ADC multiplexing, I wouldn't recommend using a mega because it's multiplexor is a little slow in switching from one channel to another

    Cheers!

    LoganK8 (author)OniriaMX2015-11-24

    Hi !
    Thank's for your answer.
    I really don't care about other problems than ghosting. I'm going to adapt the design. Use a spacer..etc.

    But being able to use the matrix this way withouth having to add other components would be awesome.
    So you told me that the code do the thing.

    I've read it, but I have to admit that I'm not an expert programmer..
    Could you explain the theory behind it ?
    How would the decision be taken?

    As an exemple ? If I press three keys in a square, how would the microcontroller know that the fourth one isn't pressed..

    tomatoskins (author)2015-11-18

    Hahaha I love it! Real drums are awesome but so are various types of e-drums out there! Thanks for sharing your project!

    OniriaMX (author)tomatoskins2015-11-19

    Thank you!

    About This Instructable

    8,055views

    153favorites

    License:

    More by OniriaMX:Multi Touch/Force Midi Drum Pad (O-mat)O-mat en españolO-mat
    Add instructable to: