Skip to content

Weekend hacks: low-powered LEDs

I’m a suck­er for blink­ing lights. Everything I’m build­ing or is sit­ting in my note­book in vari­ous stages of think­ing about involves some sort of LED, EL pan­el or oth­er bright thing. So when I went to Bun­nings yes­ter­day (buy­ing lights for a dif­fer­ent pro­ject. ahem) and dis­covered small cheap bat­tery-powered light strings, I couldn’t res­ist pick­ing some up. No spe­cif­ic pro­ject in mind, but how hard can these things be to drive with an Ardu­ino right?

LED Light StringYou get a 6m string of wire with 60 tiny LEDs on it. It runs on 3AA bat­ter­ies, and the con­trol­ler relies on a basic timer to run for 6 hours in the even­ing and stay off the rest of the time. I guess it’s up to the user to go and recal­ib­rate the timer every month or two so it still makes sense. It cost me $15 from Bun­nings, but I couldn’t find it on their web­site just now, so YMMV.

Initial exploration

Testing LED string current

Test­ing LED string cur­rent

The first thing I did was to put bat­ter­ies in to the con­trol­ler and play around, to get a feel for how the sys­tem was inten­ded to work. And it’s pretty simple. There’s a push but­ton on the con­trol­ler to switch between full on, timer mode and off.

Then I opened it up, and the con­trol­ler was about as simple as I expec­ted. There’s a small unmarked IC; undoubtedly a ven­er­able 555 timer, a few capa­cit­ors to run the 555 in astable mode, and a tran­sist­or to switch the lights.

I’d like to replace that with some sort of Ardu­ino-based con­trol­ler, so I broke out my mul­ti­meter to check what the LEDs were run­ning from. I found that the voltage drop across the string was an even 3V, down a little from the 3.6V input from my rechargeable bat­ter­ies, and draw­ing a hair over 92mA.

I didn’t think it would be a great idea try­ing to run them from a 5V sup­ply, and the cur­rent draw was a lot more than Ardu­i­nos can typ­ic­ally sup­ply from their on-board 3V reg­u­lat­or, so I’d have to provide my own lower voltage. But apart from that, mak­ing these things slightly smarter shouldn’t present any real chal­lenge.

Building a replacement circuit

Drawing up a schematic for a replacement driver

Draw­ing up a schem­at­ic for a replace­ment driver

So a replace­ment driver for these lights would need two parts; a lower voltage power sup­ply, and some­thing to switch them on and off based on input from the Ardu­ino. I pulled out my note­book and star­ted to draw up a solu­tion.

For the power, I used an LM1117 3.3V lin­ear reg­u­lat­or. Thanks, past me, for buy­ing a dozen the last time you needed one. All I did with that was copy the example usage schem­at­ic out of the data sheet.

And then I added an NPN tran­sist­or as a low-side switch (I really like Sparkfun’s tran­sist­or tutori­al to help under­stand how to use tran­sist­ors as switches like this).

That’s really all that’s required. I could run an Ardu­ino from a 5V USB con­nec­tion, feed power from the Arduino’s Vin pin to this cir­cuit, and use a digit­al out­put from the Ardu­ino to switch the lights on and off. Time to see if it works.

Testing and assembly

Assembled circuit on breadboard

Assembled cir­cuit on bread­board

While assem­bling I real­ised my schem­at­ic had a couple of prob­lems. First, see­ing as I was receiv­ing a reg­u­lated 5V sup­ply, using two smooth­ing capa­cit­ors for the lin­ear reg­u­lat­or would be overkill, so I just omit­ted one. Second, I wasn’t sure if the LED string would need cur­rent-lim­it­ing res­ist­ors, so I assumed that it would and added a 100Ω res­ist­or.

I put cir­cuit togeth­er on a bread­board and wired my LED string to the board. Then I took a Freet­ron­ics Leostick I had spare, con­nec­ted the 5V and GND pins to my cir­cuit, and the sig­nal to a PWM pin. Loaded up the Blink example sketch and… noth­ing happened.

