Drum Kit!

I totally ripped this off from Morgellon, but it sounded fun and I wanted to try it. He is going to build his own version of this that I am sure is going to be cooler.  I had to call him and ask some questions as he is most definitely the hardware end of our crazy love triangle. I want to dump the data into processing and have it animate the drums being hit, but that is for another day.


Arduino Knock Sensor Drum Kit v1 from droops on Vimeo.

When a drum is struck, a knock sensor (backwards peizo) talks to the arduino and activates an led ot change the color of the drum (blue), after a delay the blue led goes out and the drum becomes orange again.  I used a pullup resistor between the pins of the knock sensor, but i didnt get any different results with different values, so its probably dependent on the peizo that you use.

/*
droop's drum kit

dailyduino.com

droops - gmail

thanks for the idea josh!!
*/

int knockPin = 3; //pin for incoming knock sensor
int knockVal; //value from knock sensor
int knockLedPin = 10; //bue led
int normalLedPin = 4;  //orange led
int lightBlue = 2000; //counter for keeping blue light on
int limit = 1000; //how sensitive the knock sensor is, lower = higher sensitivity based on piezo and pull down resistor
int blueTime = 2000; //how long the blue led stays on

void setup(){
  pinMode(knockLedPin, OUTPUT);
  pinMode(normalLedPin, OUTPUT);
  pinMode(knockPin, INPUT);
  Serial.begin(9600);
  digitalWrite(knockLedPin, LOW);
  digitalWrite(normalLedPin, HIGH);
}

void loop(){

  knockVal = analogRead(knockPin); //read the knock sensor

  if (knockVal < limit){
    lightBlue = 0; //drop the value to activate the led
    Serial.println(knockVal);  //dump to serial for debugging
  }

  //this keeps the blue light on after a knock is registered
  if(lightBlue < blueTime){
    digitalWrite(normalLedPin, LOW);
    digitalWrite(knockLedPin, HIGH);
    lightBlue++;
  } else {
    digitalWrite(knockLedPin, LOW);
    digitalWrite(normalLedPin, HIGH);
  }  

}

Leave a Reply