Friday, 16 December 2011

The great LED lighting scam!

As an electronics engineer with a theology degree, there's one thing that really bothers me: unethical behaviour.

One of the biggest things that has got to me this year is to do with Christmas lights. My wife and I dearly love putting them up and having the display every night between the start of Advent (the 4 Sundays leading up to Christmas day) through to Epiphany (6th January).

We used to have lots of incandescent lights, which would burn a lot of power - until one year a few years ago I "busted" a few kids who were walking along with a pair of pliers and "busting" the globes of some fairy lights we put as a boundary around our yard. We started switching to LED lights the following year and have slowly replaced things as the incandescent ones have burnt out.

This year, we had only one incandescent light thing in our display: a 0.8m high 3D Christmas tree made of a rope light with incandescent bulbs inside. All the rest (including some other rope light stuff) use LEDs. Our entire display this year uses less power than a toaster on minimum setting.

"That sounds great," I hear you say, "because of the reduction in energy consumption meaning it will have less impact on the climate!"

"Hold your horses," quoth I, "for there is an elephant in the room!" LEDs are expensive to produce compared even to the compact fluorescent "globes" that we here in Oz have had mandated for some years - and what's more, they have a significant amount of embodied energy (the energy used to produce them) because they are made on a crystalline semiconductor substrate which is "doped" (meaning that deliberate impurities are added to the crystal lattice of the substrate to allow current flow in a controlled manner), and this is a process which is energy expensive.

The issue is not so much the LEDs, though, since they have a very high MTTF (Mean Time To Failure, a measure of how long they last). Rather, the issue is the quality of the rest of the light sets. Your typical Christmas light set contains 5 basic parts:
  1. a plug pack, typically 24VAC these days at various current ratings (anything from 150mA to 1A for the sets we are operating this year)
  2. a rectifier, sometimes with additional control cirtuitry for the ones with multiple colours and multiple functions
  3. said LEDs
  4. connection mechanism between LEDs and the wiring harness, and
  5. that wiring harness, between the plug pack and rectifier/controller, and between the rectifier/controller and LEDs.
It is parts 1, 2, 4 and 5 that are problematic.

Seven sets of LED lights from last year aren't working properly, and three we bought only last year (so this is the second year we wanted to use them but didn't). One of the five has a blown plug pack, one has a busted rectifier, three (the ones we bought last year) have all got busted wiring, and the other two have connectors that mean the LEDs don't connect into the wiring harness properly anymore (despite the fact that they are supposed to be "outdoor" rated, the contacts have rusted and have no springiness to hold the LEDs in, let alone have a decent electrical connection...).

Apart from the plug pack (where I'll simply have to purchase a replacement), I can and will fix the others at some point... but the question is why should I have to? LED Christmas lights still cost a premium but they are made so cheaply that they don't seem to last terribly long, and that means that all that embodied energy in the LEDs and the goodness of them lasting so long is completely wasted.

It's a scam, as far as I can tell, and we should not be buying into it.

Thursday, 24 November 2011

All I want for Christmas

My wife and I love to put up Christmas lights (of course, being an amateur astronomer means that this puts me in a state of war with myself!). We've done so every year for the past 6, kicking them off on the first Sunday in Advent and keeping them going through to Epiphany, since the Christmas season only starts on Christmas Day, not finishes! But I digress...

I have an enormous complaint about commercially-produced Christmas lights. They are badly under-engineered, and break at the first available opportunity, which usually means the second year you try to use them. In some respects, this is not terribly different to other consumer electronics which seem designed to die that way (and the conspiracy theorists will tell you that this is done deliberately to make you buy more product). As a professional electronics engineer, I have to say that this offends me quite a lot.

The worst thing is that virtually all the lights you buy now have LEDs. Don't get me wrong, this is a great move since it means that we can run our lights off a lot less electricity, and you get much more vibrant colours which really look grand.

The problem is that they are marketed as "long lasting" so you think "Great, I don't have to check globes every year and they'll last a long time" - that is, until you find the real Achilles' heel of these confounded things: the connectors! On most sets that we own, the LEDs are inserted into the holders that they used to use for the older incandescent fairy lights and they still use the same plug on the wiring harness. It's cheap; the parts are readily available and the harnesses can still be made in the same way. The problem is that the contacts now become rusty because of the different metal type used in LED legs compared to that in the incandescent ones, so you now can suffer from metal-metal corrosion.

In the end, the LED sets only last about as long in practice as the incandescent ones, but then turn around and have a much higher embodied energy (the energy to make them, mainly the LEDs) - oh and are more expensive still.

All in all, we just aren't getting our money's worth.

Friday, 18 November 2011

"Responsibility" should have "self" in it

I get quite peeved at other people some times. Mainly over failure to take responsibility for themselves.

Today was the second time in 2 weeks or so that, as a driver, I found myself coming dangerously close to pedestrians that ought not be where they were. Today's incident was me backing out of a shopping centre car park spot, and turning since you can't go straight back (unless there's a vacant spot behind you... but even if you do that, you end up having to turn as you drive forwards out of the other spot, and that's just a waste) - and a bunch of pedestrians who were a long way off and walking quickly towards the shop simply walked into the back of the car when I stopped to drive forwards again to leave the car park complex. And then had the nerve to abuse me for "hitting them".

The incident a couple of weeks ago was at the same shopping centre. I'm in the car, engine running, and do my checks to make sure there's no one around. But between my looking and moving off, a woman then tried to walk between my car and the next, and banged on the roof of the car when she got squeezed between the side of my car and the one in the adjacent spot. So, I got abused for "not looking" on that occasion, too.

The question I have is this: how responsible for other people are we? Where does the line between my responsibility for them end and their responsibility for themselves take over? Quite clearly, IMO, in both these cases the other people involved ought to be making themselves aware of what's happening in their immediate vicinity... as a driver I cannot look in all directions at once and so there are clearly going to be points in time where particular directions will not have had me looking there for a small bit of time.

It bugs me that driving is an operation that seems to require more and more good peripheral vision (mainly for other drivers than pedestrians, I haven't told you about the 2 complete tools I came across today that came so very close to having accidents that would probably have written off the car, and both of them because they failed to give way - just as in the two accidents that have written off my last two cars). Unfortunately, optical tests for driving only require the checking of vision by an optometrists' eyechart which only checks straight-ahead vision. For people like me with glasses, peripheral vision is a major concern - and all the more so with me since I have to wear big, chunky contact lenses along with my glasses (yes, both at once, not one or the other). My streaight-ahead vision is fine, but don't ask me to count fingers if you hold your hand near the edge of my vision - I might just have trouble seeing your hand! ;-)

Tuesday, 15 November 2011

Hand-crafted parsers

This is something that's been on my mind a lot over the last few years, and now that I've got a blog, it's the first real piece of content so I can get it off my chest.

I've done a lot of C/C++ code as a professional software engineer, and quite a bit more as a hobby programmer too, and have often come across libraries that are written to parse (that is, load from disk and interpret) various forms of text files. I've even used some and built some of my own when I've thought that a proper parser (e.g. ANTLR) might be overkill.

But I'm not convinced there really is such a thing as parser overkill, as a recent incident demonstrates.

I was attempting to use the TinyXML library for a personal project, based on SDL (Simple Direct-media Layer). I'd created my internal structure and an effective internal DTD (since TinyXML doesn't use them) to ensure that the read-in XML structure was correct.

I went to run my code on a sample XML file I'd created as a testbench, when "bam"... my program died (fortunately the computer didn't, since it was about 2 weeks old at that point!). Some of the attributes had to have integer values, but I got a strange thing with one attribute which didn't give the value I'd wanted.