So out came the mul­ti­meter again. First check­ing that all of the con­nec­tions were sol­id, and then I star­ted meas­ur­ing voltages in dif­fer­ent places. I had the right voltage com­ing out of the reg­u­lat­or. The Ardu­ino was switch­ing the right out­put pin on and off. And I was even get­ting the voltage read­ings I was expect­ing across the LED string. But no blinky-blinky. After glar­ing at it for a minute or two inspir­a­tion struck, and I swapped the leads to the LED string around. Blinky-blinky.

Finally, I soldered my com­pon­ents in to a small strip of pro­to­typ­ing board. I inten­ded it to be a sort of shield for the Leostick, so I added head­er pins for power and sig­nal, and the whole con­trap­tion just plugs in on top. I added a couple more head­er pins for the LED string, and crimped DuPont con­nect­ors on to its leads. Hard­ware com­plete!

Assembled driver circuit

Assembled driver cir­cuit

Programming the Arduino

I wanted to be able to con­trol the lights by send­ing com­mands over a seri­al con­nec­tion. At the very least, I should be able to set them to a stat­ic level. More advanced com­mands might include blink­ing, or slowly fad­ing between two dif­fer­ent levels. My FairyLights.ino sketch imple­ments a very simple text pro­tocol to con­trol the lights, cur­rently just set­ting a stat­ic level (and the all-import­ant help com­mand). I’ve writ­ten enough text pars­ers in Ardu­ino that I really couldn’t be bothered doing it again, so I picked up the Cmd­Pars­er lib­rary to handle all the hard work, mak­ing my sketch very straight­for­ward based on the Cmd­Pars­er call­back demo code.

Lighting it up

I strung the lights up around the desks in my home office, and plugged my new Ardu­ino-based con­trol­ler in to my desktop PC. Con­trolling this setup over a seri­al con­nec­tion is a trivi­al task in any lan­guage, but see­ing as this machine is mostly run­ning Win­dows these days I thought it’d make sense to talk to it using Power­Shell. My res­ult­ing script takes a num­ber as a para­met­er, opens a seri­al con­nec­tion and uses the set com­mand to set the LED light level. Unfor­tu­nately Win­dows makes it slightly dif­fi­cult to run a Power­Shell script without pop­ping up a con­sole, with the com­mon solu­tion being to launch the script from a VBScript. So the Win­dows dir­ect­ory for this pro­ject includes the con­trol script, as well as a couple of vbs wrap­pers to turn the lights on and off.

The final step for me was to bind the on and off com­mands to spare macro keys on my Razer Chroma key­board. And now I have kit­c­shy bling at my fin­ger­tips.

Finished project

Fin­ished pro­ject

This was a pretty point­less but mostly fun little hack. As usu­al, all of my code for this is in my ardu­ino repos­it­ory. The whole pro­cess took me some­where around 6 – 7 hours over a couple of days. That included the time I wasted with the LED leads the wrong way around, as well as fig­ur­ing out a weird hard­ware-related prob­lem with Cmd­Pars­er (see my pull request for details). Hope­fully this post gives a little insight in to how I think about and put togeth­er my pro­jects, and provides some inspir­a­tion for oth­er people’s.

The Kerbal controller

This after­noon I gave a talk at the Open Hard­ware miniconf at about the Kerbal Space Pro­gram hard­ware con­trol­ler build I’ve been work­ing on for the last little while. I’m pretty proud of this build, the talk was fun, and the crowd seemed to like it, so I’m pretty stoked this even­ing. :)

For those inter­ested, here’s all of the inform­a­tion I have online about it all.

  • slides from today’s talk
  • git repos­it­ory for this build. Source, quite a few cir­cuit schem­at­ics, design and build notes, all sorts of oth­er things. Yes, it does still include the broken rib­bon con­nect­or on the PCB lay­outs, with a large note in the README. :)
  • the KSP for­um thread where I’ve been doc­u­ment­ing build pro­gress since Novem­ber. Lots of posts about oth­er stuff I didn’t have time to talk about today, a large photo album, and a couple of videos of vari­ous stages of the build.

Overengineering a clock

Like pretty much every­one who ever pulled apart their Nin­tendo Game and Watch so they could beef it up with a speak­er and AA bat­tery hold­er scav­enged from a tran­sist­or radio (that thing was awe­some), I was out­raged when Ahmed was arres­ted. Luck­ily, now I’m an adult with some dis­pos­able income and a pen­chant for col­lect­ing cool gad­gets, so I was able to go home and start build­ing a movie-bomb-like clock pretty much imme­di­ately.

