How to Build a 5 Channel Flame-less LED Candle Simulator




Introduction: How to Build a 5 Channel Flame-less LED Candle Simulator

This Instructable explains how to construct and modify a 5 Channel "Flame-less" LED Candle driver.

Our hackerspace "The Rabbit Hole" is having a pumpkin carving night and we wanted to try something different to light the pumpkins. So I came up with this Flamless LED candle that uses an inexpensive IC and parts but simulates the random flickering of a candle. 

When complete this circuit emulates the flicker of a candle including random "wind / draft" events of fast dim flickering. The 5 LEDs flicker at different rates and intensities allowing you to drive 5 individual candles with a course effect, one candle with a smoother effect, or any combination in between. 

The first part of this Instructable goes over kit construction which are available from at [add link to store here]. If you wish to build a unit from scratch all the design data is available at

The second half of the Instructable goes over the circuit operation and firmware in greater detail. 

Here is a video of the prototype circuit running on my bench. 

And here is a demo of the final kit set up in a jack-o-lantern pumpkin.

Step 1: Required Materials for the Flame-less LED Candle Simulator

To construct this project you will need the following:

Step 2: Before We Start, Some Math!

There are generally 2 items that folks may want to swap out in the kit. 
  1. power supply
  2. LEDs
If you're just going to use the parts supplied in the kit you can stop right here and proceed to the next step.
If you're going to change power supplies and/or LEDs read on since this will affect the value of the LED current limit resistor. 

For the power supply your main options are either batteries or an AC to DC adapter. 
  • If using an AC to DC adapter choose something in the 3.5V to 5.5V range.
    The higher the better for this application. Especially if you're going to use blue or white LEDs (due to their high forward voltage they may not operate at the lower end of the range) 
  • If using batteries the range moves to 4.5V to 6V. 
The micro's recommended operation range is up to 5.5V but the maximum limit is 6.5V. Batteries start slightly above their listed voltage but quickly drop their output voltage as they discharge. To maximize the battery life and brightness we are pushing the micro slightly higher than recommended but below it's maximum when the batteries are fresh. The batteries will quickly drop into the recommended range after running for a bit so should not significantly affect the operation or life of the micro. If you're using rechargeable batteries then this is a non-issue since they will start out under 5.5V on a fully charged pack. 

The other thing to consider when picking your power supply is the current draw of the circuit. The largest load is the LEDs. The easiest way to estimate circuit current draw is to take the LED current (see next section) multiply by 5 and add 50mA. If using a AC-DC adapter make sure it's output rating is greater than this number. If using batteries see notes in the next section. 

If you want to swap out the LEDs, consider the following:
When you pick your LEDs, water clear lenses tend to be brighter and more focused in one direction. The only real restrictions are the output voltage of the power supply and the max current limit of 200mA per LED. 
When looking at the LED data sheet there are 2 numbers you will need for the next section. 
  1. Forward voltage minimum / typical (Note: verify that the max voltage plus 0.6V is less than your power supply voltage)
  2. Forward current recommended max (continuous NOT pulsed / peak)  
Generally you will want to run the LEDs at the max current to get the brightest output. But this will shorten your battery life (if using batteries). To extend the life of battery power either reduce the LED current (change the limit resistor) or go with bigger batteries (4x C, 4x D, or even a 6V lantern battery).

To set the LED current limit resistor value use the following formula:
Rled = (Vsupply - Vfled) / Iled
Rled = resistor value in ohms (ALWAYS round up to the next standard value)
Vsupply = voltage of your power supply
Vfled =  Forward voltage minimum / typical of your led
Iled = max continuous led forward current in A (note 1000mA = 1A)

In the current kit we have the following values
Vsupply = 6V (battery power) 
Vfled = 2.1V
Iled = 50mA => 0.05A
(6 - 2.1)/0.05 = 78 Ohms
78 Ohms is not a standard 5% resistor so round up to the next standard value of 82 Ohms. 

Step 3: Begin Kit Assembly: Check Your Kit!

First thing to do is unpack your kit and verify all the parts are included. 

The kit should include:
  • 1x pic12f508 (programmed)
  • 1x 100uF 16V cap
  • 1x 0.1uF 50V cap
  • 5x 2N3904 transistor
  • 3x Yellow LEDs 5mm15deg
  • 2x Red LEDs 5mm 15deg
  • 5x 82 ohm resistor 5% 1/4W (gray, red, black, gold) 
  • 5x 1k ohm resistors 5% 1/4W (brown, black, red gold) 
  • 1x Battery holder
  • 1x 8 pin dip socket
  • 1x PCB

Step 4: Install the Micro Socket

Install the micro socket as shown in location IC1.
Note the small notch in the socket!  Make sure it matches the notch in the silk screen (down when holding the PCB as shown) This has no affect in the circuit operation but makes installing the micro later easier. 

Solder the socket in place 

Step 5: Install the 0.1uF Capacitor

Install the 0.1uF cap as shown in location C2. 
Note this cap is NOT polarized and can be installed either way. 

