This week's assignment is creating an artificial candle with Neopixels LEDs. After observation of the real candle, I found some crucial aspects and characters of the candlelight.
Candlelight character and aspect from observation
- Randomness : The light flicker and brightness of the light is totally random.
- Slightly Fading : The candlelight is always slightly fade, but not totally dim. We barely see the fade actually.
- Warm Color: The color of the light warm color mixing between orange, yellow and white.
- Movement: Sometimes the light is not fading, but it moves. The movement of the light created a flickering effect.
These are all the aspects I try to mimic in my LED candles.
For the color mixing part, the neopixels color mode is in the RGB system. I tried to mimic the orangeness of the candlelight bt mixing mostly red value and some green value to get the yellowish color. In the end, I add some blue value to decrease the saturation of the color to get the pale orange-yellowish color of the light.
The value of the normal light is R = 240 , G = 80, B = 5
In the flickering part of the candle, I made the center light whiter than other flickering parts around it by adding green and a little blue to make it brighter when the light moves.
The value of the canter light is R = 240 , G = 100, B = 20
In order to make the flickering light, I use the movement of the pixels. When the pixels change really fast, the light mimics the flickering movement of the candle.
To make the direction of the movement random, I pick the pixel randomly with the random function.
The stable light of the candle for me it's not definitely stable. I found a little fade in the stable light. So when the light is stable, I slightly change the brightness of the pixel to create a fade.
I put two randomnesses in this assignment to represent the nature of the candle. First, I random the timing for both stable and flickering function. Second I random the direction of the flickering by random the number of the pixels.
I try to create the flickering effect first which is really satisfied myself. When the light is moving around, they cast two caustic light. The stable one seems white and brighter and the flickering one is more orange-yellowish and dim.
In the end, I combine the flickering function and the fade function of the light together.
Here's the final code.
In this assignment, I found put that I extremely obsess with caustic light. I decided to use a glass container as a fixture for my candle. I observe the different effects of candlelight and LEDs. I found that the LED's shadow is so sharp compared to the candle which is soft and dim. And in the LED shadow, I can see the color separation (clearly red and green light) in the shadow
I decided to use a napkin to diffuse the light and also dimming the LED light in the programming
I also try to create a movement of the shadow with this fixture. I decided to add water inside the container to see the effects. It's interesting. The shadow reflects with the movement of the water and mimics the movement of the candle flame.