As I discussed in my previous post, the thing that makes these look neat is the fading tail that chases the brightest light. Originally that was accomplished with capacitors which caused the light to fade as they discharged. I implemented the same concept, using a microcontroller and pulse-width modulation to manage the fading.
After the break I’ll go through the development process and share the code. I did this using an AVR microcontroller but you can use any chip you want. The gist of my process is this:
- Develop software (interrupt) based pulse-width modulation
- Write a function to monitor PWM values and automatically subtract from those over time to cause automatic fading.
- Use a buffer to track which LED is ‘active’ and do not fade that one. As soon as that buffer is shifted the old ‘active’ diode will start to fade.
And of course you’ll want to look at the most recent code.