CANDLE LIGHT

 

​Code Design

The inner of the candle light is pale yellow, very stable. And the outer layer gets warmer also with more red color. The very bottom of the candle fire might be pale blue, but we only choose to stimulate the upper part in this 2D version


The candle light is always swinging around. So we divided the outer layers into three parts and each of them do a sinFade in lightness. However, the total lightness looks didn’t change in this way. So we combine the two parts of the three so there would be a clear swinging and breathing effect. And the inner LED always remain pale yellow using the same lightness.


 The color of the fire fire depends on its temperature. The fire with higher temperature is always more stable, so it looks more strong. So we choose to define the hue by the lightness. In HSL system, we do a mapping from the L domain to the H domain and define each hue value by the lightness value in negative correlation. 

 

Entire code

#include <Adafruit_NeoPixel.h>
#include <ColorConverter.h>

const int neoPixelPin = 5;   // control pin
const int pixelCount = 7;    // number of pixels

// set up strip:
Adafruit_NeoPixel strip = Adafruit_NeoPixel(pixelCount, neoPixelPin, NEO_GRBW + NEO_KHZ800);
ColorConverter converter;

int h = 10;         // hue
int s = 100;        // saturation
int i = 40;        // intensity

float h1 = 10;         // hue
float i1 = 100;        // intensity
float h2 = 10;         // hue
float i2 = 100;        // intensity
float h3 = 10;         // hue
float i3 = 100;        // intensity

int angle=90;
int change=30;

void setup() {
  strip.begin();    // initialize pixel strip
  strip.clear();    // turn all LEDs off
  strip.show();     // update strip
  Serial.begin(9600);
}

void loop() {
  
  // create a single color from hue, sat, intensity:
  RGBColor color = converter.HSItoRGB(h, s, i);
  
  RGBColor color1 = converter.HSItoRGB(h1, s, i1);
  RGBColor color2 = converter.HSItoRGB(h2, s, i2);
  RGBColor color3 = converter.HSItoRGB(h3, s, i2);

  // loop over all the pixels:
  for (int pixel = 0; pixel < pixelCount; pixel++) {
    if(pixel== 0) strip.setPixelColor(pixel, color.red, color.green, color.blue);   
    if(pixel>0 && pixel<3) strip.setPixelColor(pixel, color1.red, color1.green, color1.blue); 
    if(pixel>2 && pixel<5) strip.setPixelColor(pixel, color2.red, color2.green, color2.blue);
    if(pixel>4 && pixel<7) strip.setPixelColor(pixel, color3.red, color3.green, color3.blue);     
    strip.show();  
    delay(100);
  }
  if(angle<=0 || angle >=180){
    change=-change;
  }
  angle=angle+change;

  i1=10+40*(sin(angle * PI / 180)+1);
  i2=10+40*(sin(angle * PI / 180+PI*0.6)+1);
  i3=10+40*(sin(angle * PI / 180-PI*0.6)+1);

  h1= 15-(i1-40)/10;
  h2= 15-(i2-40)/10;
  h3= 15-(i3-40)/10;
  
  Serial.print(i1);
  Serial.print(",");
  Serial.print(i2);
  Serial.print(",");
  Serial.println(i3);
}

 

Process

 For this week's assignment, it is to make a candle light, Me and Tianjun both want to highlight the instability of candlelight, so we first tested the effect of light in water. At the same time, we considered that the candlelight is usually faint, so we tested the effect in the paper again.

 
 
 

Later, when Tianjun bought vegetables in the supermarket, She found the skin of the onion. The skin has texture and a slight dark red. Under the light, red light will be produced. Tianjun and I are very satisfied with the effect

 
 

​WEEKLY OBSERVATION 

This photo was taken during my winter vacation at Carmen Park in Boston. I have always liked the effect of light in the mist. The water vapor generated on the ground makes the direct sunlight no longer dazzling. When the light passes through the mist Part of it is absorbed by the mist, making the light soft and warm, while the scattered light source is generating an irregular reddish halo. At the same time, the human shadow becomes thinner due to the weakening of the light.

 
 

©2020 by Siyuan Zan. Proudly created with Wix.com