I star­ted with a spare Ardu­ino-com­pat­ible board (the lovely little Freet­ron­ics Elev­en) and a dis­play mod­ule I’d just picked up as an exper­i­ment­al addi­tion for my KSP con­trol pan­el. Had to order in a real-time clock mod­ule, but that gave me a couple of days to get the first few com­pon­ents hooked togeth­er on a piece of pro­to­board and the basics up and run­ning. This was the first time I’d tried using thin strips of board with head­er pins soldered on as ghetto ardu­ino con­nec­tions, and I like how they work for ad-hoc break­outs. The dis­play is an SPI device with a sep­ar­ate RGB back­light, hence all of the ini­tial orange con­nec­tions. When the RTC arrived I was able to quickly bung it on the board and add a little bit of extra code to read time from it over an I2C con­nec­tion. In hind­sight I also should have hooked up the timer pin on the mod­ule, which gen­er­ates a pulse every second. But didn’t and am too lazy to go back and redo it now. At any rate, after that I had a clock that was able to show me the time.

Basic time-telling device. Not a bomb.

Then I needed some way to house it, without hid­ing all of the gory detail. So I snarfed some 3mm clear per­spex from the box of offcuts at the Robots and Dino­saurs maker space, whipped up a quick set of mount­ing holes in Lib­reCAD (again, I’m get­ting good at design­ing and cut­ting these sorts of pan­els thanks to my work on my KSP con­trol board) and used the robod­ino laser cut­ter to make a face­plate. Bolted all of the pan­els in place, then used a couple of small bits of wood clamped on to the bot­tom of the pan­el with screws to form a base to hold it upright.

Argu­ably a clock now. It sits on a shelf, and time can be determ­ined from some dis­tance. Hasn’t exploded yet.

I guess hav­ing a clock that shows the date and time is a reas­on­able place to stop. A reas­on­able, and very very bor­ing place to stop. So I kept going.

Start­ing simple — that back­light can be pretty bright and annoy­ing. So I bought a light-depend­ant res­ist­or, whacked it on in a corner, and added some code to sample the ambi­ent light level and dynam­ic­ally adjust the LCD back­light. Full bright­ness dur­ing the day, down to almost as low as it can go when the lights are off. Much bet­ter.

For power I used a spare 5V wall wart, again left over from a couple of iter­a­tions of power­ing my KSP con­trol­ler. Poor fore­thought put the Arduino’s bar­rel jack too close to the base for use, but I had a spare one kick­ing around that I was able to screw on to the side of the pro­to­board, and run power leads back to the Ardu­ino.

I’ve had some ESP8266 mod­ules kick­ing around in my parts bin wait­ing for a rainy day for a while now. If you haven’t heard of these things yet, they’re amaz­ing. WiFi, very cap­able micro­con­trol­ler, can eas­ily inter­face with an Ardu­ino or just as eas­ily be repro­grammed with the Ardu­ino IDE, and cost well under $AU10 each. They require 3.3V, and more cur­rent than the Arduino’s onboard reg­u­lat­or can sup­ply. Luck­ily my dis­play also uses 3.3V logic, so I already had a 74HC4050 logic con­vert­er with some spare pins on my board. Just had to add a 3.3V lin­ear reg­u­lat­or and asso­ci­ated capa­cit­ors, and my clock was now online. While I was doing that, I added a few head­er pins to the board, so I could eas­ily attach an FTDI cable to repro­gram the ESP8266, and it made the whole thing look more com­plic­ated.

The pro­to­type board, clock­wise from top middle: 4050 logic con­vert­er, LCD rib­bon con­nect­or, RTC mod­ule, FTDI head­er, LDR, 3.3V reg­u­lat­or, ESP8266. Not shown: explos­ives.

