Prototype: Hackable LED Christmas card & ornament


Holiday cards that blink and beep have always fascinated us. This is our hackable DIY version, made with an ATtiny13A and a few LEDs. Push the button to play a short light show in the tree. We’re sending these to friends and family this year. It’s a handmade, hackable gift, and it was a ton of fun to build.

The card is also an homage to Velleman’s blinking Christmas tree ornament kit, and a kit-biz reference to the Adafruit Promise. (Did you know Velleman has a nixie tube clock kit? Really!)

You can buy a copy of our card at Seeed Studio. Assembled cards are $15, and a kit for adventurous solderers is $12. We’re excited to gauge interest an SMD kit, and hope to offer it as an option for future projects.

Video, hardware, firmware, and more, after the break.


Click for a full size schematic image [PNG]. The schematic and PCB were made with the freeware version of Cadsoft Eagle. Download the latest design files and firmware on the project Google Code page.



A small ATMEL ATtiny13A microcontroller (IC1) is the brain of the circuit. One pin (PWM) blinks the lights, most of the other pins are used for programming and power. You could get similar effects with a 555 timer or discrete components, but our goal is to learn about a new microcontroller family and make something easy to hack.

The ATtiny needs a 10K pull-up resistor (R1) to hold the reset pin high, a mini tactile switch (S1) resets the ATtiny by temporarily connecting the reset pin to ground. A 0.1uF capacitor (C1) decouples the chip from the power supply.


ATtiny microcontrollers are programmed through a six-pin In System Programming (ISP) connection. The ISP header is oriented towards the back of the card. We made a programming probe to avoid soldering a pin header on the board.

Power is supplied by a 3volt, 20mm lithium coin cell (BAT1) on the back of the PCB. The holder should work with 2025 or 2032 coin cells.  The ATtiny will work over a range of voltages, down to 1.8volts.

Tree LEDs

Our tiny, twinkling Christmas tree lights are 0805 surface mount LEDs (LED1-10). Each LED has a current limiting resistor (R3-12). We used 390ohm resistors, for about 3mA at 3volts, and 8mA at 5volts during development. All 10 LEDs together use about 30mA when powered by the battery.

30mA is too much current to source or sink on the ATtiny pins. Instead, an NPN transistor (T1) switches the ground connection of the LEDs. Transistors also require a base resistor (R2) to limit how much current is pulled from the microcontroller pin.


LEDs need to be connected in the correct direction or they won’t light. Through-hole LEDs usually have one longer lead that indicates the positive supply side (anode). SMD LEDs have a green edge, and sometimes an arrow on the back, to indicate the ground connection (cathode). This chart shows the correct orientation for each LED, the ground connection should point the same direction as the arrow.



Click for a full size placement image [PNG]. The schematic and PCB were made with the freeware version of Cadsoft Eagle. Download the latest design files and firmware on the project Google Code page. We made the PCBs with Seeed Studio’s Propaganda service, the extra boards from our order are in the Seeed store. We expected green PCBs, but got black – the final PCBs will be red.

We used vias, components, and the silk screen to create a Christmas theme.  This is our first try, maybe it’ll become a holiday tradition that we improve on year after year. The final PCB should have visible silver vias on the tree, we didn’t make them big enough on the prototype. We also removed the year, so if it isn’t delivered in time for Christmas it can be used again later.

This is a two-layer PCB with parts on both sides. We started on the front, soldering large parts like the microcontroller (IC1) and switch (S1), then added smaller passives like resistors and capacitors. The battery holder goes on the back of the PCB, we soldered it last so the work surface stayed flat and stable while we worked on the front.

If you’re soldering the PCB yourself, be sure you have tweezers with pointed ends to place and hold components. You’ll also need flux to make everything flow, and copper wick to clean up any extra solder. We use Blu-Tack for about everything else.


Name Quantity Value (size)
IC1 1 AVR ATtiny13A (SOIC-8)
C1 1 0.1uf capacitor (0805)
T1 1 NPN 200ma+ 100hfe+ transistor (SOT23)
R1 1 10,000 ohm (10K) resistor (0805)
R2-R12 10 390 ohm (390R) resistor (0805)
LED1-10 10 LEDs, various colors (0805)
S1 1 Mini tactile switch (SMD)
BAT 1 20mm battery holder (SMD)
CELL 1 20mm battery (CR-2025)


The firmware is written in C using the open source AVR-GCC compiler with AVRStudio. Download the latest design files and firmware on the project Google Code page. Program the firmware through the 6pin ISP programming header with something like the STK500 or USBtinyISP. On a side note, we’re really excited about using an open source compiler for this project.


