Fluffy McDeath's Arduinory The RGB LED Candle
After the RGB LED project, and using the same wiring, I played around with setting colours and, after finding a fairly good approximation to a candle flame I thought I would set about trying to get it to flicker in a candle like way. I could have done this with a yellow LED as well which would mean I'd only need to hook up a single channel but I liked the colour I got from the RGB LED better.
I used a fairly simple model for my flame simulation based on observations and some assumptions. It looks to me that flames tend to have a varying more or less stable intensity based on the current conditions of wick length and molten wax availability which would vary slowly. On this slowly varying intensity would be added a variability based on perturbations due to airflow which would be distributed with high probability for low perturbations and low probability for large perturbations but large perturbations would cluster as they would be caused by things like a breeze in the environment that would have a measurable duration.
I also decided that perturbations should be negative, i.e. the candle is knocked down from its stable intensity and that it would thereafter rapidly recover and rise back to it's (for that time) stable value.
Having made these decisions I then hacked together something that only vaguely implemented that description. What I ended up with displayed some definitely un-candle-like behaviour from time to time but for the most part I was so pleased with it I left it running for over a week.
If I can recover the code from my partially fried netbook I shall post it.