I run an MQTT ser­vice on my home serv­er. It’s a great mul­tipur­pose, mul­tidevice mes­sage bus. My Open­HAB install integ­rates with it. My kodi media play­er pub­lishes now play­ing info on it. My phone pub­lishes (some) loc­a­tion data to it. I have a hand­ful of oth­er Ardu­ino devices that send and receive inform­a­tion across it using the fant­ast­ic pub­sub­cli­ent lib­rary. So I wrote a simple cli­ent for the ESP8266 that joins my home net­work, and sub­scribes to a list of inter­est­ing top­ics on the MQTT bus. Whenev­er it receives any­thing it’s sub­scribed to, it passes it to main clock con­trol­ler using a reg­u­lar seri­al con­nec­tion. Sud­denly I had a thing on the inter­net, with nary a buzzword in sight.

One of the afore­men­tioned Oth­er Ardu­ino Devices on my net­work is a little one-day pro­ject I knocked togeth­er last year. A remote tem­per­at­ure sensor con­sist­ing of an ATTiny84 con­trol­ler, DHT22 temp and humid­ity sensor, and nRF24L01 low-power radio trans­ceiv­er, powered by a couple of AAA bat­ter­ies. That sits out­side and broad­casts cur­rent temp and humid­ity data on MQTT, which mostly just gets used to gen­er­ate nice graphs. Read­ing that to show cur­rent tem­per­at­ure on my clock was trivi­al. Then I added a small script on my serv­er that polls loc­al fore­cast inform­a­tion from the BoM and broad­casts that a few times a day. On the clock side, I star­ted using icons from the free Met­eo­cons weath­er icon col­lec­tion, down­scaled and hand-tweaked. They take up a fair bit of space, but stor­ing them in PROGMEM on the Ardu­ino means I’ve got room for quite a few. This gave my clock cur­rent (ultra)local con­di­tions, and the daily fore­cast. After run­ning this for a while I’m in the habit of check­ing it in the morn­ings instead of, you know, look­ing out­side.

Today’s fore­cast: no kaboom.

The space in the bot­tom left star­ted out just show­ing the text fore­cast pre­cis (which, incid­ent­ally, is won­der­fully poet­ic; I’m hav­ing a hard time using it to accur­ately choose an icon). But there’s so much cool stuff I want to know!

I use pub­lic trans­port all the time — my daily com­mute to work is by train, and I use the bus stop around the corner to get up to New­town a fair bit too. I also use Uber for occa­sion­al rides. The next logic­al step for me was radi­at­ing next depar­ture times for all of the pub­lic trans­port ser­vices I use. The easi­est is Uber, which has a super-simple API to poll approx­im­ate pickup time for a giv­en loc­a­tion. I wrote a quick shell script that runs on my serv­er, polls the Uber API every minute, and broad­casts pickup times on MQTT. Now my clock knows how long I’ll wait for a ride.

I’ve run out of bomb-related cap­tions.

That pretty much brings me to the cur­rent status. Every now and then I tweak the code on the con­trol­ler, adding new icons and try­ing to improve the way it decides which icon to show. I’m still pok­ing at the code required to trans­late the Trans­port Data Exchange info offered by Trans­port for NSW, but to be hon­est it was pretty dis­heart­en­ing to learn that they don’t offer real-time updates to plebs like me who’ll nev­er have more than one user for their pro­ject. Still think­ing about oth­er stuff to toss up in that space, but my recent exper­i­ments with CI for Ardu­ino pro­jects may lead to pub­lish­ing build res­ults in the not too dis­tant future.

This was a really fun pro­ject. Build­ing a clock was some­thing I’d wanted to try for ages but nev­er quite got around to. I’ve wound up with a genu­inely use­ful and hope­fully inter­est­ing-look­ing object.

Like most of my oth­er Ardu­ino pro­jects, the code for this is online: . My loc­al repos­it­ory is a couple of revi­sions ahead of that but there’s not much inter­est­ing except for me com­pletely rearran­ging my loc­al net­work after acci­dent­ally pub­lish­ing the WPA key. :/

Rostok 3D Printer Build

I’ve put off start­ing a 3D print­er for a long time, mostly because I couldn’t think of any­thing par­tic­u­larly use­ful to do with it. But over the past year or so I’ve run off a few parts, and the list of things I’d like to have has got­ten longer. So for my birth­day a couple weeks ago, in a fit of delin­quent irre­spons­ib­il­ity I pulled the trig­ger on a Ros­tok Mini delta print­er kit from 3d Print­er Czar. Took just over a week from order to the deliv­ery arriv­ing, and it’s been tak­ing up most of my free time since Tues­day after­noon.

