Introduction: Flickering LED Candle
Step 1: Equipment
- Arduino Uno or Arduino Duemilanove with ATMega328 and breadboard to program the ATTiny85 microcontroller.
- Soldering equipment
- Hot glue gun
- Utility Knife
- Drill with spade bit
- ATTiny85 microcontroller. Other ATTiny variants will probably also work but this is the one I used.
- 8 pin microcontroller socket (optional)
- Orange LED.
- 1 ohm resistor. This value is calculated based on the use of a 3v power supply and LED with 3v - 3.2v forward voltage.
- Screw terminal (optional)
- Small piece of proto board
- 3v battery pack and AAA batteries.
Step 2: Program the Microcontroller
I'm a programming novice with basic knowledge of C and Java. With my limited experience, I find coding using the Arduino environment simple and productive so I wanted to use one for this project. An Arduino is too large and expensive to install in the candle to control the LED flickering therefore an ATTiny85 microcontroller will take its place as they're only a few dollars and capable of the task. Thankfully, I can use an Arduino to program the ATTiny85 which allows me to write the program in the Arduino code that I'm comfortable with and I don't have to purchase an AVR programmer.
I've written the LED flickering sketch in the Arduino 1.0 software and used an Arudino Uno to program the microcontroller. High-Low tech have written some excellent articles on using the Arduino to program an ATTiny (Arduino Board as ATTiny Programmer, Programming an ATTiny w/ Arduino 1.0). My flickering LED sketch is attached to this instructable step. The LED pulses in sets. The program randomly selects the amount of pulses in each set, alternates the brightness level of each pulse and delay between sets. Values can be adjusted to change how it will behave so customise to your liking. It does the job but I'm sure there's improvements to be made. If any one can make any advancements, just send me the code and I'll update the instructable.
Once programmed, test that all is well by removing the Arduino. Adding an LED and 1 ohm resistor to Pin 5 (referred to as Pin 0 in the Arduino sketch). Connect a 3v power supplies positive to pin 8 and negative to pin 4. The LED should periodically flicker. I also tested mine using the Arduinos 5v supply and a 150 ohm resistor on the LED.
Step 3: Carve a Candle
Take care when working with the candle as they're easy to damage. Lay a rag on your work surface to protect the candle and allow removed wax to be easily disposed. If you watched the video, it's pretty obvious I should have used a bigger rag when boring the hole with the spade drill bit. Wax went everywhere!
Drill out the base using a spade drill bit to accommodate the height of the circuit board and battery pack. This was about 25mm for my project. You'll then need to carve out a snug fitting battery compartment to insert the pack. Wax is fairly soft so just take it easy and don't lose a finger. The battery pack will be a friction fit and responsible for holding the circuit board in the cavity we created with the spade bit.
Remove the candle wick and drill a 4mm hole to allow the LEDs wires to pass through.
Step 4: Prepare Components and Build Circuit
Assemble the circuit as per the diagrams included in this step. I've added schematic and pictorial style circuit diagrams. Using a socket for the microcontroller is optional however it will prevent you from accidentally destroying the IC with the heat from your soldering iron and allows you to update or modify its code down the track by simply pulling it from the board.
Solder some wires to the legs of the LED and insulate them with some heat shrink tubing or tape.
Step 5: Install Components
Thread the LEDs wires through the top of the candle and connect them to your circuit board. Insert some batteries and ensure it all still works and is connected correctly. Place the circuit board in the cavity and slot the battery pack into its socket to seal it all up. As mentioned earlier, the battery pack should fit firmly. If not, you made need to add a little padding to fill the gaps and get a tight fit. I secured the switch to the side of the battery pack with some hot glue to finish it off.
To make the LED look more at home on the top of a candle, add small dobs of hot glue and shape with a toothpick until you've built an imitation hot glue flame. You're done! Build your own customised candles like the three candle coffee and chocolate version shown in the intro of this instructable.