Solder the cap in place and clip the leads off

Step 6: Install the 1k Resistors

Locate the 1k resistors (brown, black, red, gold) and form the legs as shown in image two.

Next install 5 1k resistors in locations R3, R4, R5, R6, R7 as shown. 

Solder the resistors in place and clip the leads off

Step 7: Install the LED Current Limiting Resistors

Locate the LED current limit resistors (82 ohm (gray, red, black, gold). if using the parts provided in the kit.) and form the legs as shown in step 4.

Next install 5 LED current limit resistors in locations R8, R9, R10, R11, R12 as shown.

Solder the resistors in place and clip the leads off

Step 8: Install the 100uF Capacitor

Next locate the 100uF capacitor. 
Note: this device IS polarized and must be installed as shown. The - lead is marked on the side of the cap and is the shorter of the two leads.
Install the cap in location C1 with the - side to the center of the PCB as shown. 

Solder the cap in place and clip the leads off

Step 9: Install the Battery Holder

Locate the battery holder and strip the wires approximately 1/4" long, then "tin" them (coat the stripped wires with solder). 

Install the wires as shown into CN1 (black - to the inside of the PCB, red + to the outside of the PCB)

Solder the resistors in place and clip the excess off.

Step 10: Install the Jumper in R1

Warning, sorry but the LEDs in the picture are out of sequence, please ignore that 

Take a resistor leg trimming and bend it into a U shape. 

Install the resistor leg into location R1 as shown. 

Solder and trim off the excess. 

Step 11: Step 9 Install the LEDs

!!!NOTE!!! at this point the PCB will become ESD sensitive. Take care not to zap the card or components with static electricity, or you may cause damage. 

Locate your LEDs and identify the cathode (-) pin of the LEDs. The negative pin has the shorter leg and you'll notice the flat on the body. 

The standard kits include 2 Red and 3 Yellow LEDs. Installation location has no affect on circuit operation. But for best visual effect place one red LED on either end of the PCB surrounded by the yellows. 

Install the LED with the cathode (-) side on the inside of the PCB next to the current limiting resistor, as shown in locations LED1, LED2, LED3, LED4, and LED5. 

Solder in place and trim off any excess.

  • When installing the LEDs lift them off the card by ~1/2" before soldering. This will allow you to aim the LEDs by bending them. If mounted flush on the PCB, you will not be able to adjust their angle and can end up with 2 distinct spots of light. 
  • To minimize mounting space when embedding in a candle, mount the LEDs on wires, then attach the wires to the PCB. The Anode (+) side of all the LEDs is common so only a 6 conductor cable is needed. This will allow you to remotely mount the PCB and have a minimal foot print of just the LEDs in the top of the candle.  

Step 12: Install the Transistors

Locate the 5 2N3904 NPN transistors and install them as shown and locations T1, T2, T3, T4, and T5. 

Note they are polarized and the flat side of the transistor case needs to match the flat side on the silk screen. 

Step 13: Install the Microcontroller

Locate the PIC12F8508 micro controller.  

If you're using the controller from the kit, it's already programmed with the firmware. 
Make sure to remove the aluminum foil protecting it during shipping (see photo 2).

If you're not using the controller from the kit, you'll need to program the firmware. 

Install the micro into the socket added earlier.
Make  sure the notch in the micro matches the notch in the socket and more importantly the silk screen on the card.
Installing the micro backwards WILL DAMAGE it.
You may need to bend the legs in slightly to get the micro-controller to fit into the socket. 

Step 14: Testing the Flame-less LED Candle Simulator

Install 4 fresh AA batteries in the battery holder. 

If everything is assembled correctly all the LEDs should light brightly with a slow flicker.
After a few seconds the LEDs should dim and run with a fast flicker for a few seconds before returning to slow bright flicker. 

If this checks out your LED candle is ready for use.  

If for some reason things are not working right, check the following:
  • If you get a dim slow followed by a bright fast flicker, check the jumper is installed in R1 and that R2 is open (output active level select) 
  • If you have 1 or more LEDs not lit (but at least 1 lit), check the orientation of the non-functional LED and transistor (they are polarized and must be installed correctly).  Also check and for general solder defects (opens shorts).
  • If none of the LEDs are lit, check that the micro is installed correctly, has been programmed, that the battery pack is installed correctly, that the batteries are good, and also check for general solder defects (opens shorts).

Step 15: Flame-less LED Candle Simulator Circuit Descripton

Electrically this project is relatively simple. 

Battery holder CN1, and Caps C1, and C2 make up a unregulated power supply feeding everything else. 

The PIC micro IC1, R1, and R2 make up the brains of the circuit. Most of the function is just firmware running on the micro. 
R1 and R2 set the active output mode. When R1 is populated the outputs are high when the LED should be on. When R2 is populated the outputs are low when the LED should be on. For the application in this kit R1 should be populated for active high outputs. 

