Halloween Costume Updates

This week, I finished coding for my broomstick and finished soldering and making the exterior part of the broomstick. I was almost done making the exterior part last week but after soldering my parts I felt the need to remake it, so I just undo the things and remade it.

I experimented with colors first without mic amplifier and wrote the code. After writing the code and soldering it, I tried out different version of code to make the sensor react more sensitively to the sound. However I chose not to use that code considering the noise level of Halloween parade. (Actually it’s my first time participating so I am still not sure haha)

The interesting part was that mic amplifier reacted in different way depending on where it was connected to. At first, I was powering by my computer and it worked well. However when I connected to my battery pack and put the mic amplifier to breadboard, it did not reacted in the way I wanted. (It turned red even in quiet situation) After connecting the amplifier to the 3.3v pin of Arduino board, the problem was solved.

In order to put my board inside the broomstick, I wrapped and attached my board with fabric that does not block the light and then wrapped/attached that to the handle part of the broomstick.

Except for the time when soldered parts came apart several times, I enjoyed the whole process a lot!!:) I became familiar with codes and also practiced soldering a lot.
 

Below is the code that I used.

#include 
int SAMPLE_WINDOW =33; // Sample window width in mS (33 mS = ~30 Hz)
int LED_PIN = 6; // DIGITAL pin # where LEDs are connected
int MIC_PIN = 1; // ANALOG pin # where microphone "OUT" is connected
int NUM_LEDS = 8;
#define BRIGHTNESS 50
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, 6, NEO_GRBW + NEO_KHZ800);
void setup() {

pinMode(MIC_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);

strip.setBrightness(BRIGHTNESS);
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}

void loop() {
// Listen to mic for short interval, recording min & max signal
unsigned int signalMin = 1023, signalMax = 0;
unsigned long startTime = millis();
while((millis() - startTime)  255) n = 255; // Limit to valid PWM range
else if(n < 0) n = 0;
ColorWipe(strip.Color(255, 255-n, 255-n), n); 
void ColorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s