Introduction: YAFLC (Yet Another Flickering LED Candle)

Picture of YAFLC (Yet Another Flickering LED Candle)
There are numerous posts on Instructables about how to make a flickering LED candle. This is my version.

The project requires the following components:
1. Tiny45 AVR Microcontroller (Tiny13 would also do)
2. 1W Warm white (or yellow) LED
3. Perspex tube
4. AA or AAA size batteries- 4 (alkaline or NiMH)
5. PCB stock (or a general purpose veroboard)
6. Battery holders
7. 1/4W resistors 50 Ohm- 4 and 10K -1.
8. On/Off switch
9. Connecting wire
10. piece of wood for the base
11. masking tape

1. Solder iron and solder
2. Hot glue gun
3. AVR ISP Programmer
4. screwdriver, files, drilling machine and suitable drilling bits.

Step 1: The Circuit Diagram

Picture of The Circuit Diagram

The required circuit diagram for the candle is here. Also seen is the board layout. In the board layout, the blue tracks are handled as jumper wires. The complete circuit is split in two boards, one containing the controller and the has the 1-W LED. The two boards are arranged in a double-decker, circular PCBs. The idea is to have a smaller total diameter for the circuit. four 2-pin connectors are used to connect the controller board to the LED board. The fifth connector on the controller board is for the power supply.

Step 2: Making the PCBs

Picture of Making the PCBs

I used Modela Milling machineModela Milling machine to mill and cut my boards. You can get these boards fabricated from commercial PCB manufacturers such as PCB ExpressPCB Express or you can even make them at home as described herehere.

Step 3: Soldering the PCBs

Picture of Soldering the PCBs

I soldered all the components as seen in the photographs. By distributing the circuit on two boards, one for the controller and another for the LED is not only useful in reducing the diameter of the board but also to ensure that when the controller board is programmed through the ISP connector (by first disconnecting the LED board from the controller board), the LED does not load the ISP signals.

I soldered all the SMD components first, followed by the jumper wires and then the rest of the components.

Step 4: Prepare the LED Board

Picture of Prepare the LED Board

After the LED board is soldered, I used hot glue gun to pour some glue on the LED. As the hot glue begins to cool, I draw the glue out as a sort of a 'wick'. The glue serves two purposes: it diffuses the light and the 'wick' gives a feel of a real candle.

Step 5: Program the Controller

The code for the project is really very small. Code compiled with AVRGCC. The code was programmed into the controller through the ISP connector on the controller PCB.

/*Code for a flickering candle project*/
/*Connect a 1-W Yellow/Warm White LED on */
/*Pin 2 - PB3 <-- 50Ohm R --> LED Cathode*/
/*Pin 3 - PB4 <-- 50Ohm R --> LED Cathode*/
/*Pin 5 - PB0 <-- 50Ohm R --> LED Cathode*/
/*Pin 6 - PB1 <-- 50Ohm R --> LED Cathode*/
/*Pin 7 - PB2 <-- 50Ohm R --> LED Cathode*/
/*LED Anode to Vcc
/*Set max current to be 30 mA for each LED*/
/*LFSR Source:*/

unsigned long lfsr = 1;
unsigned char temp;

lfsr = (lfsr >> 1) (-(lfsr & 1u) & 0xd0000001u); /* taps 32 31 29 1 */
temp = (unsigned char) lfsr;

DDRB= ~temp;
PORTB = temp;

temp = (unsigned char) (lfsr >> 24);


Step 6: Building the Enclosure

Picture of Building the Enclosure

A 6-inch long, 2.2 inch wide perspex tube was chosen to enclose the candle. A wood pedestal was machined to mount the perspex tube. The controller PCB and the LED PCB was installed inside the tube on another 'holder' PCB which also has the On/Off switch.

Step 7: Candle Pedestal

Picture of Candle Pedestal

A wooden candle pedestal was machined. The two battery holders, each with 2 x 1.2V Eneloop ( :) ) batteries were mounted on the pedestal and held together with hot glue.

Step 8: Wrap Up

Picture of Wrap Up

Finally, the perspex tube was covered with yellow masking tape to hide the insides and also to give an illusion of a wax candle...maybe I will paint it later..

But this is how it stands now.

I enjoyed building the candle, hope you would too...


eraticus (author)2013-09-23

The code listing is hosed, at least when viewed on my computer. However, it corresponds to the code listing here:

drgabler (author)2009-02-18

Trying to compile the code you listed but it does not compile. Error: candle.c:11: error: called object lfsr >> 1 is not a function. Any thoughts? Also your code comments dont jive with your pcb. PCB LED PCB has SL1 being the cathode while 2-4 are the anodes. CODE says 1-4 are cathode and anode is just direct hooked.

drgabler (author)drgabler2009-02-18

seems that instructables buggered the code when you posted it. the shift 6 got translated to exp. Fixed and now it compiles.

About This Instructable




More by Gadre:Instant Noodles OmeletteHow To Make an Illuminated LED Eye LoupeFire-free LED Matchstick
Add instructable to: