Animated Christmas LED Star project
(Project added 2nd November 2006)
The LED star is about 35cm across and designed to be displayed indoors in a window.
I originally created the star using a 16F872 controller. The original version worked ok – but had no spare memory for adding more features.
This version uses a 18F2620 because I now prefer the 18F series and decided it would be a good general purpose 28 pin chip to use. It has more than enough memory (64K) so I can add as many features as I want now. (A cheaper 18F25K22 or 18F24K22 can now be used instead – see firmware download section)
(It should also work using a PIC18F2525 instead if you find it easier or cheaper to obtain)
Since, I made the first version, brighter LEDs are now available and cost is much lower – this project currently uses a total of 60 comprising of 25 Blue, 15 Green and 20 Red.
- An ever changing animated display, Patterns and speed chosen at random.
- It can fade from one pattern to the next
- Low power consumption
- Currently 32 different patterns have been coded – and plenty of space available for more.
The circuit has been kept as simple as possible. The microcontroller uses portB to control the matrix columns through a cheap ULN2803 octal darlington transistor array.
This has the advantage of being compact,designed to work with logic levels without extra components and each output can carry 500mA, easily enough for this project.
The matrix rows are driven by portA directly and series resistors are used to limit the current supplied to each LED. Each port pin can only supply 25mA, with the multiplexing the effective current is even lower – but still bright enough.
PortC is eventually going to be used for a serial data link to control other stars, enabling the pushbuttons to make configuration changes etc. and three pins will control a colour changing effect to go in the centre of the star.
The microcontroller is clocked at 32Mhz using it’s internal oscillator to save port pins – a timer function has been added, it is not very precise,but it can be adjusted to be good enough for use over the Christmas period though.
On power-up, it lights all of the leds for several seconds as a diagnostic feature. Then it chooses patterns at random, also choosing a random speed for animating each pattern plus a random number of repeats for some patterns. Some patterns are enhanced by fading the leds – others are more appealing with no fade.
The star works ok without any settings, although some features can now be set-up using the two pushbuttons.
Configuring the centre RGB led.
If you have used an RGB led with a common cathode (negative) lead, then it will work ok.
If you want to use an RGB led instead with a common ANODE (positive) lead, then you must connect the anode lead to +5V instead of 0V and enable it by holding the UP button pressed while applying power (this setting will then be retained in eeprom memory).
Enabling the timer function
(All settings are best made by viewing the star from behind)
This allows the star to turn-off at a chosen time. First, set the current time by pressing the SET button. The hours (12 hour time) are shown in a line of 12 leds across the star and the led at the top point lights for PM.
Press the UP button to step up the hours. Then press the SET button again to show Tens of minutes on the five blue leds in the middle of the star and Ones of minutes on the nine leds at the base of the star.
Press the UP button to count-up the minutes.
Press the SET button again when you have finished setting the time.
Setting the ON time
Hold the SET button pressed for several seconds until the centre RGB led lights RED.
Now set the ON time (just like setting the time as before) When done, press the set button and the centre RGB led will light GREEN for setting the OFF time.
Set the OFF time as before.
Press the set button again and the RGB led will light BLUE for adjusting the clock timing.
The clock speed is at default to begin with (shown by a single led at the middle-base of the star.
Pressing the UP button lights leds to the right to increase the speed and then to the left to decrease the speed.
The clock oscillator is factory preset to an accuracy of about 1 or 2% and this option allows it to be adjusted up or down in steps of 0.4%.
Press the set button again to end all settings.
The on/off times and speed adjustments are now stored in eeprom memory.
Resetting back to defaults
If you ever need to reset the chip back to defaults (removing saved timer and rgb led settings) it can be done by holding both SET and UP buttons pressed while applying power.
Toggling the display on/off
Press the UP button to to toggle the display off/on without using the timer function.
Several Stars can sync together.
To sync two or more stars together you just need a pair of wires.
You choose one star to be the Master and connect a wire from it’s TX terminal to the RX terminal of one or more other stars. Then also link the Ground wires (0V)
For the possibility of longer distance links, I have used a slow speed serial data (2400bps) “Manchester” encoded protocol.
This may make it possible to link stars using short range RF data modules (Although I have not tested it because I don’t have any!)
When using the serial link, the option to turn on/off the star’s leds at preset times is controlled by the master star. (no need to configure it on any other Stars)
Here is a YouTube video of my two stars showing how they randomly sync patterns (I have improved the firmware slightly since making the video)
You will need a PIC programmer compatible with the PIC18F2620, PIC18F25K22 or PIC18F24K22 microcontroller such as a Microchip “Pickit2” or “Pickit3” programmer.
I shall update the file version here as features are added/bugs fixed etc.
I do not release the ASM source code for this project.
Firmware for PIC18F2620:
Alternate firmware for PIC18F25K22: (tested)
Alternate firmware for PIC18F24K22: (not tested)
Alternate firmware for PIC18F2550
For the PIC18F2550 version, you will need to connect resistor R5 to pin 18 instead of pin 9.
Also connect a 220nF capacitor to the PIC18F2550 vUSB pin14. (The RX/TX serial option is not available for this chip.)
The circuit is simple enough to construct on stripboard, Or use the single sided pcb layout design provided.
The microcontroller should be fitted in a socket. Connections to the pcb can be made either directly or use rows of connector pins. Power can be provided by a 9V DC wall-wart adapter rated at 300mA or better.
Drawing a five pointed star accurately can be time consuming – so I have made some templates to print-out and transfer to plastic sheet.
Making the star and wiring-up all the LEDs does take the most time, you need to be patient, it is very easy to make mistakes when doing the wiring.
Detailed instructions, templates diagrams etc. are all in the manual below –
9th December 2013: Added firmwares for using a PIC18F25K22 or PIC18F24K22 which are physically compatible with the original device and may now be easier and cheaper to obtain. (Select the appropriate firmware in the download section above.)
v0.5 (10th December 2008) (Various small changes plus several new patterns added.)
(22nd October 2008) Thanks for an inquiry from “Charles” regarding the original PIC chip being difficult to obtain in his location. I have checked the current hex file (v0.4) is compatible with a PIC18F2525 so you should be able to use that chip instead.
v0.4 (14th December 2007) (added serial link functionality – allows several stars to be randomly synced to a master star)
v0.3 (8th December 2006) (added 12 more display patterns and a few improvements)
v0.2 (2nd December 2006) (added RGB LED and timer + slightly improved the displays)
v0.1 (2nd November 2006) (first release)
I have created another LED Christmas window decoration – see my
The Snowflake is designed to complement the Star, using only white LEDs this time.
An old Christmas project
Several years ago, I created an LED Christmas tree window display with a couple of PIC16F84s and some hardboard.
I am not documenting it here as it evolved onto two separate pcbs and took ages to construct.
Perhaps one day I will update the design?
Anyway, here is the link to my YouTube video showing it in action.