Skip to content

Weekend hacks: low-powered LEDs

I’m a suck­er for blink­ing lights. Every­thing I’m build­ing or is sit­ting in my note­book in var­i­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 project. ahem) and dis­cov­ered small cheap bat­tery-pow­ered light strings, I couldn’t resist pick­ing some up. No speci­fic project in mind, but how hard can the­se things be to dri­ve with an Arduino 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­troller relies on a basic timer to run for 6 hours in the evening and stay off the rest of the time. I guess it’s up to the user to go and recal­i­brate the timer every mon­th 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­troller and play around, to get a feel for how the sys­tem was intend­ed to work. And it’s pret­ty sim­ple. There’s a push but­ton on the con­troller to switch between full on, timer mode and off.

Then I opened it up, and the con­troller was about as sim­ple as I expect­ed. There’s a small unmarked IC; undoubt­ed­ly a ven­er­a­ble 555 timer, a few capac­i­tors to run the 555 in astable mode, and a tran­sis­tor to switch the lights.

I’d like to replace that with some sort of Arduino-based con­troller, so I broke out my mul­ti­me­ter to check what the LEDs were run­ning from. I found that the volt­age drop across the string was an even 3V, down a lit­tle from the 3.6V input from my recharge­able 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 Arduinos can typ­i­cal­ly sup­ply from their on-board 3V reg­u­la­tor, so I’d have to provide my own low­er volt­age. But apart from that, mak­ing the­se things slight­ly smarter shouldn’t present any real chal­lenge.

Building a replacement circuit

Drawing up a schematic for a replacement driver

Draw­ing up a schemat­ic for a replace­ment dri­ver

So a replace­ment dri­ver for the­se lights would need two parts; a low­er volt­age pow­er sup­ply, and some­thing to switch them on and off based on input from the Arduino. I pulled out my note­book and start­ed to draw up a solu­tion.

For the pow­er, I used an LM1117 3.3V lin­ear reg­u­la­tor. Thanks, past me, for buy­ing a dozen the last time you need­ed one. All I did with that was copy the exam­ple usage schemat­ic out of the data sheet.

And then I added an NPN tran­sis­tor as a low-side switch (I real­ly like Sparkfun’s tran­sis­tor tuto­ri­al to help under­stand how to use tran­sis­tors as switch­es like this).

That’s real­ly all that’s required. I could run an Arduino from a 5V USB con­nec­tion, feed pow­er from the Arduino’s Vin pin to this cir­cuit, and use a dig­i­tal out­put from the Arduino to switch the lights on and off. Time to see if it works.

Testing and assembly

Assembled circuit on breadboard

Assem­bled cir­cuit on bread­board

While assem­bling I realised my schemat­ic had a cou­ple of prob­lems. First, see­ing as I was receiv­ing a reg­u­lat­ed 5V sup­ply, using two smooth­ing capac­i­tors for the lin­ear reg­u­la­tor would be overkill, so I just omit­ted one. Sec­ond, I wasn’t sure if the LED string would need cur­rent-lim­it­ing resis­tors, so I assumed that it would and added a 100Ω resis­tor.

I put cir­cuit togeth­er on a bread­board and wired my LED string to the board. Then I took a Freetron­ics Leo­stick I had spare, con­nect­ed the 5V and GND pins to my cir­cuit, and the sig­nal to a PWM pin. Load­ed up the Blink exam­ple sketch and… noth­ing hap­pened.

So out came the mul­ti­me­ter again. First check­ing that all of the con­nec­tions were solid, and then I start­ed mea­sur­ing volt­ages in dif­fer­ent places. I had the right volt­age com­ing out of the reg­u­la­tor. The Arduino was switch­ing the right out­put pin on and off. And I was even get­ting the volt­age read­ings I was expect­ing across the LED string. But no blinky-blinky. After glar­ing at it for a min­ute or two inspi­ra­tion struck, and I swapped the leads to the LED string around. Blinky-blinky.

Final­ly, I sol­dered my com­po­nents in to a small strip of pro­to­typ­ing board. I intend­ed it to be a sort of shield for the Leo­stick, so I added head­er pins for pow­er and sig­nal, and the whole con­trap­tion just plugs in on top. I added a cou­ple more head­er pins for the LED string, and crimped DuPont con­nec­tors on to its leads. Hard­ware com­plete!