Part 1: mechanical build

I man­aged to com­plete the basic mech­an­ic­al build in 3 – 4 hours in one even­ing. The dir­ec­tions online are a little rough in parts, but mostly pretty thor­ough. The kit includes most tools needed, which was nice. But a hex key for the M8 bolts on the top belt bear­ings was miss­ing, and my hands were very glad to have decent-sized pli­ers.

Assembled Rostok Mini frame

First minor issue I had was with bolt­ing things to the prin­ted parts. It’s import­ant not to over-tight­en these — I man­aged to crack one part slightly along the print grain tight­en­ing it a little too much. I’m not too con­cerned about it because it has oth­er bolts nearby to take up the strain, but I was much more cau­tious after that one.

Second was with the two prin­ted parts attached to the hotend. One seemed to warp slightly insert­ing the hotend, leav­ing the end tilted slightly to one side. Not really a showstop­per, and worst case I’d be able to print a replace­ment part, pos­sibly with a slightly wider insert for the hotend..

I only had one major prob­lem after the build was fin­ished. The build instruc­tions don’t place any­where near enough emphas­is on how import­ant it is to make sure the car­bon fibre delta arms are the same length. Fol­low­ing the dir­ec­tions to the let­ter I eye­balled the rods to make sure they were about the same length, cut strips from a leftover screw bag­gie, wrapped them around the lead screws on my u-joints, and jammed them in to the ends of my rods. That left me with a cent­ral effect­or plat­form that was vis­ibly a few degrees off level. And shortly after­wards I dis­covered that the rods were also pretty fra­gile — the u-joints liable to pull out of the rods with too much force.

I sup­pose this could be improved by pack­ing the lead screws with thick­er plastic, and then I’d be able to match the lengths of the rods more care­fully by screw­ing the u-joints in and out. But decided to scrap that idea, and go with a more per­man­ent solu­tion. I’d build a jig to hold the rods in place and glue them.

Part 2: fixing the arms

Yes­ter­day I unscrewed the arms and meas­ured the rods more care­fully. Found a good 1.5mm dif­fer­ence between the shortest and longest arms, which in hind­sight is pretty ridicu­lous. With the effect­or plate in my hand though I was able to real­ise that the bolts hold­ing it togeth­er were still barely fin­ger-tight. Tight­en­ing them up held the whole struc­ture togeth­er prop­erly and straightened up the hotend nicely.

Build­ing a jig to hold my arms while they were glued was simple enough. I took the length of the longest arm, added 34mm for the two Traxxas 5349 u-joints (they’re 22mm long and 10mm wide, so it seemed logic­al that the centre of the hole would be 17mm from the end), and an extra mm for luck. From there one could prob­ably bang a couple of nails in to a block of wood and use that to make a series of arms the same length, but I star­ted to over­en­gin­eer a little. Start­ing with Lib­reCAD I quickly drew up a block with six pairs of screw holes the right dis­tance (uh, 187mm for my arms).

B8gNylwCAAAXUCqThis even­ing I wandered down to Robots and Dino­saurs, a pretty great maker space in Sydney, and used the laser cut­ter to cut a chunk of 8mm acryl­ic to shape. Then added longish bolts and fixed them in place to make my jig. Filed the insides of the car­bon fibre rods a little, then used extra strong, slow set­ting Araldite epoxy to glue the u-joints to the rods. Placed the joints on to the rods, fixed them down with anoth­er set of nuts, and then looped rub­ber bands over the ends to make sure everything stayed togeth­er.

I gave the glue a few hours to set, then took the arms off and tested them all on the same pair of bolts to make sure I hadn’t done any­thing too stu­pid. Not sure why, because I don’t know what I’d do if the arms were dif­fer­ent lengths at this point. But they all slid over the bolts with the same amount of play, so I’m pretty con­fid­ent I’ve got them accur­ate enough, and right now I’m pretty pleased with how well it worked.

