# The Open Xmas Tree

201

1

## Introduction: The Open Xmas Tree

Xmas is all around us, basically all year long. :)

But if you would like to be prepared when the big day comes, you can follow these instructions and surprise your loved ones with a nice little electric gizmo.

The Open Xmas Tree is a little project that goes way back in time, to where I was still in school and my electrics teacher suggested to create a small Xmas tree shaped PCB (hand made) with a binary counter IC and some LEDs. It was fun, and if you designed your PCB correctly, your LEDs blinked "randomly" around the tree, but this got boring after a while because, well it really wasn't random at all.

After a lot of years, I decided to re-view this old circuit, and create a better one, with professionally produced PCB, a 555 timer (for clock signal) and a CD4026 decade counter, 7 segments LED driver.
The layout was done, and as I started to assemble the trees, I had the idea to move this even further, and create a blinking tree, that can be programmed to your hearts contend.

This is how we got here.

Now here are the instructions to create your own, programmable Xmas tree based on the Atmel ATTiny84A, that you can upgrade with a simple Arduino UNO board as an SPI programmer. (but don't worry, I have already wrote a nice little code, with 8 different blinking patterns that you can download here.)

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Let's Get Technical

The circuit is powered by a standard 9 V battery (E Block, I think).

But here is the catch: the Atmel chip can only take input voltages up to 5.5 V.

So, first we need a voltage regulator, getting us a safe 5 V from the 9 V input. The part I designed here can supply up to 150 mA, which is more then enough. My tests show, that the final circuit doesn't really take above 30 mA at all. (with small 3mm LEDs)

After some buffer capacitors we can now safely use the ATTiny chip.

As you can see, not all it's legs are populated, but hey, it's a cheap chip, we can get away with that.
We only need to use 7 legs for the LEDs and one for the button that changes the blinking modes and time base. (or whatever you program it to!)
Also, you could get it done with the ATTiny44 and probably 24 as well, but the price difference is around 10 cents and this way you'll have 8 K Flash to store your program.

To make this really open, I have routed out the SPI re-programming legs of the chip under the SW1 button (designated as ISP for "in system programming"), so all you need, are 4 0.1 inch pins, taped together (baby bed of nails :) ) and an SPI programmer (like an Arduino Uno) to lunch your own awesome code on the tree.

Each LED has it's own 1 K Ohm current limiting resistor to keep them safe, but if you plan to use different LEDs, you might want to think about this value.

Sorry about S1 power switch, I know some people won't like it, but this is a cheap part, that I just happen to have around. You could make small indents into the PCB, or cut off the two little pins from under the switch, but I didn't do any of that. I think the switch can be soldered on just fine and it will be standing strong in an angle, it also makes the switching more comfortable in the end.

I have also made a 3D printable little stand for the tree, just to stop it from falling over once the battery is connected. With the stand the battery's weight holds the whole tree vertically.

## Step 2: Things Needed

A PCB manufacture. I know this sounds hard, but today we have a tone of good and cheap companies to choose from. I personally use JLCPCB because the board quality is really good and they are cheap. You can have 10 of these boards delivered to your home for under 10 dollars. But of course you can use any manufacturer you like.
Download the attached Gerber files and send them off for manufacturing. (I have also exported and uploaded an Altium file format, in case you would like to modify the tree first)

Soldering skills. Working with SMD parts can be frustrating, but with a little flux and practice, your boards will look better than any mass produced gadget out there.

Programming an AVR micro controller. I use an Arduino UNO for this. There is a great instructable about the process.
https://www.instructables.com/id/Arduino-Uno-to-Pr...
BUT WATCH OUT: this Instructible says, that you should set the Pin mapping to counterclockwise. If you do this the tree will NOT work. Set it to map clockwise!

Atmel ATTiny84A micro controller.

Toshiba TA78L05F(TE12L,F) power regulator

SMD 1206 cap. with 1 u F capacity

SMD 1206 cap. with 0.33 u F capacity

SMD 1206 cap. with 10 u F capacity

SMD 1206 resistor 1 K Ohm (7 of them)

SMD 1206 resistor 10 K Ohm

THT LEDs (7 of them). I used 3mm 2 m A ones

