I made a helmet for my halloween costume out of a 5 gallon paint bucket, some LED's, an Arduino, and an off the shelf voice changer.
Youtube is here: - YouTube
Basically: it's 12 LEDs wired in parallel and connected to a digital output on the Arduino board. I used the setup from the knock tutorial but modified the code slightly.
/* Modified Knock Sensor
* Original by DojoDave <http://www.0j0.org>
* Modified for use in a halloween costume by Spain [removed serial info, delay, and added if-else]
* Uses a piezo element as a sound detector to turn LEDs on and off
*
* Original can be found at:
* http://www.arduino.cc/en/Tutorial/Knock
*/
int ledPin = 12; // leds connected in sequence to control pin 12
int knockSensor = 5; // the knock sensor will be plugged at analog pin 5
byte val = 0; // variable to store the value read from the sensor pin
int statePin = LOW; // variable used to store the last LED status, to toggle the light
int THRESHOLD = 10; // threshold value to decide when the detected sound is a knock or not
void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
}
void loop() {
val = analogRead(knockSensor); // read the sensor and store it in the variable "val"
if (val >= THRESHOLD) {
digitalWrite(ledPin, HIGH); // Turn LED on if above threshhold
}
else {
digitalWrite(ledPin, LOW); // Turn LED off if NOT above threshhold
}
}
If I had more time:
- I would have looked into using the arduino as a voice changer, or else made one out of a kit, rather than using one off the shelf from a big box store
- I would have made the eyes flicker when I spoke also (as it is they are connected to a separate 9v battery)
Thanks to DojoDave for the code, and for forum members nkcelectronics and Cheater for helping me figure out how to solder PC board!