Introduction: Animated Christmas LED Snowflake Window Decoration

I make my own Christmas lighting decorations instead of buying ready-made ones.
This year, I made a "Snowflake" pattern using a matrix of 61 white LEDs.
The finished item measures about 38 x 40 cm and is controlled by a PIC microcontroller.

It is programmed entirely in assembler, has about 30 different pattern effects with fading, random speed and pattern selections.

The video shows some of the effects (I have added more effects since then)

The ZIP file contains the current PIC HEX firmware file and templates for making the Snowflake, PCB etc.

The latest firmware can also be found on my website.

I have added the .dwg file for the Snowflake pattern to allow you to customise the size etc.
You will need a CAD program to use it. ( A good free one is A9cad by A9tech).

Step 1: What You Need

A sheet of clear 2mm thick Polycarbonate/Acrylic plastic sheet (The type found in DIY stores).
(You could use a thin sheet of wood or strong cardboard instead if you wish.) about 40x37 cm (16 x 14.5 inches).

Parts list
1 x 100uF capacitor (25v electrolytic)
1 x 10uF capacitor (16 or 25v electrolytic)
2 x 0,1uF capacitor (small decoupling 50v type)
1 x 1N4002 Or 1N4001 diode
1 x 7805CT Standard 5V regulator
1 x CD4028BE Or equiv. (BCD to decimal decoder IC)
1 x ULN2803 Or ULN2803A (Darlington Transistor array IC)
1 x PIC18F1330-I/P Microchip PIC microcontroller
8 x 56 ohm resistors (0.25W carbon)
61 White LEDS (5mm) High brightness.
1 x 18pin IC socket for the microcontroller.
1 x piece of single sided pcb board at least 6.3 x 3.5 cm (2.5 x 1.38 inches)
Plenty of thin hookup wire for connecting the leds.
A 9 volts DC power supply (rated at over 100mA)
4 x m3 nuts & bolts for securing the pcb to the plastic.

The PIC18F1330-I/P is a standard 18 pin DIP version, available from suppliers such as Farnell, Mouser, RS Components etc.

The leds can be the very cheap types typically available in bags of 100 from various suppliers.

The resistors can be a higher value up to 100 ohm types if you don't mind the leds being slightly dimmer.

