Introduction: Kitsh Desktop USB Christmas Tree for Geeks
Wood turning small trees is an easy beginner project, it does not requires too much wood and it is quite rewarding. However I had a growing forest on the TV stand of the living room and I realized I had to step up a little bit.
With Christmas coming I decided to make a nice blinking Christmas tree.
This would do a perfect gadget for the office.
- ATTINY85 with micro usb (digispark type, bellow 2$ on ebay)
- 2 micro screws
- thermal glue
- 3 leds (3 different colors. I used blue red and green)
- wires (old phone cables or dead ethernet cables are a good source)
- heat-shrink tubing
- 3 pieces of brass or aluminum tube (the link between the LED and the fibers)
- about 2m of 1mm optical fiber (end glow pmma).
- wood with bark (I used cade wood, olive tree gives good result. Those are species I can find localy, your choice could be different of course. I wanted to have some bark left on the base of the tree and this works well with cade or olive tree)
- micro USB cable
- lathe and gouges
- soldering iron
- drill bits
- computer with arduino IDE installed: https://www.arduino.cc
Step 1: Design and Draw Your Tree...
The light effect will be obtained with light from leds guided through optical fiber up to the edge of the tree.
It requires a base big enough to hold the attiny, three LEDs and allow plugging of the usb. I wanted mine to have four levels, each one will have six light spots, this makes 24 optical fibers. As a result, our Chrismas tree trunk will need to be big enough to hold the 24 fibers.
See pictures of the drawing I made for the tree and the progression to turn it.
Step 2: Wood Working Part: Turn the Tree
The overall process is to :
- cut a piece of wood (the size of the final tree plus a few centimeters to allow holding in the chuck).
- start turning between centers and cut a good grip for the chuck on both ends.(I used some tape to settle the bark on the wood and make sure it is not detaching)
- place in chuck and drill the inside chimney for the fibers. I drilled 5mm and 10mm and measured how far I needed to drill from the design drawing) - return the wood and place the other end in the chuck.
- turn the outsite cone
- draw a line for each level
- for each level cut to the final diameter (from drawing)
- shape the star and each level of the tree
- cut two sides of the star and use file to give its final shape
- mark 6 points per level (where the lights will come out ; I measured the diameter with a calliper and trace six marks with a compass set to the radius - as for a regular hexagon on a circle)
- drill the 24 dots (you need to drill toward the base of the tree (for easy fiber insertion) and toward its center until you meet the chimney)
- sand the tree on the lathe
- cut apart under the base (remove the piece which was used to hold in the chuck).
- cut a small usb cable access on the base
Step 3: Electronic Part
The circuit is very simple, we just want to drive three LEDs with the attiny85 IO pins.
Reading the attiny data-sheet we can read that the maximum DC current is 40mA per IO pin (page 160 of the datasheet http://www.farnell.com/datasheets/1698186.pdf) and that the total current of all IO pins should not exceed 60mA (note 5 page 161).
In order to limit the current going through each LED we place a resistor in serie.
Some reading about LEDs to understand the resistor calculation: http://www.farnell.com/datasheets/1698186.pdf
Our Attiny IO pin high output voltage (because it is operated from a 5V usb) will be about 4.3 V (I call it Vio).
We target a current of 20mA going through our LEDs:
Rred=125 Ohms (I took a 120 Ohms I had)
Rblue=Rgreen= 40 Ohms (I took 47 Ohms)
LEDs are polarized, the longer pin is the positive and is soldered to its resistor to P0,1 or 2 of the attiny.
I soldered the shorter pins together and wired them to the ground of the attiny.
Step 4: Insert Optic Fibers
The fibers are inserted from the top and need to be divided into three groups of eight fibers (one group per led color).
I wanted a regular distribution of the colors on the tree, each led is getting two fibers from each level. The easiest progression is from top to bottom (level after level) keeping the 3 groups separated (ie attach the fibers with a rubber band). Once inserted and secured with its group, the fiber is cut with few extra centimeters.
The final cut will be done once the attiny and the leds are in place in the base. After the final cut we can give a nice rounded finish to the end fiber by using a lighter to melt it.
Step 5: Attach the Led to the Fibers
I used some heat-shrink tubing to group the fibers together and attach them to the LEDs through small pieces of brass tube.
We can now push the fibers up and insert the 3 leds in the chimney. The attiny board is secured with two screws in the base and a small wood insert.
Step 6: Program the Attiny85
The digispark (or its clone) can be programmed almost like an Arduino. It comes with 6 i/o Pins (we use only 3 of them) a micro usb port for easy programming, this port can also be used for serial communication (using the SerialUSB library). We will use the communication capabilities to set various blinking mode of our Christmas tree.
Instructions on how to program and use the digispark: http://digistump.com/wiki/digispark/tutorials/con...
In order to upload the program to the digispark you need to use "upload" button on the Arduino IDE and then unplug/replug the digispark from the USB port.
If it fails to upload, check that your USB cable is data capable: some USB cable are charging-only cables and do not have the wires required for serial communication.
Step 7: Hook Up to Your Computer and Enjoy!
The Christmas tree can be used either plugged in a USB compatible charging source (like the ones we use to charge mobile phones) or plugged in a computer USB port.
On Linux here is how I set the blinking mode: Once plugged in the port shows up in my system as /dev/ttyACMn (n is 0, 1 or more):
I use this /dev/ttyACM0 device to send A B or C:
echo -n B > /dev/ttyACM0
Runner Up in the