![]() |
![]() |
![]() |
![]() |
| This project came to life after I bought an LED candle from Brookstone. First of all, it was $30. Ouch. Secondly, the flame was not very realistic. It was not very bright, so it was hard to see. Also, it did not flicker like a real candle but sort of faded in and out. I decided to make my own. This ended up being a pretty simple project and the total cost was around $6 (not including batteries.) |
| As you can see from the schematic, it is a very simple design: |
![]() |
| As you can see, the candle is run from a PIC12F675. This is an 8 pin microcontroller with 5 I/O lines. I decided to run the candle from 4 AA batteries, giving me a 6 volt power supply. The battery holder provided a nice base to help the candle remain upright. Because the PIC requires 5 volts, I added a 1N4148 diode that has a 1 volt voltage drop, thus providing me with 5 volts. I used five 15,000mcd LEDs (very bright) to give me a bright flame. This makes the candle much brighter than my storebought candle. I also used 5 LEDs as it gives a much more realistic flame, looking more "flickery." Here is the total bill of good: |
| 1
x PIC12F675 1 x 1N4148 Diode 5 x 15,000mcd, 5mm high powered LEDs 1 x 4 AA battery holder |
| As you can see from the pictures, I placed the 5 LEDs around the PIC and stuck them on top of the battery holder. This design made the candle quite thin to fit inside a candle holder (although it is a touch tall which I will address shortly). |
![]() |
![]() |
| I did not use a custom board as it was a fairly simple design. Here is a (blurry) picture of the bottom: | ![]() |
|
The code for
this is fairly simple except for one thing you may not be familiar
with. In order to make the candle appear random, the PIC has to come up
with a random sequence. This is easier said than done, as the PIC is a
digital device. I used a Linear Feedback Shift Register. I had to do
quite a lot of research on this as I knew very little about it. It is
quite an interesting topic, but one too long for this article. I
encourage you to do a search if you are interested. In the meantime,
rest assured that the LFSR sequence in the code creates a pseudo-random
sequence, not repeating for quite a while. Here is the code (and it can be downloaded at the end of this article): |
#include
<pic.h>
|
| One last thing I wanted to mention. The candle is reasonably high, so fitting it into a small glass candle is hard. I simply put the unit behind something and the light reflects off the walls and ceiling. I also bought a frosted vase that I put it in and it works great. But for people who would like a smaller unit, you can replace the 4 AAs with a mini 6v battery. They can be bought from Radio Shack or online. Here is a picture comparing the sizes. Obviously it makes a big difference if size is a concern: |
![]() |
|
Finally, if you would like to download the source code and schematic,
you can get it here. And if you have any questions or comments, please send them here. ENJOY. |
UPDATE: A reader, Alexander, has posted some pictures and a video of his own LED candle. Check it out. |