The idea for this came about when passing by the Apple Store in Palo Alto, California late one night. After hours, when the store is "asleep," the lighted logos out front pulsate just like the power indicator on a sleeping Mac, and I just about fell over laughing. Unrelated, the following day a friend showed me his new Toyota Yaris, an adorable little economy car whose resemblance to the original "jelly bean" iMac was made even more apparent by the Apple logo decal he'd placed on the back window. The two just screamed to be combined...
Step 1: The Device
- The microcontroller itself. In this case I used a surface-mount PIC10F206 as it's what I had on hand, but just about any simple microcontroller will do provided you have the facilities to program it.
- A white LED. I've made throbbers using both surface-mount and 3mm through-hole varieties.
- A 3 volt lithium coin cell (CR2032 in this case).
- Battery holder.
- Circuit board to contain the components. Since I was using surface-mount parts, I opted to etch something for the occasion. If using through-hole components, the design is simple enough that a small piece of PCB perfboard with wire jumpers is likely sufficient.
- A clear rubber suction cup; pack of six from local hardware store.
- Glue of some sort. Hot-melt glue, silicone adhesive or cyanoacrylate "Krazy Glue" should all work fine.
- Apple logo decal adhered to a clear glass window.
Two components that typically appear in microcontroller and LED projects are conspicuously absent: there's no current-limiting resistor for the LED (the lithium watch battery used is intrinsically limited in current), and there's no decoupling capacitor across the microcontroller's power leads (simply wasn't needed in this noncritical application).
Step 2: The Code
The intensity of the LED is varied using pulse width modulation (PWM). Other Instructables and tutorials elsewhere already cover this in much better detail than I could. No offense intended in suggesting searching around elsewhere if you're not yet familiar with the theory.
The PWM duty cycle does not ramp up and down linearly. Gamma correction creates an exponential ramp that the eye perceives as a near-linear increase in brightness. Because I'm lazy and because so little program space was being used, rather than work out an exponentiation function I simply have a big table of precomputed gamma-corrected values. The PIC10F206 had enough space to contain this table, but a more constrained device might not have this luxury and actual math code will be needed.
One pin from the PIC (GP2) is used for output. This pin was chosen as I might later decide to use this chip's comparator function (available on pins GP0 and GP1) to detect nighttime or shade and enable the throb only when sufficiently dark. As it is, the device just throbs endlessly when the battery is installed, regardless of environment. The exponential PWM duty cycle means the LED is off most of the time, and a fresh battery can run the device continuously for a couple of weeks.
Step 3: The End Product
The attached QuickTime movie (just below the image) shows the throbber in action. The suction cup I used here has these concentric rings that detract from the final appearance, but I've since found smooth suction cups that look much better.
A couple of final notes on responsible throbbing: first, if you plan on putting one of these on your car, be aware that states and municipalities may have laws prohibiting certain placement and colors of lights on vehicles. You might want to add a switch so it's only visible when parked. Second, some communities may mandate recycling for all or for certain types of batteries. Both of these regulations vary by location, so you'll need to do your own research for proper use.
This almost certainly appears pathetically fanboyish. Actually I own and enjoy using all manner of different systems on a daily basis; this was just something for a chuckle. Please, no petty flame wars, let's just enjoy for what it is. Thanks!