Assembled driver circuit

Assem­bled dri­ver cir­cuit

Programming the Arduino

I want­ed 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 sta­t­ic lev­el. More advanced com­mands might include blink­ing, or slow­ly fad­ing between two dif­fer­ent lev­els. My FairyLights.ino sketch imple­ments a very sim­ple text pro­to­col to con­trol the lights, cur­rent­ly just set­ting a sta­t­ic lev­el (and the all-impor­tant help com­mand). I’ve writ­ten enough text parsers in Arduino that I real­ly couldn’t be both­ered doing it again, so I picked up the Cmd­Parser library to han­dle all the hard work, mak­ing my sketch very straight­for­ward based on the Cmd­Parser call­back demo code.

Lighting it up

I strung the lights up around the desks in my home office, and plugged my new Arduino-based con­troller in to my desk­top PC. Con­trol­ling this setup over a seri­al con­nec­tion is a triv­ial task in any lan­guage, but see­ing as this machine is most­ly run­ning Win­dows the­se days I thought it’d make sense to talk to it using Pow­er­Shell. My result­ing script takes a num­ber as a para­me­ter, opens a seri­al con­nec­tion and uses the set com­mand to set the LED light lev­el. Unfor­tu­nate­ly Win­dows makes it slight­ly dif­fi­cult to run a Pow­er­Shell script with­out pop­ping up a con­sole, with the com­mon solu­tion being to launch the script from a VBScript. So the Win­dows direc­to­ry for this project includes the con­trol script, as well as a cou­ple 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 Raz­er Chro­ma key­board. And now I have kitc­shy bling at my fin­ger­tips.

Finished project

Fin­ished project

This was a pret­ty point­less but most­ly fun lit­tle hack. As usu­al, all of my code for this is in my arduino repos­i­to­ry. The whole process took me some­where around 6–7 hours over a cou­ple of days. That includ­ed the time I wast­ed with the LED leads the wrong way around, as well as fig­ur­ing out a weird hard­ware-relat­ed prob­lem with Cmd­Parser (see my pull request for details). Hope­ful­ly this post gives a lit­tle insight in to how I think about and put togeth­er my projects, and pro­vides some inspi­ra­tion for oth­er people’s.

The Kerbal controller

This after­noon I gave a talk at the Open Hard­ware mini­conf at linux.conf.au about the Ker­bal Space Pro­gram hard­ware con­troller build I’ve been work­ing on for the last lit­tle while. I’m pret­ty proud of this build, the talk was fun, and the crowd seemed to like it, so I’m pret­ty stoked this evening. :)

For those inter­est­ed, here’s all of the infor­ma­tion I have online about it all.

  • slides from today’s talk
  • git repos­i­to­ry for this build. Source, quite a few cir­cuit schemat­ics, design and build notes, all sorts of oth­er things. Yes, it does still include the bro­ken rib­bon con­nec­tor on the PCB lay­outs, with a large note in the README. :)
  • the KSP forum 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 pho­to album, and a cou­ple of videos of var­i­ous stages of the build.

Overengineering a clock

Like pret­ty much every­one who ever pulled apart their Nin­ten­do Game and Watch so they could beef it up with a speak­er and AA bat­tery hold­er scav­enged from a tran­sis­tor radio (that thing was awe­some), I was out­raged when Ahmed was arrest­ed. Luck­i­ly, 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 pret­ty much imme­di­ate­ly.

I start­ed with a spare Arduino-com­pat­i­ble board (the love­ly lit­tle Freetron­ics Eleven) and a dis­play mod­ule I’d just picked up as an exper­i­men­tal addi­tion for my KSP con­trol pan­el. Had to order in a real-time clock mod­ule, but that gave me a cou­ple of days to get the first few com­po­nents 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 sol­dered on as ghet­to arduino con­nec­tions, and I like how they work for ad-hoc break­outs. The dis­play is an SPI device with a sep­a­rate RGB back­light, hence all of the ini­tial orange con­nec­tions. When the RTC arrived I was able to quick­ly bung it on the board and add a lit­tle 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 sec­ond. 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 need­ed some way to house it, with­out hid­ing all of the gory detail. So I snarfed some 3mm clear per­spex from the box of off­cuts at the Robots and Dinosaurs mak­er space, whipped up a quick set of mount­ing holes in LibreCAD (again, I’m get­ting good at design­ing and cut­ting the­se sorts of pan­els thanks to my work on my KSP con­trol board) and used the robod­i­no laser cut­ter to make a face­plate. Bolt­ed all of the pan­els in place, then used a cou­ple 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.

