One of my earliest memories was seeing the chasing Christmas lights on their neighbors’ houses.
One family friend in particular took special care hanging his lights each year. The lines were crisp and clean and the chasing lights looked like tiny ants marching across the roofline and down the edge of the house.
I thought, “When I grow up, I want to have my own chasing lights. But instead of white like Randy’s, I want them to be blue. And instead of lots of little white ants, I want just one. It should zip around the windows and down the fenceline, leaving a tail in the darkness like a comet.”
A few years later, I learned how switches and lights could be wired in a matrix. Four rows and five columns could yield 20 lights…. But the thousands of bulbs needed to cover a house and a yard would be a *giant* matrix. The bundle of wires going to each light would be thick and unwieldy.
Not so practical.
Then a few years ago, I heard murmers about little microcontrollers. Someone posted on slashdot, in response to a lights-and-switches problem, that simply programming a PIC would be an easy fix.
I’d never heard of PICs, so I started searching online.
My first queries for ‘PIC Programming’ returned hundreds of examples of assembly language. Talk about a learning curve! It was completely foreign world.
A few days later, I learned that there were compilers for these PIC chips as well. I wasn’t familiar with C or Python, but some searching led me to MicroEngineering Labs PICBasic Pro compiler. It could, per their website, let me program these little chips to do nearly anything I wanted.
I’d done some BASIC programming years ago on my parents’ Apple ][e computer – sometimes copying programs, by hand from the back of 3-2-1 Contact! magazine and sometimes writing them from scratch – and BASIC had a familiar ring to it. The command structure looked fairly simple, so I purchased the compiler and some sample parts.
“Aha!” I thought, “Maybe each of my blue lights could have one of these tiny microcontroller brains. I could send serial data to all of them and they could somehow decode the data stream and know when to turn on and off.”
That was four years ago, and the rest is history.
In 2005, I built 32 copies of my first-ever color-changing Christmas lights. The project was successful and a great learning experience. You can read about it by clicking the links on the right.
After taking a year off, I’m working on a new design with a vengance.
The current project was written in 100% pure assembly language. I tried like crazy to write it using PBP, because I wanted to share the finished code with the friendly folks who haunt the PicBasic Pro forums.
Alas, the timing requirements were too strict. The overhead of the BASIC compiler was too great – I needed 256,000 interrupts per second, using a relatively slow oscillator, and the PWM routine couldn’t be bashed into submission. Believe me, I tried.
So this is my first-ever foray into bare-metal assembly.
In many respects, I love the simple elegance of the resulting code. It’s nice to know exactly what the processor doing with every tick of the clock. I like the purity and clarity.
PBP has become a valuable tool, as has plain assembly language. I’m grateful to have both in my box of tricks.
So please forgive me if there are some sharp edges in the code. In my opinion, it’s pretty clean. But I’m always learning. Feel free to pass along any suggestions you may have.
Well, the source code is rock-solid. The sample LEDs I chose have exceeded my expectations. I’ve ordered a prototype circuit board to replace the breadboard I’m currently using as a testbed.
I’m negotiating with an Asian company to fabricate and assemble a few hundred copies of the circuit. I’m working on enclosures.
Probably in the next few weeks and months I’ll offer individual circuit boards for sale (either as kits or fully assembled). There will be more photos and video clips as the project progresses.
Thanks again for visiting my little corner of the web.
Thanks to the hundreds of other folks who have posted their code snippets, dreams and hardware hacks on the web. Thanks to Mark at Network Wizards for a great inspiration. We all build on the shoulders of those who have gone before.