Mike from London's video on how he accomplished his flicker effect with an Arduino.
I used "Circuit 02" from the Spark Fun kit which uses 8 LED's - while the Instructable project used only 3. I adapted the code* to accommodate the extra LED's and it worked perfectly. Next I constructed a prototype shade to diffuse the light using a piece of paper, reflective material taken from a drink box, and some metal wire to form the top of the shade. Luckily, the wires and resisters hold the shade in place at its base perfectly - at least as perfectly as you'd want in a prototype.
The next step is to develop a process to make Arduino experiments into finished products - fully functional, permanent prototypes. Of course, unless it was absolutely necessary, you wouldn't want to encase your Arduino into a finished product unless it was something like a robot or large automated system. In the case of an electric candle light, it would be practical to use a smaller and much cheaper microcontroller. Make Magazine recently did a video and article where they explained the process of using an Arduino and its development environment to program an ATtiny45 or 85 chip - this was in turn based on an MIT tutorial which can be found here.
This Make Magazine video is quite interesting and I thought I would include it here. The number of pins might limit my design down to a certain number of LED's - this all remains to be seen.
I've chosen a coconut to serve as my light fixture - they are omnipresent in Thailand, sturdy, interesting to look at, and easy to work with. Until I can source an ATtiny chip and do a test run on a breadboard, I'll just have to settle with this conceptualization I did in SketchUp to show readers where this project will go next.
Here's what the prototype looked like after adapting the Instructable's design by Mike (Earthshine) to use 8 inline LED's and a paper shade. The flickering effect is very subtle which is exactly why it is so effective. It actually looks like the light cast by a flame - not blinking lights. |
****
* Here is the code I used with the SparkFun Circuit02 setup:
// LED Fire Effect
int ledPin1 = 6;
int ledPin2 = 7;
int ledPin3 = 8;
int ledPin4 = 9;
int ledPin5 = 2;
int ledPin6 = 3;
int ledPin7 = 4;
int ledPin8 = 5;
void setup()
{
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
}
void loop() {
analogWrite(ledPin1, random(120)+135);
analogWrite(ledPin2, random(120)+135);
analogWrite(ledPin3, random(120)+135);
analogWrite(ledPin4, random(120)+135);
analogWrite(ledPin5, random(120)+135);
analogWrite(ledPin6, random(120)+135);
analogWrite(ledPin7, random(120)+135);
analogWrite(ledPin8, random(120)+135);
delay(random(100));
}