Disco Pumpkin
Halloween is one of my favorite times to get creative. I always have a "blargh too many ideas not enough time" moment the week before. We had a few good ideas, a few bad ideas, and finally landed on making a pumpkin that rocks out to music. Pretty simple and we put it together in a day, but making it actually look like it was synced to the music was the harder part.
All it is really was an rgb-123 board, an arduino and an electret microphone from sparkfun.
Here's the code:
All it is really was an rgb-123 board, an arduino and an electret microphone from sparkfun.
Here's the code:
sickpumpkin.ino | |
File Size: | 6 kb |
File Type: | ino |
The code uses the FastLED library, a convenient arduino library for WS2812 (among other) rgb leds which allows us to send simple commands for color/position without worrying about the underlying communication.
We had two modes, one that just sweeps with vertical bars based on the volume, and another that steps through Conway's game of life (which Tania coded twice, since her computer crashed. what a beast!). I had to do a rolling average on the input to make sure we were actually detecting beats for the game of life. The modes switched whenever the input was larger than the maximum stored amplitude in the rolling average buffer (N=100 samples at ~50Hz = max amplitude with a 2 second history. Looking back on it, that seems way too short but somehow it looked okay. Maybe with other things going on the loop rate was slower than that ). Anyways, here's the result (the mic and my phone are inside the pumpkin). Apologies for the vertical video. |
|
Now if only we had more trick-or-treaters... maybe next year