Skip to content

Controlling external lighting with Arduino

The path to my front door is long and very poor­ly lit. There’s a sen­sor light mount­ed above it, but that’s nev­er worked and, liv­ing in a rental, get­ting it fixed has been a bit of a task. So I bought a roll of 3-wire LED rope light on eBay. Cable-tied it to the under­side of the bot­tom stretcher of the fence run­ning alongside the path. The pow­er cable was fed in through a win­dow by the front door, and I had nice, bright, even illu­mi­na­tion. But it was still kind of bor­ing. So I bought an eth­er­net-capa­ble arduino.

My rope light has three wires — two strings of LEDs and a com­mon ground. It also has a lit­tle con­trol box with a rec­ti­fier and an MCU with a hand­ful of pre-pro­grammed mod­es. I cut the cable between the con­troller and the rope, and was incred­i­bly sur­prised to dis­cov­er that the LEDs were being fed with 240V DC. At a very low cur­rent, but still dan­ger­ous enough to make me throw away ini­tial plans and approach it again with a lot more care. Also beefier relays.

The rest, though, was very straight­for­ward. The Arduino Play­ground has plen­ty of infor­ma­tion about inter­fac­ing with relays. I’ve got 12V relays, so I’m using a 12V wall wart to pow­er my Arduino board, and then run Vin from the Arduino out to pow­er the relays via a sim­ple dri­ver cir­cuit. I’m not too pleased about run­ning sep­a­rate pow­er sup­plies for the rope lights and the low­er-pow­ered con­trol elec­tron­ics, but I’m def­i­nite­ly not capa­ble of doing any­thing about com­bin­ing them yet, so that’s the way it will stay for now.

My first revi­sion of this project used four of the­se dri­vers (I thought I’d find a use for the oth­ers… even­tu­al­ly) on a piece of pro­to­type board, with head­er pins attached so I could attach it to the Arduino as a shield. It was my first non-triv­ial Arduino project, and first time I’d done any seri­ous sol­der­ing for a while, so it looked rough as guts. But it worked, and gave me much more inter­est­ing ways to con­trol my light­ing. The first test of the full sys­tem, with a two-chan­nel vari­ant of the Blink demo sketch, looked like this (direct youtube link).

Com­plet­ed shield

I ran this board for a while, but want­ed to con­trol the out­side lights from the same sys­tem as the pow­er con­troller I built recent­ly, so build new dri­vers for my relays on the side of that shield. The end result was a very, very full short shield, but the entire thing looks much nicer, and very deserv­ing of the translu­cent case I mount­ed it in. I still want to do a lit­tle more work with the hard­ware. First to add a hard­ware (illu­mi­nat­ed) but­ton for sep­a­rate con­trol of the out­side lights, and then may­be look in to using an exter­nal volt­age reg­u­la­tor to sup­ply the 12V and 5V I’m using for the con­trol board instead of feed­ing 12V in to the Arduino. But I’m very hap­py with the project so far.

I haven’t yet upload­ed the soft­ware I wrote to run all of this. It needs tidy­ing, and there’s a weird bug in the timers still, and soon­er or lat­er I’m going to have to change the hard­cod­ed pass­word in my branch. How­ev­er, I love show­ing off the web­page, so check this out:

Remote con­trol web­site run­ning on my phone

 

One Trackback/Pingback

  1. […] more here, find the code at […]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*