
I recently build a popcorn controlled drum set! While making popcorn some time ago, and experoiencing the strength with which the popcorns explode, I started to think in which ways I could use that. Maybe popcorn triggered toy car? I then thought I would do a popcorn triggered houshold orchestra. But finally I attached the popcorn to a drumset. So this is how it works:
The popping of the popcorn triggers 12 piezo contact microfons, which are hard wired to a an Arduino Mega and converted to MIDI Signal. This MIDI Signal goes to our custom-made robotic drum System, which plays the drums.
You could also just connect the MIDI output to a synth and play around with randomly created
SHOPPING LIST
// WRITTEN FOR ARDUNIO MEGA (2560)
// For Use with Arduino Uno, use “Serial” to send the Midi Notes (instead of “Serial1”)
// and delete the lines of code that send Values to the Console for Debugging [Lines 89-90, 107-111]// The Number ob Pads also has to be reduced to the UNOs 8 Analog-In-Ports (7 With Sensitivity Poti) [Lines 20, 21, 53, 88]unsigned char PadNote[16] = {36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
int PadCutOff = 30; // Minimum Value for a triggered Note
int MaxPlayTime = 150; // Cycles before a 2nd hit is allowed
#define midichannel 0; // MIDI channel. (0-15)boolean activePad[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // Array of flags of pad currently playing
int PinPlayTime[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // Counter since pad started to playunsigned char status;
int pin = 0;
int hitavg = 0;void setup()
{
Serial.begin(115200); // connect to the serial port 115200 for Serial Monitor
Serial1.begin(31250); //connect to the second serial port for MIDI out
pinMode(LED_BUILTIN, OUTPUT);pinMode(7, OUTPUT); //GND Poti Sensitivity
pinMode(6, OUTPUT); //VCC Poti SensitivitydigitalWrite(7, LOW);
digitalWrite(6, HIGH);
}void loop()
{
for(int pin=0; pin < 15; pin++) { hitavg = analogRead(pin); // read the Voltage from the Piezo if((hitavg > PadCutOff))
{
if((activePad[pin] == false))
{hitavg = 127; // Velocity to play the Note with
MIDI_TX(144,PadNote[pin],hitavg);
digitalWrite(LED_BUILTIN, HIGH); // Lets the builtin LED blink every time a note is triggered
PinPlayTime[pin] = 0;
activePad[pin] = true;
}
else
{
PinPlayTime[pin] = PinPlayTime[pin] + 1;
}
}
else if((activePad[pin] == true))
{
PinPlayTime[pin] = PinPlayTime[pin] + 1;if(PinPlayTime[pin] > MaxPlayTime)
{
activePad[pin] = false;
MIDI_TX(128,PadNote[pin],127); // Call Send-Midi-Note Routine
digitalWrite(LED_BUILTIN, LOW);}
}
}PadCutOff = analogRead(15); // reading the Voltage from the Poti for Sensitivity
Serial.print(PadCutOff);
Serial.print(“\n”);
}
void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY)
{status = MESSAGE + midichannel; //Sending triggered Notes via Midi
Serial1.write(status);
Serial1.write(PITCH);
Serial1.write(VELOCITY);Serial.print(“Triggered note “); //Sending triggered Notes user-readable via Serial for Debugging
Serial.print(PITCH);
Serial.print(” with Velocity “);
Serial.print(VELOCITY);
Serial.print(“\n”);}
Leave a Reply