Tools and stuff
A sturdy workbench
Fine tip soldering iron and solder.
A heavy duty "Stanley" type retractable DIY knife for scoring the plastic sheet.
A metal "straight edge" for guiding the knife when scoring the plastic sheet.
Tape measure or ruler.
Pen for marking cuts and a sharp Bradawl for marking drill holes.
Small pliers and cutters for the wiring work.
General purpose clear glue for fixing any loose leds.
Printer, Paper and clear adhesive tape.
Safety equipment: Eye protection for soldering, trimming wires etc.
Antistatic ESD protection: A Wrist strap and ideally a ESD workbench mat are recommended.
5mm & 3.5mm metalwork drill bits for drilling led and pcb mounting holes.
A general purpose drill (I used a rechargeable type)
Tools and equipment for etching a pcb using the "Toner transfer" or other methods - there are various tutorials elsewhere so I won't go into it here.
A programmer that supports the PIC18F1330. Ideally a Microchip "PICkit 2" or similar clone type.
(Note. Older types of programmer/software (eg JDM) may not support this chip.

Step 2: Cutting the Plastic Sheet

Leave any protective film on the sheet.
Measure and draw cutting marks on the sheet ready for scoring to 40cm wide by x 37 cm high rectangle. (about 16 x 14.5 inches).

Score it with a good quality,heavy duty "Stanley" type retractable DIY knife and metal straight edge.
Repeat the scoring several times to make sure that the plastic is weakened enough.

When sufficiently scored, it should be possible to snap the sheet cleanly by placing the scored line aligned with the edge of of your workbench.Bend the rest of the sheet down, forcing it to break along the score.
(Or it can be sawn using a jigsaw at very low speed with a fine toothed blade intended for plastic or metal cutting.)

Step 3: Marking the LED Positions

Now print the four snowflake templates in the PDF document. Make sure they print at the correct size by setting the "Adobe Reader" or other PDF software print option for "Page Scaling to None" or "100%".

Trim excess paper at the overlapping sides (still leaving a small overlap) then join sheets with clear tape.
(Hold the sheets to the light to get best alignment of the overlapped edges before finally taping them)
When all four sheets are taped together, trim around the outside then tape it centrally onto the plastic sheet.

Step 4: Drilling the LED Holes

Use a sharp tool such as a Bradawl to mark the plastic sheet at the centre of every LED hole.
Then drill each hole slowly with a 5mm metal drill bit to avoid melting the plastic.
(Test the drill hole size first on some scrap material to ensure the LEDs will be a firm fit in the holes).

You can also now drill two holes in the top corners of the sheet to attach string for hanging it in a window.

Using the PCB paper template or the PCB itself, mark and drill four 3.5 mm mounting holes for it in the space below the centre LED.

Now remove the paper template and any protective film from the plastic.

Wear an ESD antistatic wrist band when handling the leds to avoid damaging them!

Insert all LEDs with the flat side (short lead) towards the top of the sheet.
Carefully push each led in fully into it's hole, if any are a loose fit, apply a drop of general purpose clear adhesive to the side of the led before pushing it into it's hole.

Step 5: Wiring the LEDs

Two diagrams in the PDF document show colour coded guides to wiring the LED anode and cathode connections.
A cathode connection is the shorter lead adjacent to the flat side of each led.

Using thin,single strand insulated wire (You can use stranded wire instead if you like, although it doesn't look as neat ). Make the connections by carefully striping just enough insulation to wrap the wire around each led lead without completely cutting the wire.
(I used two different colour wires for the anodes and cathodes to make it easier to trace any errors)

Solder each connection as you go.

After making the last connection in a row or column, leave enough wire free for connecting to the pcb which is intended to fit in the space under the centre led.

Do not solder the leads closer than about 5mm from each LED and trim the leads after making all of the connections.
(TIP: Hold each LED lead while trimming to prevent it flying off.)

TIP: If you use small pieces of PVC tape or sticky labels to mark each Row/Column wire it will make it easier to identify when connecting to the PCB.

The trimmed LED leads are sharp, you may want to cover them over later using another similar sized plastic sheet or card.

Step 6: Making the PCB and Fitting the Parts.

I made my PCB using the "toner transfer method", using an old iron to transfer the toner onto a piece of PCB board. I won't describe how it is done here as other people have probably made good instructables or web tutorials about it.

The pcb layout is in the PDF document ready to be printed at the right size (no scaling as before).

You could easily build the circuit on "stripboard" instead, it is not too complex.

Fit the parts as shown, making sure that you use a socket for the microcontroller.
The ICs all face in different directions because it made the pcb layout easier.
(I don't usually do that - but I wanted to avoid the need for wire links and keep the board small)
Make sure you fit them with the pin1 marks matching the layout.

Ensure the electrolytic capacitors are fitted with the negative polarity mark matching the layout.
The diode is also fitted with the white band matching the layout marking.

Connect the Rows and Columns wires in the right order.
You can either solder them directly into the pcb holes or use 2.54mm pitch header pins.

Step 7: Program the Microcontroller

You will need a PIC programmer compatible with the PIC18F1330.

I used a Microchip "PICkit2" programmer connected to my home made ZIF socket adapter shown in the photo. (I did not provide any in-circuit programming connections to the pcb.)

The latest .hex file to program the chip with can be found in the attached zip file.

It is possible to use a "JDM" style programmer instead, although I only managed to get it working with DL4YHF's "Winpic" software:

Winpic did not support the 18F1330 by default but has an editable config file: "devices.ini" where new PIC device configurations can be setup.
If you want to try it, rename your existing devices.ini file in your winpic program folder then temporarily replace it with my file (which only has a few device configs in it, including the 18F1330).
Or just cut and paste the config from my file into your Winpic devices.ini file.

Step 8: Testing Everything

After fitting all components to the pcb except the microcontroller, inspect the board to check for solder splashes, dry joints etc. (also use a multimeter to check power supply tracks for shorts if you have one.)

Apply power and check the regulated voltage between TP1 & TP2 (should be 5 volts).
Disconnect the power.

If all checks so far are OK, fit the microcontroller in it's socket and apply power.
All leds should light-up for a few seconds at power-on. If some do not light, turn-off the power and check their connections.

During the display, watch some of the non-random led patterns, looking for any lack of symmetry. Fix any wiring mistakes by tracing the led connections,comparing them to the anodes and cathodes wiring diagrams.

Step 9: Circuit Description

The snowflake is controlled by the PIC18F1330 microcontroller (ic4) using it's internal oscillator.
It multiplexes the 8x8 LED array by sequentially turning on one column at a time then sending 8 bits of data to the 8 LEDs in that column before moving on to the next.
This occurs much too fast for the eye to notice any flicker. (Actually about 15,000 times per second!)
The microcontroller selects the column to turn-on via a logic chip (ic2), a 4028 BCD to Decimal decoder. This is used in this design as this microcontroller does not have enough outputs to address all of the columns directly.
Only 8 outputs of the 4028 are used and these can be controlled using only 3 ports of the microcontroller (although a fourth port is actually used so that all of the columns can all be turned-off if required)
The 4028 drives a ULN2803 8 way transistor array. This chip has outputs easily capable of supplying enough current to light all 8 leds in each row.

The row leds are driven directly by the microcontroller via current limiting resistors as each output will only have to light one led in a column. Each microcontroller port can handle about 25mA max . As the display is multiplexed, it is possible to get-away with higher peak currents by using smaller value resistors although I don't recommend it!

Power is provided via a 5 volt regulator ic1. The power consumption is quite low (just under 100mA).

The circuit includes a serial data connection. This is provided so that the snowflake can be turned-on/off at a pre-set time from a connection to another of my Christmas projects from a few years ago (an LED Christmas Star).
My Star also sends commands which should be able to sync together several Snowflakes, although I can't test it yet as I have only built one Snowflake so far!