20 Dec

Lazy Christmas lights

While digging out the Christmas decos I found the WS2811 addressable RGB LED Xmas lights from an old workshop.


They were missing the Arduino that was controlling them (probably been pinched for another project) so I decided to hook them up to an Arduino Pro Mini that I could leave permanently attached. I uploaded the FastLED librarys DemoReel100 example and strung the lights up in the porch.


All nice and xmasy – except I now have to remember to turn the lights on and off… I figured I could get the Arduino to do that for me. Sure I could plug the whole thing into a mains timer but where’s the fun in that. I had a few DS3231 I2C real time clock modules that I have been meaning to play with so this seemed like a reasonable excuse for a quick and dirty project. It also gave me an excuse to try interrupts on the Arduino as the DS3231 has two settable alarms that generate an ‘interrupt’ signal.


After testing the RTC and interrupts on their own to prove it worked (using JChristensens DS3232RTC library) , I was able to connect the DS3231 to pins A4 & A5 on the Pro Mini (These analogue pins double up as the I2C bus on this board) and the interrupt output from the DS3231 to pin 3 on the Pro Mini (the Pro Mini supports hardware interrupts on pins 2 & 3) and hacking together the fastLED demo code with the RTC demo code with some horrible glue code (its so bad I’m not going to include to here) I had a working set of Xmas lights that turn themselves on and off at predefined times, plus the Arduino now knows the time even after a power off.


Last Updated on 22 January 2016 by Mark