Sign in to follow this  
sLowe

Drum Lights Using an Uno32

Recommended Posts

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

Share this post


Link to post
Share on other sites

Will you have it so that the type of drum hit (the frequency that the piezeo sensor picks up) proportionally changes the color as well?  I.e. low frequency/soft hits for red, harder hits for green, and rimshots for blue?

Share this post


Link to post
Share on other sites

We could do something with intensity other than changing the brightness. However with drums, they usually have a pretty consistent frequency profile as long as you are on the same drum. We recently had this project set up to be on a drum set that had different base color values for each drum. (Snare: blue, Bass: green) Then if a drummer hit both of them at the same time and intensity the lights would flash teal. We decided to go back to one drum with a drum line in mind. Although we kept the color mixing algorithm in case we want to revisit that flavor of this project! Or could be used for the quad drummers.

As far as rim shots go, the data we get out of the piezo sensor is not quite accurate enough to determine where on the drum you hit. If we had a very nice piezo sensor and ADC, and maybe using a fft library, that kind of information could be figured out. Although looking at wave forms of drum hits, that may be a little advanced for us. (lots of harmonics and sweeps of frequencies) But if this was working, there no reason we couldn't start slapping sensors on instruments and getting a true light show generated by an orchestra or something! Maybe instead moving to technology like the clip-on guitar tuners. Like this one this one.

Share this post


Link to post
Share on other sites

That would be sweet if it was set up for a quad or a quint. It makes sense that frequency profile would be the same on a single drum since you want the heads of drums to be at a consistent tension while playing. 

For the whole orchestra, it might be interesting to just look into a microphone to pick up the frequencies (much like the sound sensor Tommy's team had for senior design) since I'm guessing the piezo sensor only grabs the physical vibrations, hence the percussion instruments. Its curious that it didn't pick up the vibrations off of the cymbal though... too much vibration should not be an issue and it's not like there are frequencies on the cymbal that cancel each other out, otherwise we wouldn't be able to really hear the cymbal in the first place.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this