Howdy,
I've assembled several Velleman (http://www.vellemanusa.com) holiday kits over the last few years to give as gifts:
I'm glad they make such kits, and the prices are reasonable. However, in the age of cheap microcontrollers, the fixed blinking LED patterns are a bit of let down after soldering a gob of LEDs. In almost all the kits, transistors switch on and off strings of LEDs based on the RC time constant of the components. Thus, I got the idea to hook up one of the kits to a microcontroller to add more pleasing variations.
I decided to give this a try with the Velleman 3-D Christmas tree:
http://www.vellemanusa.com/products/view/?id=351133
Thanks to RadioShack's recent DIY blitz, this kit is stocked in all 3 RadioShacks I've visited in Chicago recently. This mod could have been done with any number of popular microcontrollers, but I thought I'd shoot for an Arduino-compatible setup given many folks are familiar with it (and I was bit tired of fiddling with registers after a recent pure AVR project). I had an unused Breaduino kit (http://www.appliedplatonics.com/breaduino/) which is a breadboard-able ATMega328 Arduino clone I'd bought at Noisebridge (San Fransico's hackerspace). I decided to use this as my goal is to solder all the components on a small protoboard to mount under the tree. For now I've just setup the circuit on a breadboard with jumpers connected to the 3-D tree PCB:
The Arduino fades the LED segments in and out at different randomly-selected rates using PWM via the easy analogWrite() functions. I found it quite pleasing to watch, especially in dim light.
Here's the schematic of the 3-D tree kit from the instructions:
http://www.vellemanusa.com/downloads/0/minikits/manuals/manual_mk130.pdf
I cut the positive lead on each capacitor and then connected a jumper to the "capacitor-side" of the 82k or 100k resistor for each of the 4 segments (for one segment I clamped on the negative lead of the capacitor as corresponding the resistor lead was too tight of a fit for the mini-hook jumper):
Those jumpers then are connected to pins on the AVR via 1K resistors. Finally the 9V battery connector springs on the PCB are connected to the 9V rails on my breadboard (where a 9V battery is strapped on). I will make a proper schematic when I get ready to solder components onto a protoboard, but, for now, here's my messy breadboard:
The 2nd breadboard really isn't needed, but I started off by breadboarding all the components which are now soldered onto the 3-D tree PCBs. The Breaduino doesn't have a USB interface like an official Arduino board, so I used a FTDI USB-to-serial cable to program it.
Here is the sketch I wrote which is based on the PWM LED Fade example which is included with the Arduino installation:
// Arduino-mod for the Velleman 3-D Christmas tree kit // This code is in the public domain (based on the Arduino.cc Fade example). int fadeAmount = 0; int fadeMax = 0; int fadeMin = 0; int fadeDelay = 0; void setup() { //serial output isn't required, but useful when experiementing Serial.begin(9600); pinMode(10, OUTPUT); pinMode(11, OUTPUT); randomSeed(analogRead(0)); } void loop() { // generate random setting to keep patterns interesting // bounds were determined by experiementation, so you // you may want to tweak to your own liking fadeMin = random(1,100); fadeMax = 255; fadeAmount = random(1,10); fadeDelay = random(5,15); // this loop controls the duration for each random pattern // note, the faster the fading, the sooner the pattern will end // maybe this could be improved by refactoring the program to be // driven by a timer interrupt so each patttern gets equal duration for(int i=0; i<20; i++) { Serial.print(i); Serial.print("\t"); Serial.print(fadeMin); Serial.print("\t"); Serial.print(fadeMax); Serial.print("\t"); Serial.print(fadeAmount); Serial.print("\t"); Serial.println(fadeDelay); // fade from minium to maximum brightness for(int fadeValue = fadeMin ; fadeValue <= fadeMax; fadeValue += fadeAmount) { analogWrite(11, fadeValue); //invert the current brightness so that LED segments visually "oppose" each other analogWrite(10, fadeMax-fadeValue); delay(fadeDelay); } // fade from maximum to minimum brightness for(int fadeValue = fadeMax ; fadeValue >= fadeMin; fadeValue -= fadeAmount) { analogWrite(11, fadeValue); analogWrite(10, fadeMax-fadeValue); delay(fadeDelay); } } }
Now that I have a working prototype, I look forward to permanently placing the components on a board attached to the base of the tree to make an attractive holiday decoration.
I'd love to hear about what other holiday-themed electronics projects folks have been working. Please post in the comments if you've got anything to share.
Happy Holidays!
Drew