Introduction: Realistic Flickering Flame Effect With Arduino and LED's

About: Hi, my name is Mike and I am from London, England. I really like to make things and in particular like to do creative things with Arduinos and electronics. Other hobbies include astrophotography and sailing. C…

In this project we will use 3 LED's and an Arduino to create a realistic fire effect that could be used in a diorama, model railway or a fake fireplace in your home or put one inside a frosted glass jar or tube and no-one would know it wasn't a real candle inside.

This is a really simple project suited to beginners.

Step 1: Step 1 - Wire Up the LED's

Wire up 3 LED's. Use 2 x Diffused Yellow and 1 x Diffused RED. You can increase the number of LED's if you wanted a larger or brighter display. Consider the use of transistors if your amperage will go over that which can be supplied by the Arduino.

Use resistors that suit your particular type of LED.

Step 2: Enter the Code

Enter this code:

// LED Fire Effect

int ledPin1 = 10;
int ledPin2 = 9;
int ledPin3 = 11;

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);
delay(random(100));
}

Step 3: Upload and Run

Upload the code to the Arduino and run it. You will now have a pretty realistic flame/fire effect from the LED's. Bounce the light off a white card or a mirror to achieve the full effect.

Step 4: Video of the Effect

Video of the effect. The colours and the effect don't show up very well in the video. In real life it is a very effective flame effect. Give it a try.