Illuminadrum

DSC_0626

Drum

Sourced a drum after 4 hours of roaming Manhattan. This one was loud, meant to be played kids, was open from the bottom to give me space to fit electronics.

Started out playing with different codes http://www.arduino.cc/en/Tutorial/Knock after making a temporary circuit on Arduino Uno. It was fun to play with the piezo sensor. I wanted to ambitiously change the brightness with the impact on the sensor. I was almost there but the light wouldn’t go out in static position. Learnt about Mapping, countdown etc in coding.

Untitled-1

DSC_0630 (2)

DSC_0634

Soldered the LEDs in a parallel circuit

Finally used a Digital interaction instead of Analog one. Code:
// these constants won’t change:
const int ledPin = 11; // led connected to digital pin 13
const int knockSensor = A0; // the piezo is connected to analog pin 0
const int threshold = 1; // threshold value to decide when the detected sound is a knock or not
// these variables will change:
int sensorReading = 0; // variable to store the value read from the sensor pin
int ledState = 0; // variable used to store the last LED status, to toggle the light
int mapFade= 0;
int brightnessLED = 0;
int countDown = 0;
int fadeDown = 0;

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
Serial.begin(9600); // use the serial port
}

void loop() {
// read the sensor and store it in the variable sensorReading:
sensorReading = digitalRead(knockSensor);
// if the sensor reading is greater than the threshold:
if (sensorReading >= threshold) {

// send the string “Knock!” back to the computer, followed by newline
int cSensorReading = constrain(sensorReading, 0, 50);
mapFade = map(cSensorReading, 0, 50, 0, 255);
brightnessLED = brightnessLED + mapFade;

digitalWrite(ledPin, HIGH);

Serial.print(“knock!”);
Serial.println(sensorReading);
Serial.print(“constrain”);
Serial.println(constrain(sensorReading, 0, 10));

} else{digitalWrite(ledPin, LOW);}

delay(10); // delay to avoid overloading the serial port buffer
}

DSC_0010

Ad_blue man group

SEE THE VIDEO 🙂

http://www.youtube.com/watch?v=PQ_t-vmfd3I&feature=youtu.be

Thank you