a C&K button (PTS645SK43SMTR92LFS) but any button with a 6mm * 6mm footprint should do

a main power switch (AYZ0102AGRLC)

9V battery terminal

Attached you can find an Excel sheet with the bill of material (BOM) where I linked in most of the parts from the TME.EU Webshop, but of course you can use any provider and make as long as the function and footprint is OK.

## Step 3: Building It All Together

Once you have it all in your hands (the manufactured board, all the parts, your soldering iron and maybe some tee) you can start with applying some flux to the micro controllers footprint on the PCB.

I usually solder the ATTiny in first, because it is easier to work with it while you have space on the board.

Then solder all the small components on. Resistors, capacitors and finally the regulator. (if you place them and hold them down with the tip of your tweezers, you can fix them down with a little bit of solder on the tip of your iron. This should keep them in place until you do the other side properly, and then come back to the first side to finish the job)

Next add the button and the switch.

Now put the PCB on something that will hold it above the table. Around 10 mm should be OK, but it depends on how long you would like your LED leads to be. (I use my side cutter as support)

Insert the LEDs from the back side of the PCB and carefully solder them in on the other side. Make sure that they are not bending in any direction and watch out for the polarity as well.

Finally, cut your 9V battery connector leads to about 40-50 mm and solder them in. First make sure you have them the right way around, both polarity wise, and so that the battery can be connected without stressing the cables.

Nice job!
Use your cup of tee now, you have earned it!

Next, set up your SPI programmer and connect it to the 4 pins above the micro controller.

You can power the tree from a 9V battery now, but make sure to connect the ground lead of your programmer and the board. Just clip your programmer's GND to one of the LED's negative lead.

I have marked the programmer pads with pin numbers, but this might help you with the connection:

pin 9 - CLK
pin 8 - MISO
pin 7 - MOSI
pin 4 - RST

Download the INO file from here and use your Arduino IDE (or convert it to anything you like and use it with different programmers) to flash the controller.

Don't forget to set the option in Arduino IDE to "Burn bootloader". This is needed to set the ATTiny to work on 8 Mhz. If this is not done, your Xmass tree will blink really slowly, but don't worry, you can always go in and do it again.

I must admit, programming the tree with 4 pins taped together is not an easy thing to do, but keep at it, with a little practice, you can reprogram your tree as often as you want.

As soon as the programming is done, your Xmas Tree should start blinking in the first programmed mode. (random blinking)

Great job! Congratulations! Now you have your own Open Xmas Tree to play around with!
And don't forget to finish your tee as well.

## Step 4: User Manual

Here is what you should get in the end:

After you connected the 9 V battery the Xmass tree can be activated with the sliding switch S1.

To turn it off again, just reverse the S1 switch.

By short pressing the SW1 button on the top, you can toggle between these preset modes:

2 - Circle with switching LEDs
3 - Circle with LEDs staying on and going back
4 - Circle with LEDs staying on
5 - Snaking around the tree
6 - Knight Rider :)
7 - Dropping light with switching LEDs
8 - Dropping light with LEDs staying on

By pressing the SW1 button longer for then 2 seconds you enter the time base changing mode.

Here you can set the time between blinks.
You can see that you have entered this mode, when only 1 LED is flashing.
Each LED represents a different delay time:

LED 1 - 250 ms
LED 7 - 500 ms
LED 6 - 750 ms
LED 5 - 1000 ms
LED 4 - 100 ms
LED 3 - 150 ms
LED 2 - 200 ms

You can move forward in the time setting by short pressing the SW1 button.

When you have selected the delay time you would like to have, press and hold the SW1 button for longer then 2 seconds.
After that, the tree will return to the last running mode with the new time base set.

## Step 5: Where Do We Go Now?

Its all up to you!

Take the INO file and add new blink modes or new features.

You could try to do some fine pulse time management, to dimm the LEDs or build a game using the button or do what every comes into your mind!

Take the hardware and redesign it. Add a buzzer to play horribly annoying Christmas melodies. Lay out more LEDs (there is always room for some more LEDs).

Don't forget this is The Open Xmass Tree, so let everyone enjoy it! :)

## Recommendations

Epilog Laser Class

112 Enrolled