Arguably a clock now. It sits on a shelf, and time can be deter­mined from some dis­tance. Hasn’t explod­ed yet.

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

Start­ing sim­ple — that back­light can be pret­ty bright and annoy­ing. So I bought a light-depen­dant resis­tor, whacked it on in a cor­ner, and added some code to sam­ple the ambi­ent light lev­el and dynam­i­cal­ly 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 pow­er I used a spare 5V wall wart, again left over from a cou­ple of iter­a­tions of pow­er­ing my KSP con­troller. 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 pow­er leads back to the Arduino.

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 the­se things yet, they’re amaz­ing. WiFi, very capa­ble micro­con­troller, can eas­i­ly inter­face with an Arduino or just as eas­i­ly be repro­grammed with the Arduino IDE, and cost well under $AU10 each. They require 3.3V, and more cur­rent than the Arduino’s onboard reg­u­la­tor can sup­ply. Luck­i­ly my dis­play also uses 3.3V log­ic, so I already had a 74HC4050 log­ic con­vert­er with some spare pins on my board. Just had to add a 3.3V lin­ear reg­u­la­tor and asso­ci­at­ed capac­i­tors, 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­i­ly attach an FTDI cable to repro­gram the ESP8266, and it made the whole thing look more com­pli­cat­ed.

The pro­to­type board, clock­wise from top mid­dle: 4050 log­ic con­vert­er, LCD rib­bon con­nec­tor, RTC mod­ule, FTDI head­er, LDR, 3.3V reg­u­la­tor, ESP8266. Not shown: explo­sives.

I run an MQTT ser­vice on my home server. It’s a great mul­ti­pur­pose, mul­ti­de­vice mes­sage bus. My Open­HAB install inte­grates with it. My kodi media play­er pub­lish­es now play­ing info on it. My phone pub­lish­es (some) loca­tion data to it. I have a hand­ful of oth­er Arduino devices that send and receive infor­ma­tion across it using the fan­tas­tic pub­sub­client library. So I wrote a sim­ple client 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. When­ev­er it receives any­thing it’s sub­scribed to, it pass­es it to main clock con­troller using a reg­u­lar seri­al con­nec­tion. Sud­den­ly I had a thing on the inter­net, with nary a buzz­word in sight.

One of the afore­men­tioned Oth­er Arduino Devices on my net­work is a lit­tle one-day project I knocked togeth­er last year. A remote tem­per­a­ture sen­sor con­sist­ing of an ATTiny84 con­troller, DHT22 temp and humid­i­ty sen­sor, and nRF24L01 low-pow­er radio trans­ceiver, pow­ered by a cou­ple of AAA bat­ter­ies. That sits out­side and broad­casts cur­rent temp and humid­i­ty data on MQTT, which most­ly just gets used to gen­er­ate nice graphs. Read­ing that to show cur­rent tem­per­a­ture on my clock was triv­ial. Then I added a small script on my server that polls local fore­cast infor­ma­tion from the BoM and broad­casts that a few times a day. On the clock side, I start­ed using icons from the free Meteo­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 Arduino means I’ve got room for quite a few. This gave my clock cur­rent (ultra)local con­di­tions, and the dai­ly 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 start­ed out just show­ing the text fore­cast pre­cis (which, inci­den­tal­ly, is won­der­ful­ly poet­ic; I’m hav­ing a hard time using it to accu­rate­ly choose an icon). But there’s so much cool stuff I want to know!

I use pub­lic trans­port all the time — my dai­ly com­mute to work is by train, and I use the bus stop around the cor­ner to get up to New­town a fair bit too. I also use Uber for occa­sion­al rides. The next log­i­cal step for me was radi­at­ing next depar­ture times for all of the pub­lic trans­port ser­vices I use. The eas­i­est is Uber, which has a super-sim­ple API to poll approx­i­mate pick­up time for a given loca­tion. I wrote a quick shell script that runs on my server, polls the Uber API every min­ute, and broad­casts pick­up times on MQTT. Now my clock knows how long I’ll wait for a ride.

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

