Firebroom

First, I want to thank Becky for taking us to the Halloween parade! Since the country I came from does not really celebrate Halloween(we do give out candies to children but that’s all), it was interesting to experience new culture. I especially loved watching other people’s costumes.

I made the ‘Firebroom’ for this project. This is for the witch who gets really excited when surrounded by people or hear loud noises. The broomstick changes its color of bristles from white to red according to the noise level.

broomstick from Shin Young Park on Vimeo.

20181106_202238 (1).jpg

For the circuit, I used micro-amlpifier, Arduino Uno, RGBW Neopixels and 3xAAA battery pack. At first I was using Arduino Gemma but I noticed that my computer cannot recognize the Gemma. So I switched to Arduino Uno and that was my saddest moment in this project.

I made the broomstick before making the circuit, but I had to re-make the broomstick in order to fit in my Uno. Hopefully it worked out well.

I used a fabric that is not so dense in other to let the lights out. I wrapped the Arduino board with the fabric and attached it to the stick. After that I tied bristles to the stick and wrapped the fabric again.

20181031_005738.jpg

Below is the code for this project. I kept making adjustment to the code to figure out how sensitive the sound sensor has to be. Serial monitor was very helpful in the process. Starting from n, I made adjustments and finally decided to use 5n.

#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() {

  Serial.begin(9600);
  

  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) < SAMPLE_WINDOW) {
    int sample = analogRead(MIC_PIN);
    if (sample  signalMax) signalMax = sample;
  }
  
  int peakToPeak = signalMax - signalMin; // Max - min = peak-peak amplitude
  int n = (peakToPeak - 10) / 4;          // Remove low-level noise, lower gain
  if (n > 51)    n = 51;                // Limit to valid PWM range
  else if (n < 0) n = 0;
  
  Serial.println(n);

  ColorWipe(strip.Color(255, 255 -5*n, 255 -5*n), n);        // And send to LEDs as PWM level
}
// Fill the dots one after the other with a color
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);
  }
}


It was exciting to learn more about coding and making circuit. After finishing this project, I felt much more confident about coding and circuits!

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