October 31, 2012
A few days before Halloween, my girlfriend and I needed a pumpkin project. We decided that a fully functioning (well, almost fully functioning) Cylon Pumpkin was fitting, considering that we had just finished watching Battlestar Galactica.
We had brainstormed several ideas and settled on a few: the “scanning” LED lights for eyes were a must; the signature sound of the new Centurions was necessary; and some kind of trip sensor was needed to control the lights and sound. As a result, I put in orders at Adafruit for a Wave Shield Kit, Digi-Key for a PWM LED Controller, and SparkFun for an Ultrasonic Distance Sensor.
With equipment in hand, we started on the gourd mod. First up was the Wave Shield. We followed Adafruit’s Wave Shield guide to solder and test the kit. We found the Cylon “sweep” sound on a ringtone site (amid a slew of old Cylon sound clips) and used Audacity to record and manipulate the file to play on the Wave Shield. Once hooked up to my Arduino UNO, we were greeted with the low grumbling “WHOOMB WHOOMB” over a set of headphones.
Now that the sound was handled, I hooked up the TI TLC5941 to a breadboard and connected 16 LEDs. I followed this tutorial to control the LED chip. I made a few small changes to the sample code to make the lights more like a Cylon and less like KITT. To do this, I adjusted the brightness of the LEDs adjacent to the primary LED, barely lit the LEDs 2 away, and made the “sweep” overshoot the edges just a bit. Next, I used karduino’s sample code to control the LV-EZ1 ultrasonic distance sensor and used it to enable the eye sweep. An object detected within 10 feet would initiate 2 full sweeps (both ways twice) of the LEDs.
Finally, I had to merge the LED controller and sound system. Looking through the example code and libraries, I noticed that the PWM controller and Wave Shield used shared interrupt timers. As I was pressed for time, I did not rewrite the libraries to coexist with different timers. So, I connected the Arduino UNO / Wave Shield combo to my SparkFun Arduino Pro Micro using a single wire. The Pro Micro managed the LEDs and distance sensor, and when it saw an object, it sent a pulse to the UNO before starting the LED sweep. The UNO would then play the “WHOOMB” sound four times when it sensed the 5V pulse. After adjusting the LED timing, I managed to get the sweep and sound to line up.
Meanwhile, Alina found a picture of a Centurion and used it as a stencil to begin carving out the pumpkin. We began with ukavu’s work on Instructables but modified the design so that the heavy contrast sections, such as the mouthpiece and cheeks, were carved all the way through the pumpkin. Smaller details, such as the surrounding hood and forehead, were etched into the skin, thus giving the appearance of shading. Once we were satisfied with the appearance, we set out to add the electronics to the pumpkin.
We soldered wires to 10 LEDs (only 10 would fit in the eye cavity), which were attached to a piece of cardboard, and ran the wires through the back of the pumpkin. As we quickly discovered, no tape of glue would stick to the inside of a pumpkin, so we tacked the cardboard to the inside using safety pins. Since the speaker that came with the Wave Shield kit proved too quite, we routed the sound through an iPod speaker dock, which amplified the menacing sound to a more appropriate level. With everything hooked up, it was time to test. As we walked in front of the pumpkin, it glowed and made the familiar ominous sound.
On Halloween night, we set the pumpkin by the front door, lit a candle inside the cavity, and placed the electronics safely behind the orange Cylon. Many of the neighborhood children got a kick out of the electronically enhanced Jack-O-Lantern. Unfortunately, the sound would only work intermittently. I realized now that I should have included a pull-down resistor on the line connecting the Arduinos and external interrupt code that would better sync the sound to the lights. I suppose that will be included in the Cylon Pumpkin 2.0 release.