Introduction: Hackable 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. This instructable explains our design, then you can grab the open source files and build your own.
You can buy a copy of our card at Seeed Studio. Assembled cards are ($15), and a kit for adventurous solderers is $12.
You can also see this article with the original formatting at DangerousPrototypes.com.
Step 1: Hardware - ATtiny13A
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.
Step 2: Hardware - Programming and Battery
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.
Step 3: Hardware - 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.
Step 4: Hardware - PCB and Partslist
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.
|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)|
Step 5: Firmware
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.
Step 6: 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?
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!
- Build your own card from our open source design files and firmware.
- An assembled card is $15 at Seeed Studio. The PCB will be red. Firmware programmed and battery included.
- A kit is $12 at Seeed Studio. The PCB will be red. Firmware programmed and battery included.
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!
We have a be nice policy.
Please be positive and constructive.