Ardrumo--Kelly Staricha

  • Using piezos, I made a basic drum kit that uses the knock sensor readings that the Arduino program interprets as letters, and the processing program then reads the letters and triggers production of drum sounds. I chose to have five drum pads which correspond to different drum sounds:
  • (Sensor 1) Blue = Kick
    (Sensor 2) Yellow = Bass
    (Sensor 3) Pink = Snare
    (Sensor 4) Green = Cymbol
    (Sensor 5) Orange = Heavy Snare

    I downloaded the sounds as wav files from www.Free-Loops.com. The sketch can be modified to play basically any collection of sounds. 

     
    HOW DOES IT WORK?
    Basically, when you hit the drum pads, the piezo sensor sends information to the arduino and if the sensor reading is greater than the designated threshold, the arduino program will serial print a letter. The processing program has declared downloaded wav file sounds in it. When it reads the letter on the serial buffer, it triggers the designated sound to play.
     
    Other information about my program/project:
    -The green alligator clips connect the negatives (breadboard to black piezo wire) and the other colored alligator clips connect the positives (breadboard to red piezo wire).
    -I used resistors that were around 1 M ohm, and just adjusted accordingly by trial and error.
     
    Problems/Fixes:
    -I discovered that each time you start the program up from scratch you have to re-save the processing program in the LoadSample file and then save the sound data file within that new folder you create, or the program won't be able to import the sounds.
    -Make sure you use the plastic Duralar sheets or another firm surface between the foam pieces or the piezo won't be responsive all the time.
    -If you are hearing multiple sounds or getting some dead spots on the pad, try changing the strength of the resistors.
     
    If I had more Time or Money...
    -I think it would be cool to make a bunch of arduino instruments to go along with my drums like maybe a keyboard, guitar, etc.
    -I also might have attempted to make a rockband-like program for the computer with processing so that it would tell you which notes to play to make a beat or song.
    -I probably would have also played around with different sounds assigned to the drum pads other than drum sounds.
     
     
    Circuit--Schematic Diagram Representation:
    (This is a representation of one of the piezos. For my project it's this same circuit 5 times with piezos connected from GND to Analog Pins 0-4)
     
     
                             Circuit of One Knock Sensor                                           

     

     

    ARDUINO PROGRAM:

    /* 
     I used the Serial Call and Response example sketch and modified it...
     
     This program similarly sends an ASCII A (byte of value 65) on startup
     and repeats that until it gets some data in.
     Then it waits for a byte in the serial port, and 
     sends sensor values whenever it gets a byte in.
     
     
     The circuit:
     * 5 piezos hooked up to Analog Pins 0-4
     [Use roughly 1M resistors for each]
     
     */
    
    const int firstSensor = 0; //declares that each sensor is connected to Analog Pins 0-4
    const int secondSensor = 1;
    const int thirdSensor = 2;
    const int fourthSensor = 3;
    const int fifthSensor = 4;
    
    int sensorReading1 = 0;    // first analog sensor reading
    int sensorReading2 = 0;   // second analog sensor reading
    int sensorReading3 = 0;    // and so on...
    int sensorReading4 = 0;
    int sensorReading5 = 0;
    int inByte = 0;         // incoming serial byte
    
    const int threshold = 100; //constant threshold of the knock sensors
    
    void setup()
    {
      // start serial port at 9600 bps:
      Serial.begin(9600);
    }
    
    void loop()
    {
      // get incoming byte:
      inByte = Serial.read();
    
      sensorReading1 = analogRead(firstSensor); //read sensor
      if (sensorReading1 >= threshold) { //if reading is greater than threshold
        Serial.println("k");             //print designated letter
      }
    
      sensorReading2 = analogRead(secondSensor);
      if (sensorReading2 >= threshold) {
        Serial.println("b");
      }
    
      sensorReading3 = analogRead(thirdSensor); 
      if (sensorReading3 >= threshold) {
        Serial.println("s");
      }
    
      sensorReading4 = analogRead(fourthSensor); 
      if (sensorReading4 >= threshold) {
        Serial.println("c");
      }
    
      sensorReading5 = analogRead(fifthSensor); 
      if (sensorReading5 >= threshold) {
        Serial.println("h");
      }
    }
    
    
    

     

    PROCESSING PROGRAM:

    /*
     * I modified the LoadSample sketch in the processing examples
     */
    
    import ddf.minim.*;            
    //import minim library (where the wav sound files are saved)
    import processing.serial.*;    //import serial library
    
    Serial myPort;                //declares Serial port as "myPort"
    
    Minim minim;                 //declares sounds are coming from minim library
    AudioSample kick;            //states names of audio samples...
    AudioSample bass;
    AudioSample snare;
    AudioSample cymbol;
    AudioSample heavy;
    
    void setup()
    {
      size(400, 300);             //creates a blank pop up when program is running
      println(Serial.list());     //starts serial listing of letters
      myPort = new Serial(this, Serial.list()[0], 9600); 
      //defines myPort and how the serial data will be read
    
      // always start Minim before you do anything with it:
      minim = new Minim(this);
      // load wav file from the data folder:
      kick = minim.loadSample("Free Drum Kick.wav", 2048);
      bass = minim.loadSample("Bass Drum Rock Kick.wav", 2048);
      snare = minim.loadSample("Snare Drum Hit.wav", 2048);
      cymbol = minim.loadSample("Zcymbols.wav", 2048);
      heavy = minim.loadSample("Heavy Snare Hit.wav", 2048);
    
      // read bytes into a buffer until you get a linefeed:
      myPort.bufferUntil('\n');
    }
    
    void draw()
    {
    }
    
    void serialEvent(Serial myPort) { 
      // read the serial buffer:
      String myString = myPort.readStringUntil('\n');
      println(myString);
    
      if (myString != null) {
        myString = trim(myString);       //trims the serial print so there's no extra lines
      }
      if (myString.equals("k")) {     //if certain letter is read
        kick.trigger();          //trigger corresponding sound...
      }
      if (myString.equals("b")) {
        bass.trigger();
      }
      if (myString.equals("s")) {
        snare.trigger();
      }
      if (myString.equals("c")) {
        cymbol.trigger();
      }
      if (myString.equals("h")) {
        heavy.trigger();
      }
    }
    
    void stop() {
      kick.close();      
      bass.close();
      snare.close();
      cymbol.close();
      heavy.close();
      minim.stop();     //stops the program
      super.stop();
    }
    
    

     
     
     
    PICTURES:
     
     

    Drum pad in process-first I hot glued the Duralar to the bottom foam piece,
    then used duct tape to secure the piezo (without the plastic covering) in the center of the pad,
    then glued the next foam piece on top.



       
            Finished Drum Pads                                                                                                                                                                                                            
     
     
     

    Testing the program with a regular piezo



                                                                                                                                                                Finished circuitry
     
     
          
    The plastic sheets I used between the foam circles       

     
                                  Hard at work
     
     
     

                   The finished product!!!
     
     
     
     
    Comments