So, next is to leave the arms overnight to fully cure. Tomor­row I’ll reas­semble everything then get back to work on the wir­ing and elec­tron­ics.

Building an arduino-based video game controller

I play a lot of Kerbal Space Pro­gram because sand­box games in space is pretty much the greatest idea ever. So in an attempt to enhance the game and build some­thing pretty cool, I’ve spent the last sev­er­al months work­ing towards build­ing a con­sole to con­trol the game and dis­play tele­metry.

My final design is going to be fairly large, but to start with, I wanted to knock up a few of the sim­pler pan­els. That gave me a chance to work out how to make the pan­el hard­ware, and get the basics sor­ted out for inter­fa­cing with the game through the KSPSeri­alIO plu­gin. It’s taken quite a few months on and off to get this far, but this week I finally got the first few pan­els fin­ished and work­ing.

ksp control interface (Con­tin­ued)

Making laser-cut backlit control panels

Most of my cur­rent ardu­ino pro­jects have had pretty ad-hoc enclos­ures. You can go a long way with a Jiffy box and a Dremel. Then I bought an emboss­ing label maker to add some text to my boxes (and, OK, everything else — when you have an emboss­ing label maker everything starts to look like an unlabeled thing). My most recent work though has been a pure human inter­face device. There’s a lot of but­tons and switches and dis­plays, and one of my goals for it was to cre­ate an enclos­ure that looked abso­lutely stun­ning.

I’ve even­tu­ally settled on build­ing back­lit pan­els from laser-etched acryl­ic, based on a tech­nique I picked up from the MyCock­pit for­um for simpit build­ers. Flight sim geek com­munit­ies are a great resource for learn­ing how to build nice con­trol pan­els, who knew? I’ve been refin­ing my pro­cess to get decent res­ults with a single pass through the laser cut­ter in my loc­al maker space.


  • Acryl­ic sheet. I use 3mm opal trans­lu­cent sheet. A square metre cost me $80, and now I have more acryl­ic than I’ll ever need. At cur­rent estim­ates, includ­ing all the failed pan­els I’ve cut, a half metre is still very gen­er­ous.
  • Spray paint. I’m using a matt grey primer that claimed to be suit­able for plastics. It’s been work­ing well so far.

It’ll also need very fine grit sand­pa­per and mask­ing tape.

Prepare the acrylic

Freshly painted panels, ready to cut.

Freshly painted pan­els, ready to cut.

I cut my sheets in to 250mm square sec­tions. For each sec­tion, remove the back­ing paper from one side and spend a minute or so sand­ing the face very fine wet and dry paper to give the paint a sur­face to adhere to. Then apply three coats of paint. At the end you’ll have fin­ished pan­els ready to cut. And, if you’re like me, some freshly painted fur­niture to boot.

Design your panel

This part was pretty incred­ibly frus­trat­ing for me. I star­ted out work­ing with Lib­reCAD, a reas­on­ably full-fea­tured 2D CAD draw­ing pro­gram. That made draw­ing pre­cise out­lines and holes for cut­ting a breeze, but it’s not par­tic­u­larly good at work­ing with text. I wanted real truetype fonts on my pan­els, and get­ting Lib­reCAD to import font faces in a form it can work with ended up bey­ond me.

My cur­rent work­flow is to draw text that I want added in Ink­s­cape. Then con­vert the text to paths, and export it as a DXF file. That file can then be impor­ted to Lib­reCAD as a block and placed in my etch­ing lay­er. The soft­ware driv­ing my laser cut­ter doesn’t like the DXF gen­er­ated by Lib­reCAD though, so there’s anoth­er step import­ing the final file in to Ink­s­cape to col­lapse lay­ers, remove dimen­sions and save a file that can be down­loaded to the laser.

That… mostly works. Some­times the text paths Lib­reCAD saves just don’t gen­er­ate eas­ily filled objects and the laser gets con­fused and it all goes pear­shaped. Right now I’m still load­ing the text blocks in to Lib­reCAD but only using them as a visu­al guide. When doing final prep for cut­ting I still replace the text on the pan­el in Ink­s­cape, to ensure a happy etch­ing exper­i­ence.

Cut the panel

Tuning etching settings for good clear lettering