That pret­ty much brings me to the cur­rent sta­tus. Every now and then I tweak the code on the con­troller, 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 pret­ty 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 project. Still think­ing about oth­er stuff to toss up in that space, but my recent exper­i­ments with CI for Arduino projects may lead to pub­lish­ing build results in the not too dis­tant future.

This was a real­ly fun project. Build­ing a clock was some­thing I’d want­ed to try for ages but nev­er quite got around to. I’ve wound up with a gen­uine­ly use­ful and hope­ful­ly inter­est­ing-look­ing object.

Like most of my oth­er Arduino projects, the code for this is online: https://bitbucket.org/pjhardy/smartclock . My local repos­i­to­ry is a cou­ple of revi­sions ahead of that but there’s not much inter­est­ing except for me com­plete­ly rear­rang­ing my local net­work after acci­den­tal­ly pub­lish­ing the WPA key. :/

Rostok 3D Printer Build

I’ve put off start­ing a 3D print­er for a long time, most­ly because I couldn’t think of any­thing par­tic­u­lar­ly 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 cou­ple weeks ago, in a fit of delin­quent irre­spon­si­bil­i­ty 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 mechan­i­cal build in 3–4 hours in one evening. The direc­tions online are a lit­tle rough in parts, but most­ly pret­ty thor­ough. The kit includes most tools need­ed, 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 print­ed parts. It’s impor­tant not to over-tight­en the­se — I man­aged to crack one part slight­ly along the print grain tight­en­ing it a lit­tle too much. I’m not too con­cerned about it because it has oth­er bolts near­by to take up the strain, but I was much more cau­tious after that one.

Sec­ond was with the two print­ed parts attached to the hotend. One seemed to warp slight­ly insert­ing the hotend, leav­ing the end tilt­ed slight­ly to one side. Not real­ly a show­stop­per, and worst case I’d be able to print a replace­ment part, pos­si­bly with a slight­ly 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 empha­sis on how impor­tant it is to make sure the car­bon fibre delta arms are the same length. Fol­low­ing the direc­tions to the let­ter I eye­balled the rods to make sure they were about the same length, cut strips from a left­over 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 cen­tral effec­tor plat­form that was vis­i­bly a few degrees off lev­el. And short­ly after­wards I dis­cov­ered that the rods were also pret­ty frag­ile — 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 plas­tic, and then I’d be able to match the lengths of the rods more care­ful­ly by screw­ing the u-joints in and out. But decid­ed to scrap that idea, and go with a more per­ma­nent 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 mea­sured the rods more care­ful­ly. Found a good 1.5mm dif­fer­ence between the short­est and longest arms, which in hind­sight is pret­ty ridicu­lous. With the effec­tor plate in my hand though I was able to realise that the bolts hold­ing it togeth­er were still bare­ly fin­ger-tight. Tight­en­ing them up held the whole struc­ture togeth­er prop­er­ly and straight­ened up the hotend nice­ly.

Build­ing a jig to hold my arms while they were glued was sim­ple 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 log­i­cal that the cen­tre of the hole would be 17mm from the end), and an extra mm for luck. From there one could prob­a­bly bang a cou­ple of nails in to a block of wood and use that to make a series of arms the same length, but I start­ed to overengi­neer a lit­tle. Start­ing with LibreCAD I quick­ly drew up a block with six pairs of screw holes the right dis­tance (uh, 187mm for my arms).

B8gNylwCAAAXUCqThis evening I wan­dered down to Robots and Dinosaurs, a pret­ty great mak­er space in Syd­ney, and used the laser cut­ter to cut a chunk of 8mm acrylic to shape. Then added longish bolts and fixed them in place to make my jig. Filed the insid­es of the car­bon fibre rods a lit­tle, 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 every­thing stayed togeth­er.

I gave the glue a few hours to set, then took the arms off and test­ed 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 pret­ty con­fi­dent I’ve got them accu­rate enough, and right now I’m pret­ty pleased with how well it worked.

So, next is to leave the arms overnight to ful­ly cure. Tomor­row I’ll reassem­ble every­thing then get back to work on the wiring and elec­tron­ics.

