Hey Guys,
Tommy and I are starting a chipKit project that uses piezo sensors to sense a hit on a drum and then light the drum up with LEDs. This creates a pretty cool effect to watch in the dark. Our endgame with this project is to approach a drum line and hook them all up to some WS2812s to create a cool music/light show. Below is our proof of concept video using a single snare drum. We think we can use this technique for most percussion instruments. Cymbals seem to be the only thing we cant use this on so far.
https://www.youtube.com/embed/pQdNVhnbReM
Our next step is to dress up our drum a little more to make a little more appealing video to present to a drum line.
Let us know if you guys like our project or want to know anything about it. We will also attach the MPIDE sketch.
We will be posting to this stream as we progress with our project.
/************************************************************************/
/* Drum Lights Proof of Concept */
/* */
/* Authors: Thomas Kappenman and Samuel Lowe */
/* */
/* This is a simple sketch that lights up a snare drum whenever */
/* it is struck. */
/* */
/* tested supported boards: */
/* - Digilent UNO32 */
/* */
/* This library is protected under the GNU GPL v3.0 license */
/* http://www.gnu.org/licenses/ */
/************************************************************************/
#include <PICxel.h>
//our strip had 43 lights
#define number_of_LEDs 43
#define LED_pin 5
#define millisecond_delay 5
//Adjust these values to obtain better results for each drum
#define sense 25 //Sensitivity of each drum
#define debounce 300 //Debounce to get rid of idle values.
PICxel strip(number_of_LEDs, LED_pin, GRB);
struct drum{
int r;
int b;
int g;
int zero;
};
int red;
int green;
int blue;
int i;
int triggerval;
int lastval;
int in1;
int prevTime = 0;
drum drum1;
void setup(){
strip.begin();
strip.setBrightness(100);
Serial.begin(9600);
drum1 = {0, 255, 0}; //snare
}
void loop(){
int a;
if(millis()-prevTime > millisecond_delay){
a=analogRead(A0);
Serial.println(a);
if (lastval-a>100)in1=1;
lastval=a;
colorLogic();
in1=0;
if(red>= 15 )
red -= 15;
else
red = 0;
if(green>15)
green-=15;
else
green = 0;
if(blue>15)
blue-=15;
else
blue = 0;
for(int i= 0; i<number_of_LEDs; i++){
strip.GRBsetLEDColor(i, green, red, blue);
}
strip.refreshLEDs();
prevTime = millis();
}
}
void colorLogic(){
if(in1){
green += drum1.g;
red += drum1.r;
blue += drum1.b;
}
if(red >255)
red = 255;
if(green >255)
green = 255;
if(blue >255)
blue = 255;
}
DrumLights.zip