Transitioning our Christmas lights to a central controller
Those who know us know that we have a reasonably decent Christmas lights display. Our home is blessed with a very large front gable: the entire width of the house!And because we've got a corner block with the house at an angle to the streets, we've actually got 2.5 sides of the house able to support lights (the 0.5 being the western end where, part-way along the carport, the neighbour's carport butts onto our roofline).
So, we've currently got 8 sets of deep blue icicle lights stretched all the way around almost to the back of the house. We've got a few more sets (e.g. some stars and shooting stars) on the house proper and in the garden. We've recently added some lights to the tree in our front yard: warm white around the trunk and partway up the two main branches, and some pink in the foliage (the pink matching the colour of the blossoms in mid December).
The Problem
These lights all run off separate controllers. There are 8 identical but unique controllers for the icicles, for example, and while these controllers state that they are supposed to remember their pattern (I endeavoured to have them all on the same pattern), they simply don't. This leaves wierd strobing effects at the set boundaries in places and makes me hope none of the neighbours suffer from epilepsy!And then there's the fact that none of the other sets work in tandem.
It all looks a jumbled mess to be honest - and I'd like something different
My Plan
I've had a look at some computer-controlled systems, and they all seem to rely on music input. I'd rather not do that, since we have a community hall on the street and we (along with the neighbours) are pretty sick of loud music most of the night in some occasions (even if it is nice).I've discovered a nice newish microcontroller, the PIC16F18344. It has 2 dedicated PWM (pulse width modulation) outputs along with 4 additional possible PWM outputs in a set of multi-function modules. And there are two additional timer modules which can be configured together for another couple of additional software PWM outputs. 8 PWM outputs; yum!
Why all those outputs?
2 of the outputs will be used to drive the two halves of the icicle lights. All of the strands can be linked together and run off them, so they'll all be properly synchronised: all the way around the house! Our waterfall-style Christmas tree on the front of the house has 2 channels, too, as do the pink lights in our tree... so I can run these off the same channels for really nice synch of the major display pieces.4 of the outputs will be for the RGBO style lights (red-green-blue-orange), of which we've got a few sets (including my very favourite mini shooting stars, bought from Coles of all places all the way back in 2008 and still mostly going strong).
The last 2 channels will be for any monochromatic pieces that we might like to link in (there are some that we'll leave permanently on, for example the long warm white strand around the tree... it's simply stunning as-is and making it flash, etc., I think will detract from the spectacle). Actually, I'm not sure we've got any of these at the moment, but that might change... and I'd be silly to not include it in the chip when I program it since it's not terribly hard!
Why PWM?
PWM allows the signal to quickly switch on-off the light strings (works really well with LEDs in particular). This on-off occurs much faster than the human eye can detect, but the amount on and off modulates the apparent LED brightness... so if the lights are on only 10% of the time, they'll appear to have 10% of the brightness compared to constantly on. Or something like that.Where to from here?
Well, I need to start working on the program for the chip. In fact, it's not terribly hard, since the dedicated PWM modules require only a few instructions to configure and set going... ditto the CCP modules (an additional instruction required to put them in PWM mode compared to the dedicated PWM modules). The 2 software PWM modules utilise the same base timer as the PWM/CCP modules but require pre-loading the timer modules with particular values, and handling the interrupts with dedicated code to toggle some general purpose I/O pins (the PWM and CCP modules toggle their outputs automatically... once set up, they can pretty much run forever without monitoring).The only issue is working out the timer control values to pump into the various PWM modules to make them flash, dim, etc. And then having some way of stringing the values together to make a set of patterns... which could be a problem since the chip has only 256 bytes of EEPROM. At 8 channels needing 2 bytes per channel per value, 256 bytes leaves only 16 combinations of value! I'd need probably 10 times that... Looks like some kind of external EEPROM interface, though the chip does have UART, SPI and IIC inter-chip communications modules to help...
Hopefully, more on this later!
No comments:
Post a Comment