About the code

To emulate fire, I started testing with no particular idea in mind. 
In the beginning, I try to send some analog values for the RED and GREEN channel on the led with a fixed delay.
But in some cases, red was too low and green was high, so the light looks greenish. I fix this issue by selecting a random value for the green between 0 and the red value.
In this case, the light was still able to go from almost zero to maximum brightness, and again it wasn`t realistic.
The solution I found most natural was to tweak the light with a random step(in this case, between -32 and 32) for the red channel. Like that, the led will never do an enormous jump between min and max value.
The green value is formed from the red with a little tweak.

  // Initialize the red value
  int step = random(128, 255);
  for (long i = 0; i < 90000; i++) {
    // Smooth increase or decrease value
    step += random(-32, 32);
    // Never go below 128
    step = max(128, step);
    // Never go above 255
    step = min(255, step);
    // Tweak the green value
    int g = step - random(0, 32);
    analogWrite(RED, step);
    analogWrite(GREEN, g);
    // Random delay to eliminate artificial look
    delay(random(8, 16));
  }

Short video



This is the schematic


With 3D enclosure:

The box is printed in 3 parts

  1. Bottom - which is the main part.
  2. Top - threaded cap that presses the candle to the bottom
  3. Ring - If you want to use a diffuser(baking paper), you can slice 33mm diameter circle paper and add it between the top and the ring part.