Building an arduino-based video game controller

I play a lot of Ker­bal Space Pro­gram because sand­box games in space is pret­ty much the great­est idea ever. So in an attempt to enhance the game and build some­thing pret­ty 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 teleme­try.

My final design is going to be fair­ly large, but to start with, I want­ed 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 sort­ed out for inter­fac­ing with the game through the KSPSe­ri­alIO plug­in. It’s tak­en quite a few months on and off to get this far, but this week I final­ly 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 arduino projects have had pret­ty ad-hoc enclo­sures. You can go a long way with a Jiffy box and a Dremel. Then I bought an emboss­ing label mak­er to add some text to my box­es (and, OK, every­thing else — when you have an emboss­ing label mak­er every­thing starts to look like an unla­beled thing). My most recent work though has been a pure human inter­face device. There’s a lot of but­tons and switch­es and dis­plays, and one of my goals for it was to cre­ate an enclo­sure that looked absolute­ly stun­ning.

I’ve even­tu­al­ly set­tled on build­ing back­l­it pan­els from laser-etched acrylic, based on a tech­nique I picked up from the MyCock­pit forum for simpit builders. Flight sim geek com­mu­ni­ties are a great resource for learn­ing how to build nice con­trol pan­els, who knew? I’ve been refin­ing my process to get decent results with a sin­gle pass through the laser cut­ter in my local mak­er space.

Materials

  • Acrylic sheet. I use 3mm opal translu­cent sheet. A square metre cost me $80, and now I have more acrylic than I’ll ever need. At cur­rent esti­mates, 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 plas­tics. 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.

Fresh­ly paint­ed 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 min­ute 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 fresh­ly paint­ed fur­ni­ture to boot.

Design your panel

This part was pret­ty incred­i­bly frus­trat­ing for me. I start­ed out work­ing with LibreCAD, a rea­son­ably full-fea­tured 2D CAD draw­ing pro­gram. That made draw­ing pre­cise out­li­nes and holes for cut­ting a breeze, but it’s not par­tic­u­lar­ly good at work­ing with text. I want­ed real true­type fonts on my pan­els, and get­ting LibreCAD to import font faces in a form it can work with end­ed up beyond me.

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

That… most­ly works. Some­times the text paths LibreCAD saves just don’t gen­er­ate eas­i­ly 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 LibreCAD 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 Inkscape, to ensure a hap­py etch­ing expe­ri­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 dum­my cut with holes and a com­bi­na­tion of angu­lar and round let­ter­ing in all of the sizes I need­ed. I was using a cou­ple of dif­fer­ent sized fonts, and it took me a lit­tle while tweak­ing set­tings to get a result 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 slight­ly after the out­line is cut.

I learned the hard way that get­ting excit­ed 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­l­it. 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 cou­ple of coats of paint along the edges.

I’m still work­ing on get­ting this part right. Pre­vi­ous attempts with­out the mask­ing tape led to paint bleed­ing under the edge, lead­ing to vis­i­ble 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 pret­ty good though.

Once the paint has dried, the back­ing paper for the pan­el can be removed and com­po­nents mount­ed.

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 the­se pan­els. Sim­ply light­ing up the inside of the enclo­sure looks good, but seems a bit bland to my mind. I want to start exper­i­ment­ing with with indi­vid­u­al­ly lit pan­els, pos­si­bly by coun­ter­sink­ing LEDs in to the back of the pan­el. Most­ly because I’m keen on flick­er­ing pan­els, and chang­ing pan­el back­light colour. But pret­ty pleased with the over­all look so far.

 

Prototyping nRF24L01+ modules on Arduino

I start­ed look­ing at the nRF24L01 chips while plan­ning a con­troller for the sprin­kler in my back yard. They seemed like a pret­ty good option for low-cost, low-pow­er wire­less Arduino com­mu­ni­ca­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 set­tle for not per­fect. And I got excit­ed at the thought of build­ing a mesh-style net­work of sen­sors and actu­a­tors using RF24Net­work. Per­haps a lit­tle too excit­ed — my plans have become far more ambi­tious and involve retro­fitting nrf mod­ules on to all of the exist­ing Arduino doo­dads already in my home, and some more new sen­sor mod­ules out in the gar­den.

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

