As regular followers of the blog will know, I love Arduinos and all the stuff they can do. Those that know me will also know that I don’t love Christmas, particularly the seasonal decoration stuff. So this project was a nice mix of the two!
I decided to make myself some Arduino powered Xmas lights that vary their ‘chase’ speed based upon how close people are to my house.
Intrigued? Read on…
I started with 6 boxes of Ikea Strala LED lights. There’s about 1.5 meters consisting of 10 lights and a decent amount of extra wire with a 2 x AA switchable battery box on the end. Normally these are pretty cheap, but at the time I went in a couple of weeks ago, they just happened to be on sale for £1.75 each. Bargain!
The lights are designed to run permanently on with 2 AA batteries (3 volts), but I was planning on running them from the Arduino which gives out 5 volts. I don’t have all the technical specs on the LEDs, and there’s no sign of inbuilt resistors, but I figured that they should be ok with 5 volts being on 1/6th of the time. (If not, watch out for a blog soon about exploding LEDs!)
The first thing I did was to cut off all the battery boxes. Whilst the price of the lights was pretty cheap, as each one came with a pounds worth of battery box that’ll be handy for other projects it was even better! Each of the strings was labelled 1 – 6 so I could work out which order to fire them in.
I started with the end bulb from string 1, and put the end bulb from string 2 about 1/6th of the way down, held in place with the wire wrap they were bundled up in to start with.
I then added the end bulb from string 3 the same length down…
… and carried on until I had all 6 strings fairly evenly spaced
Then I carried on all the way down with a securing cable tie every 2 or 3 bulbs. Due to the springy nature of the twisted wire, it wasn’t always obvious which bulb should be coming next, so I improvised with a chair feeding me each of the strings in the right order. Clever, eh?
After replacing the wire wraps at the start with cable ties I was left with a pretty good LED loom with lights at regular intervals, and every 6th light being individually addressable.
Sadly, Ikea didn’t have the foresight to mark the +ve and -ve cables, so I had to attach each one to a known power source to determine which was which…
… so I could then identify the negative cable.
These were then wired in to the PWM pins of an Arduino. As this is just a temporary installation, I used a wing of a screw shield. If it was to be more permanent, I’d wire them to a cheap shield like this one. (The PWM pins are 3, 5, 6, 9, 10, 11, and they allow for a more gradual dimming of the LED rather than simple on/off control)
A quick test sketch showed that they were all working nicely
Then time to add the magic ingredient; an ultrasonic range finder. This one is a cheap eBay SRF05 from eBay and it will measure distances from 2cm to 4.5 meters. My driveway is about 6 meters long, so passing pedestrians aren’t likely to trigger it, but visitors should see it speed up as they walk up the drive. I rigged this up on a temporary breadboard to start with and had terrible trouble getting it to work. Turns out the 5v jumper was faulty! Grrrr! Lesson learned.
I used a sacrificial mouse for the lead between the Arduino and the sensor, checked everything worked and was ready to go.
I mounted the ultrasonic sensor under the window sill with gaffa tape. It’s right next to the front door pointing slightly towards the direction people are likely to walk up. Due to the rain, and my car being parked within a couple of meters or so the verdict on the speed changing is still undecided.
As far as Xmas lights at my house goes though, it’s the best it’s ever been!