There are 5 identical LED driver channels. The first is made up of LED1, R8, T1, and R5. 
LED1 and R8 are the LED and it's current limit resistor. The current limit resistor is chosen based on the LEDs forward current limit and how bright you want the LED to be when running. See slide #2 for more information. 
T1 acts as a power driver for the micro. It takes a low current (~6mA) signal from the micro and allows it to drive up to a 200mA load. R5 is the base current limit resistor for the transistor. Normally this will not need to be adjusted. 

Step 16: Flame-less LED Candle Simulator Firmware Description

The source for the firmware (as well as the binary images for programming) are available at

There is extensive documentation in the source on how the firmware works in detail so will only go over the high points here. 

This project uses a pic12F508 this particular micro has very little in the way of hardware peripherals. In fact it does not even have interrupts and only has a single hardware timer / counter. This particularly made generating PWM signals difficult. The main reason I chose this micro was I had stock on hand and their low cost. 

The datasheet for this part can be found here:

The core components of the firmware are the 5 LFSR PRBS generators and the PWM engine. To generate the maximum amount of random flicker with the limited resources I had I decided to set up 5 identical Linear Feedback Shift Registers Pseudo Random Bitstream Generators. Each one is 16 bits long and starts with a unique seed. The unique seeds are important since the generators are NOT truly random and they will repeat after a given amount of time. If they all started with the same seed the 5 channels would be in sync and not produce as nice of a flicker.  To maximize the randomness between channels the low order bits are used to set the brightness of that channel and the upper order bits of the previous channel are used to set the dwell time this brightness level will be held. The LFSR is only updated to the next value when a new brightness level is needed. So by using another channels generator to set the Dwell time the individual channel patterns should shift over time with respect to each other. 

The other function in the code is a "wind" mode. This at a code level is a random event that last for a random duration. When a wind event is triggered the code picks 2 new numbers from the existing LFSR one is used as the duration of the event and the other is the delay before the event triggers again after it finishes. During the wind event the only real difference in the PWM code is the masks applied to dwell time and the brightness value. For the "normal" mode they are set up to produce a bright and slow flicker. During wind mode the masks are adjusted to produce a dimmer and faster flicker. 

As stated earlier there are no interrupts or  peripherals available on this micro other than a single timer. To  implement the 5 channel PWM generator I first set up timer 0 to be a counter running slow enough that I could execute all the instruction needed to update the LFSR before the next count but fast enough that the dimming was smooth to the eye. In the main loop there is logic that does one of two things with the timer. First if the timer rolls over to 0 it turns on all the outputs. Second it compares the count to the individual channel brightness levels. If the level is lower than the current count it turns the channel off. 
This method worked well for this application but is not without drawbacks. The main drawback is since the timer count must be slower than the time your update instructions take it would not work well on large complex programs (or the PWM would be very grainy). 

Make It Glow Contest

Participated in the
Make It Glow Contest

Halloween Decorations Contest

Participated in the
Halloween Decorations Contest

Microcontroller Contest

Participated in the
Microcontroller Contest

Be the First to Share


    • Big and Small Contest

      Big and Small Contest
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • For the Home Contest

      For the Home Contest



    6 years ago

    I made up a set of these for Halloween, they worked great! My daughter wanted one for her bedroom, and as such, I made a simple lamp using Dollar Tree poster board and tissue paper as a diffuser. She absolutely loves it. Thank you for sharing your project.


    9 years ago on Introduction

    You know, with a cheap mic, you could use it to trigger and change the wind mode based upon the input signal level. More input equals less light, could even place a threshold where if you blew hard enough it would switch off.


    Reply 9 years ago on Introduction

    Yep that idea has been brought up before. The micro used in the current design is very very basic does not even have interrupts. Upgrading to a different part with a analog input would make implementing the sound input easy.


    Reply 9 years ago on Introduction

    Ah. I suspected that some "bright" soul had probably already come to a similar conclusion, probably yourself. I really, really like this. I'm considering making a very realistic candelabra for my mother using realistic looking polymer/resin cast candles, hand turning brass or pewter candle holders and routing a very elegant base from a rich wood, then finding a way to use your design to drive a display to very closely mimic candle flames. She currently keeps a low cost 110v incandescent bulb unit in our front bay window all year round. There is very strong symbolic meaning and sentiment for her in doing this. The lights are a path for her four lost grandchildren, so that maybe in time, they will see the light in the darkness and return home to a safe haven. Even after seven years she believes that one day my children will come home... I'd like to do something that looks realistic, will last nearly forever, and get rid of that cheap plasticy power wasting eyesore and replace it with something of beauty. Something that might fool the observer, or at least captivate and invite questions. But more importantly, equal in beauty the desire she holds in her heart.


    9 years ago on Introduction



    Reply 9 years ago on Introduction

    Sorry no due to the laws of thermodynamics that is just not possible. Even if you assume everything else is a ideal device (ie no losses due to switching or heat) at the very minimum your loosing energy in the form of light being emitted by the LEDs. So over time the net energy of the system is going down. If your looking to extend the life of the batteries the best way to do that is to either use less LEDs or set the led current to a lower value. The kit described here what set up to yield the brightest output for maximum pumpkin illumination.