Sunday, May 16, 2010

TwinklePIC, part I

My personal project "To Do" list is approximately 427 meters long. Although I sometimes have bursts of productivity, the list seems to grow faster than I'm able to scratch things off. Sometimes, though, projects that seemed buried by the passage of time do eventually get done. I'm in the midst of such a one right now that is at least through its first working prototype. I call it: TwinklePIC.

When I say buried by the passage of time, I really do mean it. The inspiration for this piece came from an article in Make: magazine that I read when I visited Hilary in Scottsdale, when she was six months pregnant with Brynna! The original article described making a Cosmic Night Light brick from LEDs and cleverly layered cast epoxy. The LEDs were arranged in the form of a constellation - Leo in this case. The front-most layer of epoxy was clear, but with glitter and such mixed in. Then came the layers that held the LEDs in place in the constellation, culminating in a black layer to hide the electronic guts of the thing. The LEDs were wired in parallel to a coin cell battery through an ordinary switch. A feature of the project was that it wouldn't require soldering - the components were instead connected with just wrapped wire.


I thought this would be a great thing to give to my as-yet-unnamed daughter. But one thing happened, then another, and another, and a year and a half goes by.

I could make the plausible defense that I was a little busy in that time, but that would be both obvious and lame. A more dignified way to put it is to say that I was mulling the design over...very, very carefully. The original night light project is indeed pretty cool, but I wondered about the utility of a night light that ran for, perhaps, ten hours on a single battery. Plus, the light is only ever on or off. "Is it not in the nature of a light to only be on or off?" you ask. Well, yes, that's mostly true. But it is the nature of a star, as seen through our shimmering atmosphere, to twinkle. I wanted Brynna to have stars that would twinkle.

Getting LEDs to twinkle by fading in and out is not especially difficult - just wander the aisles of and big box store around Christmastime to see what I mean. This can be accomplished by several electronic techniques, the most common one is called pulse width modulation (PWM). It boils down to turning an LED on and off so fast your eye blurs it all together. Varying the ratio of on time to off time (what is called the duty cycle) changes the apparent brightness. I may have more to say about that in a later post.

So I knew how to make a light fade in and out. But I wanted not one light, but to build a bunch of LEDs into a constellation of some sort. It would be disappointing if they all faded in and out in unison. They'd have to be staggered. Still, if they all faded in and out at the same rate, but were just offset from one another, the effect would still be unrealistic because you'd immediately sense the repeating pattern. They'd all have to fade in and out at different rates: one would fade once per second, another would have once every other second, etc. But even then I wouldn't really be satisfied, because you'd still notice repeating patterns when, for instance, the one-per-second LED and once-every-other-second LED fell into unison. This sort of matching is desirable when pairing up the sopranos and the tenors, or for tuning a guitar, but I wouldn't consider it all that impressive a visual effect. I toyed around with making the different rates prime numbers (fading every 2, 3, 5, 7, 11, 13, etc. seconds), so that LEDs would only occassionally fall into unison. But you'd then end up with the situation where one LED would always be blinking fast, and others would be cursed to always blink slow. Boring - and again not very true to life.

No, this here twinkling effect would need to have each light fading at its own, independent rate, and that rate would also need to change in time. An LED would start off fading in and out rapidly, but over minutes would slow down, then speed up a little, all while the other LEDs were doing the same. In other words - the fade effect would need to be (or at least appear) random. Now that's twinkling.

I didn't spend the whole of the intervening 18 months mulling this over, but you can see I gave it some thought.

In the next post - an introduction to how I actually got down to it and started making this happen.

1 comment:

Allyson Wendt said...

Can't wait to see the details--sounds like a super-cool project.