Tun­ing etch­ing set­tings for good clear let­ter­ing

I did a dummy cut with holes and a com­bin­a­tion of angu­lar and round let­ter­ing in all of the sizes I needed. I was using a couple of dif­fer­ent sized fonts, and it took me a little while tweak­ing set­tings to get a res­ult that looked sharp across the board.

When cut­ting pan­els, I order the job so that all of the engrav­ing is first, and the cut for the out­line is last. Even though the cut­ting bed is sta­tion­ary, warps in the per­spex can lead to the pan­el shift­ing slightly after the out­line is cut.

I learned the hard way that get­ting excited and remov­ing the paper from the back of the per­spex at this point is not a great idea.

Final painting

The pan­el is fin­ished, but now has raw edges that look ugly and leak light when it’s back­lit. Apply mask­ing tape to the front side, along the edges (leav­ing it over­hang but not stuck to the side of the pan­el), and cov­er­ing holes. Then place it face down and apply anoth­er couple of coats of paint along the edges.

I’m still work­ing on get­ting this part right. Pre­vi­ous attempts without the mask­ing tape led to paint bleed­ing under the edge, lead­ing to vis­ible paint drops or the news­pa­per I had under the pan­el stick­ing to the face. Ini­tial tests with the tape look pretty good though.

Once the paint has dried, the back­ing paper for the pan­el can be removed and com­pon­ents moun­ted.

My most recent finished panel.

My most recent fin­ished pan­el.

Next steps

I’m still work­ing on the best way to back­light these pan­els. Simply light­ing up the inside of the enclos­ure looks good, but seems a bit bland to my mind. I want to start exper­i­ment­ing with with indi­vidu­ally lit pan­els, pos­sibly by coun­ter­sink­ing LEDs in to the back of the pan­el. Mostly because I’m keen on flick­er­ing pan­els, and chan­ging pan­el back­light col­our. But pretty pleased with the over­all look so far.


Prototyping nRF24L01+ modules on Arduino

I star­ted look­ing at the nRF24L01 chips while plan­ning a con­trol­ler for the sprink­ler in my back yard. They seemed like a pretty good option for low-cost, low-power wire­less Ardu­ino com­mu­nic­a­tion. They’re not per­fect, but when you can buy a 10-pack of mod­ules for twelve bucks on eBay it’s easy to settle for not per­fect. And I got excited at the thought of build­ing a mesh-style net­work of sensors and actu­at­ors using RF24Network. Per­haps a little too excited — my plans have become far more ambi­tious and involve ret­ro­fit­ting nrf mod­ules on to all of the exist­ing Ardu­ino doodads already in my home, and some more new sensor mod­ules out in the garden.

But first things first — order a couple, wire them up, and see if I can make them work.


UPnP/DLNA clients in Ubuntu 13.04

Banshee and UPnP remoteStream­ing con­tent from a UPnP serv­er (in my case, the XBMC media centre in my lounge room) to an Ubuntu machine is fairly simple. But there didn’t seem to be any doc­u­ment­a­tion that I could find, and I ended up spend­ing a sur­pris­ing amount of time futz­ing around mak­ing it work. This is how I did it in Ubuntu 13.04. I use GNOME for my desktop, but con­firmed that it also works just fine with the default Unity desktop. Oth­er envir­on­ments may need to tweak how the ser­vice starts, as well as cli­ents.

Install software

We’re using the Rygel UPnP pack­age, spe­cific­ally its MPRIS inter­face to enable UPnP ren­der­ing to desktop media play­ers. In addi­tion, we install GUPnP to provide a UPnP Con­trol Point, and finally ban­shee. I had a crack at using Totem as a ren­der­er, as of April 2013 the ver­sion in Ubuntu registered as a Medi­aR­en­der­er but quietly refused to play any con­tent I asked it to. The upnp-inspect­or pack­age is nice for check­ing everything works.
sudo aptitude install rygel rygel-preferences gupnp-tools banshee upnp-inspector

Configure rygel

Open Rygel’s con­fig­ur­a­tion file:
nano ~/.config/rygel.conf
And enable the MPRIS inter­face by adding the fol­low­ing at end of the file:

