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
For making the mat:
Materials:
- Velostat
- Copper tape or any type of metal tape
- Any type of insulating fabric.
- Ribbon Cable
- Solder Leaded
- Break Away Headers
Tools:
- Ruler
- Measuring tape
- Cutter
- Glue
- Crayon/marker
- Soldering Iron
- Multimeter
For making the circuit:
Materials:
- 2 Multiplexers
- 1 breadboard
- 1 of the following microcontrollers boards
- 16 2k [Ω] resistor
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
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?
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
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
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
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 :)
Attachments
Step 8: 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 :)
Attachments
Step 9: 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
Attachments
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!)
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!