(Continued)

UPnP/DLNA clients in Ubuntu 13.04

Banshee and UPnP remoteStream­ing con­tent from a UPnP server (in my case, the XBMC media cen­tre in my lounge room) to an Ubun­tu machine is fair­ly sim­ple. But there didn’t seem to be any doc­u­men­ta­tion that I could find, and I end­ed up spend­ing a sur­pris­ing amount of time futz­ing around mak­ing it work. This is how I did it in Ubun­tu 13.04. I use GNOME for my desk­top, but con­firmed that it also works just fine with the default Uni­ty desk­top. Oth­er envi­ron­ments may need to tweak how the ser­vice starts, as well as clients.

Install software

We’re using the Rygel UPnP pack­age, specif­i­cal­ly its MPRIS inter­face to enable UPnP ren­der­ing to desk­top media play­ers. In addi­tion, we install GUP­nP to provide a UPnP Con­trol Point, and final­ly ban­shee. I had a crack at using Totem as a ren­der­er, as of April 2013 the ver­sion in Ubun­tu reg­is­tered as a Medi­aRen­der­er but qui­et­ly refused to play any con­tent I asked it to. The upnp-inspec­tor pack­age is nice for check­ing every­thing works.
sudo aptitude install rygel rygel-preferences gupnp-tools banshee upnp-inspector

Configure rygel

Open Rygel’s con­fig­u­ra­tion file:
nano ~/.config/rygel.conf
And enable the MPRIS inter­face by adding the fol­low­ing at end of the file:
[MPRIS]
enabled=true

Rygel is designed as a UPnP media server, and by default will start offer­ing up local video, music and pic­ture shares as media servers. 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:
interface=
upnp-enabled=false

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

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

Playing things

UPnP Inspector window

Inspec­tor win­dow show­ing my XBMC server, the local Rygel share, ban­shee, and Bub­ble­UP­nP on my android phone.

Start UPnP Inspec­tor. It should list any avail­able Medi­aServers on your net­work and, if you didn’t dis­able them, local shares from Rygel. Start ban­shee, and it should also appear as a Medi­aRen­der­er in the inspec­tor 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 Bub­ble­UP­nP 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 results from exter­nal con­trol point soft­ware. The GUP­nP remote occa­sion­al­ly 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, pret­ty much on a whim. They’re not the cheap­est way to buy RGB strip light­ing, but I did like the mod­u­lar design. And it’s remark­ably easy to mod­i­fy the con­troller to dri­ve the sys­tem with an arduino.

The sys­tem comes with a con­troller that allows you to set a colour man­u­al­ly, as well as pre-set colour change and fade func­tions. Rather than build my own cir­cuit I want­ed to save time by reusing this con­troller. Open­ing it up revealed a PIC micro­con­troller, and three MOS­FETs for the red, green and blue chan­nels.

First thing to do is dis­able the micro­con­troller by cut­ting through the pow­er 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­troller as nor­mal.

Three out­put pins from the micro­con­troller dri­ve the MOS­FETs, but only two of them have big friend­ly sol­der pads, so I sol­dered wires on to the three resis­tors just below the MOS­FETs (R5, R6 AND R7). Then sol­dered the oth­er ends of the­se wires to a short strip of head­er pins. The­se are then plugged straight in to pins 9, 10 and 11 on my Arduino. I’ve labelled the pic­ture with which MOSFET dri­ves which LED chan­nel, but they match what’s print­ed on the PCB where the input cable is con­nect­ed.

Final­ly, we need a ground wire. Eas­i­est way to con­nect it is to sol­der a wire on to the -ve wire on the input cable. The oth­er end of that is again sol­dered on to a head­er pin, which is con­nect­ed to the ground pin of the Arduino.

And that’s it. I hooked the­se up to my Leo­Stick the Freetron­ics guys gave away as swag for LCA 2012 and load­ed 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­troller for bob­lig­ht on my XBMC media cen­tre. Set­ting up the con­troller, writ­ing my own sin­gle-chan­nel bob­lig­ht sketch, installing soft­ware and con­fig­ur­ing the XBMC addon was all done in a sin­gle evening. It was a lot of fun, and even with a sin­gle chan­nel the results are pret­ty awe­some.

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. (Con­tin­ued)