Rygel is designed as a UPnP media serv­er, and by default will start offer­ing up loc­al video, music and pic­ture shares as media serv­ers. If you don’t want this, it can be dis­abled by run­ning the Rygel Pref­er­ences GUI tool, or by adding this to the [gen­er­al] sec­tion of your rygel.conf:

Autostart Rygel at login

cp /usr/share/applications/rygel.desktop ~/.config/autostart
Log out and back in to start the Rygel ser­vice.

Configure Banshee

Finally, the MPRIS inter­face needs to be enabled in Ban­shee. Start it up, nav­ig­ate to Edit -> Pref­er­ences. Click the Exten­sions tab, scroll down to the util­it­ies sec­tion, and ensure the MPRIS D-Bus Inter­face is enabled.

Playing things

UPnP Inspector window

Inspect­or win­dow show­ing my XBMC serv­er, the loc­al Rygel share, ban­shee, and BubbleUPnP on my android phone.

Start UPnP Inspect­or. It should list any avail­able Medi­aServ­ers on your net­work and, if you didn’t dis­able them, loc­al shares from Rygel. Start ban­shee, and it should also appear as a Medi­aR­en­der­er in the inspect­or win­dow.

Any UPnP con­trol point on the net­work will be able to send con­tent to ban­shee (I’m fond of BubbleUPnP on Android). Or start the UPnP AV Remote con­trol pro­gram. I’ve only been play­ing with it for an hour or two, but get best res­ults from extern­al con­trol point soft­ware. The GUPnP remote occa­sion­ally stalls try­ing to play things.


Hacking the Ikea DIODER in ten minutes flat

Last week I bought a set of DIODER lights from the Ikea down the road, pretty much on a whim. They’re not the cheapest way to buy RGB strip light­ing, but I did like the mod­u­lar design. And it’s remark­ably easy to modi­fy the con­trol­ler to drive the sys­tem with an ardu­ino.

The sys­tem comes with a con­trol­ler that allows you to set a col­our manu­ally, as well as pre-set col­our change and fade func­tions. Rather than build my own cir­cuit I wanted to save time by reusing this con­trol­ler. Open­ing it up revealed a PIC micro­con­trol­ler, and three MOS­FETs for the red, green and blue chan­nels.

First thing to do is dis­able the micro­con­trol­ler by cut­ting through the power track. Cut­ting through the big pad I’ve marked on the dia­gram means it’s easy to then wire a switch across it if you want to be able to use the con­trol­ler as nor­mal.

Three out­put pins from the micro­con­trol­ler drive the MOS­FETs, but only two of them have big friendly solder pads, so I soldered wires on to the three res­ist­ors just below the MOS­FETs (R5, R6 AND R7). Then soldered the oth­er ends of these wires to a short strip of head­er pins. These are then plugged straight in to pins 9, 10 and 11 on my Ardu­ino. I’ve labelled the pic­ture with which MOSFET drives which LED chan­nel, but they match what’s prin­ted on the PCB where the input cable is con­nec­ted.

Finally, we need a ground wire. Easi­est way to con­nect it is to solder a wire on to the -ve wire on the input cable. The oth­er end of that is again soldered on to a head­er pin, which is con­nec­ted to the ground pin of the Ardu­ino.

And that’s it. I hooked these up to my LeoStick the Freet­ron­ics guys gave away as swag for LCA 2012 and loaded up some demo code I had sit­ting around from the last time I played with an RGB LED.

Right now I’m using this setup as a light con­trol­ler for bob­light on my XBMC media centre. Set­ting up the con­trol­ler, writ­ing my own single-chan­nel bob­light sketch, installing soft­ware and con­fig­ur­ing the XBMC addon was all done in a single even­ing. It was a lot of fun, and even with a single chan­nel the res­ults are pretty awe­some.

Controlling external lighting with Arduino

The path to my front door is long and very poorly lit. There’s a sensor light moun­ted above it, but that’s nev­er worked and, liv­ing in a rent­al, 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 stretch­er of the fence run­ning along­side the path. The power cable was fed in through a win­dow by the front door, and I had nice, bright, even illu­min­a­tion. But it was still kind of bor­ing. So I bought an eth­er­net-cap­able ardu­ino. (Con­tin­ued)