When power is applied to the circuit, the ATtiny runs a simple program that pulses the Christmas tree lights. When the program finishes, the chip sleeps until it’s reset by a button press or battery change.

The fading program uses software pulse-width modulation to dim the LEDs. The ATtiny13A has hardware PWM, but it outputs on the ISP pins which are already occupied. It’s possible to share programming pins with other functions, be we weren’t ready to do that on this project.

When the program completes, the chip just goes to sleep forever. This is different than many microcontroller programs that resume from sleep on a pin change interrupt. A button press resets the ATtiny and starts the program again.

Taking it further

We’ve got a lot of ideas for future holiday cards – multiple LED channels, color changing LEDs, sound, accelerometer control, capacitive touch sensing, LCD screens, epaper, festively cut PCBs, and more. We didn’t use a bootloader in this project, but here’s a discussion of possible options.

What would you do? Do you have any hacks for this card, or ideas for future cards?

Get one


Seeed Studio has the card assembled, or as a kit. The kit includes 0805-sized surface mount parts, it isn’t for everyone. This is our first project to be offered as a kit, we’re excited to see how many people are interested in an SMD kit. This will be a very limited run, probably 100-200 total, so get yours early!

We’d like orders to be delivered in time for Christmas, but there’s a significant chance that might not happen. Seeed Studio is already working on a small number of cards, that should help speed up delivery. Hopefully they arrive in time for Christmas, but delivery will be really tight. We’ll post manufacturing updates as we get them.

Have a silver, soldery Holiday!


Join the Conversation


  1. Nice little … pre-Christmas surprise. :)

    Good to know that the PCB color will be red … leaves the option to paint the tree green :D

    For the kits … I can see my kids doing some SMD soldering instead of helping to prepare the Christmas tree. :D

    And hey, what’s going on there between Lady Ada and Ian? o.O

    Don’t you like her “Ice Cube Clock Kit”? ^^

  2. @RobotGrrl – You should be able to use any ‘common’ through-hole LEDs in this circuit. ‘Common’ meaning ~2volts forward voltage, <20mA current draw, such as 3mm and 5mm through-hole LEDs.

  3. On the 2 kits I received from seeed studio, R2 was a different value all together.
    R3-R12 are different from the schematic.

    Easy to figure out. R1 is as advertised.
    R2 is the other single resister.
    The rest are for R3-R12.

    Yes, cr-2032 battery does work. That is waht I had laying around.

  4. @Michael – I’m sorry about that, I sent two versions to Seeed, maybe they got mixed up. Was R2 1K? That’s a more appropriate value, but I reduced it to 390ohms in my final design to keep the part count lower. If you have the resistor values, I’ll post an update with the correct partlist.

  5. debug question:

    I finally soldered up my kit of this and the LEDs work, but there’s no fading/blinking/going to sleep action happening. I’m assuming the AVR comes programmed? If that is indeed the case any ideas where a solder bridge or something could be causing the PWM not to happen?

  6. OK, starting to think I fried the MC somehow, unless I need to desolder something before doing ISP:

    ./avrdude -C avrdude.conf -p t13 -c buspirate -P /dev/tty.usbserial-PirateV3

    Detecting BusPirate…
    ** Bus Pirate v3
    ** Firmware v4.1 Bootloader v4.1
    ** DEVID:0x0447 REVID:0x3043 (B5)
    BusPirate: using BINARY mode
    avrdude: initialization failed, rc=-2
    Double check connections and try again, or use -F to override
    this check.

    1. I believe the AVR DUDE implementation is currently too fast for the ATINY13. I’m not 100% sure of that, but I recall someone recently mentioned it.

      You might try with the SKT500v2 clone firmware for the BUs Pirate, that’s what I used to develop the firmware.

      1. re: avrdude: initialization failed, rc=-2

        Hi I got the same error… I fixed it when I realized that MOSI and MISO were plugged in the wrong way around.

  7. Hi, I love the Christmas card Idea and was hoping to run a few pcb’s on my cnc. I thank you so much for the files and since I’m new to micro controllers I need to ask, which file do I program the attiny13a with? I am guessing just the .hex file but want to be sure before trying it. There were 4 other files in the folder so it threw me off a little. Also, can this be programmed with usbasp through the arduino IDE or do I have to use winavr which I have never used. Thanks again and please do let me know thru my email I left here. thanks, gordon

  8. I had 20 boards just made. Pin 2 and 3 are connected to each other on the board, I had to cut the Pin 3 trace to make the board work. Pretty sure the code calls out Pin 2 with a bit value of 3 for the LED control and not any other pins. I could be wrong. Takes me about an hour to assemble the board and program.

Leave a comment

Leave a Reply to Ian Cancel reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.