Double-checking my file shoed the problem. With my new computer setup I've got a wireless USB keyboard, but it's really sensitive and possibly buggy - it seems every now and again to either not send characters I know I've typed or send additional ones which I know I haven't. And so, sitting in the middle of the integer, was an unobtrusive letter "n". I'm guessing "n" for nowhere since my fingers were nowhere near the "n" key as my keyboard continued its private vendetta.

Removing the "n" resulted in the correct behaviour of my software and I was happy initially. But after about 2 seconds' worth of happiness I felt quite infuriated about the whole process. No parsing library should ever report a successful conversion of an integer value when the integer is only partly converted. It should report a straight-out error if the text string contains characters other than 0-9 and possibly + and - depending on whether you want signed or unsigned.

The key to the problem lies in very basic C/C++ conversion. atoi (which is, IIRC, what TinyXML uses) has the problem that it converts only up to the point where it gets a non-integral character and returns that (see cplusplus.com's description). Therefore, "89n745" will convert successfully, but will return 89. In my case, the entire token has to convert to an integer, since the entire token is intended to be the one integer.

I've encountered this problem frequently before, and one way to solve it is to convert the integer back to a string and do a string comparison between the two... but that only works if you know the numerical format (e.g. how many leading zeroes?). In one case, a few years ago, we weren't sure about using BOOST and we did know the format exactly since we didn't allow leading zeroes, so we used this trick as a back-validation step. Sure, it added extra processing (string compares are expensive operations) - but correct parsing was non-negotiable, so we suffered the performance hit.

My solution this time was to forget TinyXML's conversion functions. Instead, I grab the attribute value as a string always and then use the BOOST lexical_cast system to do the conversion, since it throws a bad_lexical_cast exception if it can't convert the entire argument.

BTW, this is the only real complaint I have about TinyXML.

Intro to blogging

Well, I've finally crossed to the dark side and created a blog site. I wasn't sure if I'd ever do this, but I've got too much to tell to keep quiet any longer... so now I'll have a voice out there in Internet-land; after all, you're entitled to my opinion, right? :-)

So, welcome to my blog and hopefully you'll learn from what I've got to say, and vice versa. Life is a dynamic, growing, ever-changing thing - never static! - and learning is IMO growing in the best sense.

I've called my blog "Wings of Change" to reflect this opinion. It's a pun on "winds of change", because I want it to tie into my "greenbutterfly" e-mail. I love butterflies: wonderfully (and often vibrantly) coloured, performing tasks of pollinating plants (somewhat like bees in that regard), and often used in Christian circles as a symbol of Easter, celebrating the new life and new form of life that comes with resurrection.

And let's not forget that old hypothetical about a butterfly flapping its wings... Small voices can bring about serious change through the gathering of momentum.

Don't get me wrong, I'm no radical. But I do believe that whatever form of culture or society we end up with, on whatever basis it might be founded, there will always be room for change or improvement, simply because culture and society incorporates people, and people aren't perfect.

What can you expect on my blog? All sorts of stuff, from software and electronics, to music, movies, political commentary, to theology, and across to science and science methods... and all the way back again! My interests are wide and varied!