Instructables

Need a LED circuit to simulate candle


Hey guys, I'm hoping somebody here can help me out. I'm a newbie when it comes to electronics and whatnot. I can read basic electronic schematics (I know symbols for resistors, LEDs, ground, etc). What I'm wanting to do is create some Halloween decorations for my niece and nephew and their friends, which is basically a hand held lantern that has flickering LED's behind frosted glass to give the appearance of a flickering candle. There are several nice instructables I've found here that cover LED flickering, but at most they're dealing with things I'm not really comfortable with (555 timers and other IC's, programmable chips that use hex coding, etc).

The effect I'm looking for is a red LED that doesn't flash along with a orange and yellow LED that do flash to give the appearance of a flickering candle flame. I've found a few places that sell these kinds of kits, but I'd only prefer to buy them as a last resort. Since I'm building several of these lanterns by hand, it would really be easier if I could buy several parts (LED's, resistors, caps, etc) and put them all together myself to save money.

As I understand it, you can vary the values of the caps and resistors to get not only varying times of flash, but also a fade in/out effect. I think using a 555 timer would probably be easiest to get random flash patterns for the yellow and orange LED's. I'm not opposed to using a 555 timer, it's just I've never used one before and it's been difficult looking at the instructables here that feature 2 LED's that flash or 40 LED's flashing and trying to figure out how I add a solid non-flashing LED into the mix.

Would it be simplest to simply buy a flashing orange and yellow LED and then use a cap and resister of varying amounts attached to a battery along with the non-flashing red LED to achieve this affect? Or would it just be simpler to use a 555 timer with two regular LED's to make them flash, and then wire the red LED I don't want flashing outside of the timer's circuit (I guess parallel to it so it still runs off the same battery?).

I had considered using 5mm LED, though I'm honestly not sure how bright these would be. I'm not wanting the room to light up like the ceiling light was turned on, but bright enough to definitely be noticeable. I'd also prefer to either run these off of a 9v battery for mobile use or wire up a 12v DC adapter to it for a more permanent solution.

I've seen a few sites that offer "single flasher led" schematics, but again, I just don't know how to add another LED to that circuit to have two that flash at different intervals as well as how to add a third LED to it that WON'T flash. I've also seen people use the modified LED tea candles, but again, that is a single LED and I just don't know how to combine that with another (or 2+) LED's in a circuit so they all operate safely off of the same power source.

If anybody could lay out the diagram for the three LED's (or if you think it would be brighter to use 2 of each of the 5mm LED's I want to flash for a total of 5 LED's) along with either the r/c circuit or the 555 timer circuit, I'd greatly appreciate it. Like I said before, I've scoured through all of the flashing LED tutorials here, and while they're all really great, there aren't really any that fit my needs and because I'm a novice with this, I don't know how to take the information that's given and apply it to my needs :(. Maybe I need layman's terms for the setup lol.

I'm sorry if this is all long winded and a long read, I just wanted to supply as much info as I could to make sure I was (hopefully) understood fully :)

bazalaz2 years ago
are you trying to pull some one over? then ...no
lasersage3 years ago
OK I'm still not exactly sure what you're after, and I've assumed you don't know a great deal of electronics so please excuse me if any of it is patronising. Hopefully it'll be some use.

It seems you want some LEDs on permanently and some to flash.
In the circuit I've diagram I've uploaded you can see 3 different scenarios: one using resistor A, one using B and one using C.

LEDs require a current limiting resistor to stop too much current flowing and burning them out. When forward biased (put in the correct way round so they light up) they appear as almost a dead short. They commonly drop around 2V at a maximum of 20mA. If you connect say 5V or 9V even to the supply rails (red and blue, positive and negative) then too much current will flow and the LED will burn out after very little time. Some flashing LEDs don't require current limiting as they have built in resistors.
So for example, 9V on positive, 0V on negative, the LED drops 2V this leaves 7V to be dropped by resistor A. We'll aim for 15mA to make the LED a little dimmer and ensure that we don't overdrive it and burn it out, not much over 20mA kills them quick. Using Ohm's Law: R = V / I  means that 9V / 0.015A  =  9V / 15mA  =  600Ohms
so a 600Ohm resistor in place A would be appropriate for a 9V supply.

Resistor B however is different as there are two LEDs in series. Each drops 2V (a total of 4V) leaving just 5V for resistor B to drop. 5 / 0.015 = 333Ohms. Don't worry that there isn't a 333Ohm resistor just go with the nearest value you can get

Finally we have the flashing circuit.

All three circuits using resistors A, B, and C, are in parallel. This means they can each draw as much current as they need, separately.
So fiddling with B shouldn't effect A, like fiddling A shouldn't affect B.

The flashing circuit I've simply shown as a block as it could be a 555 or microcontroller or other method. If you use a chip, atmega328, 555 etc. it can output enough current for an LED or two. No more than that on a single output from a chip or you'll need a current amplifier such as a transistor. Chips commonly run on 5V and give out 5V. Hence for a 5V output, 2V across the one diode leave 3V for resistor C, 3 / 0.015 = 200Ohms is all that is needed for resistor C.

I can't think of a way to use resistors and capacitors alone. Usually you allow a capacitor to charge through a resistor, which takes a little time. But once charged it remains charged and will not discharge until the supply voltage is removed. A 555 does this, charges, then discharges. 555s can be run in a number of ways but I believe you're looking for an Astable circuit meaning no stable states. i.e. it will constantly oscillate (flicker). Other circuits available with 555s can be bistable (two stable states) or monostable (one stable state).

Me personally. I'd go with the microcontroller route. Gives the best control, easy to tweak settings in programming rather than physically replace components and they need not be expensive. I bought one arduino once and now use that one board to flash and program chips and generally run my chips on standalone, DIY type boards. All you need is the chip, a resonator and couple of resistors. It really is that simple, comes to about £5 a board. Have a look at standalone boards here.
Arduino are very supportive, have great forums and is an easy place to start.

Sorry that's a massive post. Good luck
LED circuit.GIF
SmokeGSU (author)  lasersage3 years ago
*Mini-Update*
So I've pretty much spent all day researching and reading up on Arduino technology and it's amazing all the things you can do with it. Looking through some code snippets here and there, it really doesn't seem that much different from the coding I've done in Java.

lasersage, or someone else, if you could just clarify for me, once you use your Arduino module (such as the Uno) to program a microcontroller chip, you're essentially done with it right? It's no longer needed for the circuit to function correct? I'm assuming you use ex. Arduino Uno to program a microcontroller chip and then you just put that chip into the circuit with LEDs, resistors, and a power source (and whatever else might be needed) to make a functioning circuit, whereas the microcontroller will function like any other IC or 555 timer in a similar circuit.

The only reason I ask for clarification is because pretty much every example I've seen, or video on YouTube, the user runs his circuit with the Arduino Uno (or similar programmer) in the circuit seemingly without using a microcontroller chip other than the (I'm guessing) built in one. This is the part that had been confusing me as to whether I'd need to buy several of these $30 Arduino programmers for each individual circuit to run, or if these people are just not taking the time to program an individual chip and put it in the circuit instead.

So again, just for clarification, the Arduino Uno/Mega/etc are JUST the programmer (kind of like Eclipse or Visual Studio) and CAN be used in a circuit, but their main purpose is to program individual chips (which act similar to an exe file that was created in Eclipse or VS) and tell the circuit how to behave. Right?
OK I'll try and answer each point.
Arduino boards, Uno or Duemilanove (the one I use, italian for 2009) are £20 to £30. You can buy many of these and simply plug in your components around them. Alternatively you can buy one proper board, then a bunch of the chip it uses. Its an ATMEGA328p on the Duemilanove. You can buy these ready flashed with the Arduino bootloader (easiest option) for about £3 or £4 each. If you buy blank ATMEGA328p chips you save about 50p but have the hassle of reconifiguring your board to flash the bootloader. I do buy blank and flash them as I can get them quick and cheap, but when I started out I bought preloaded chips. Incidentally one chip I bought from proto-pic.co.uk came with UNO bootloader (I'm sure I specified Duemilanove) so I was glad to have the ability to reflash it with the correct bootloader for my board.
Bootloader is basically a little program that sits on the chip and allows it to work with the arduino board (Duemilanove in my case) and the arduino language (practically C). If you didn't have a bootloader you'd have to do HEX programming etc. Beyond my understanding at this point.

I use the chips standalone fashion. So I place the new, blank but with a bootloader pre installed ATMEGA328p onto the Duemilanove board, program it with a USB cable over the arduino environment, then unplug it and plug it into the standalone board. The standalone board requires a 5V supply to the correct pins, the reset pin pulling high with a 10K resistor, and a crystal to clock the chip (I use a resonator which includes capacitors, a bare crystal needs a couple of caps to make it work).
I'm attaching an example standalone circuit. The LED from pin 20 to pin 22 is always on. The chip requires power (5V) to pin 20, and earth/negative to pin 22. It just seemed an easy place to tag the LED on to show you, but you could equally connect the LED from the positive supply to the earth anywhere else. Just watch out if you do it before regulating to 5V if your using a higher voltage supply. You can do it that way but would need a different resistor.
The LED from pin 15 to 22 will require the chip to give it a voltage on pin 15. This will need programming. I've chosen pin 15 as it is PWM pin meaning you can use pulse width modulation for this pin. I believe that is used in some LED flicker circuits.
The arduino/ATMEGA really is overkill for this application but as I said at the start I find reprogramming a chip quicker and easier than substituting components to alter on off time for the LED or similar changes.

Your other circuits look viable. The 555 ones look good, as does the borrowed fake candle circuit. If you can LEDs always on in addition to these flickering ones you simply need to wire them across the supply with a suitable resistor just like in my first post. For example, wire up an LED with resistor A across the supply, and also wire up the flashing circuit and LED with resistor C. That gives you one always on and the flashing circuit. That's what you want right?
arduino.bmp
SmokeGSU (author)  lasersage3 years ago
lasersage, you are indeed my hero! Thanks so much for all the time and effort you've put into explaining everything. Since yesterday I've been absorbing as much information as I can on Arduino and programming them (or trying to get a better understanding for the process, at least). It really seems that you're only limited by your imagination and it seems there are so many tutorials and resources for doing various things.

You definitely answered my original questions I had concerning using either a 555 timer or the circuits from flameless tea candles. Now that you've answered that question and it seems to be the easier route to take (and maybe quicker/cheaper), I've got to say I'm really becoming fascinated with this Arduino technology. I'd like to first attempt to do the circuit with Arduino and if that fails then go with the tea light circuits.

Concerning Arduino, you mentioned how people tend to just use the board itself and then wire components around it for their projects and that you personally prefer to program the microcontroller chips. Using your example from your first post... once you program the Arduino microcontroller with the code to run, will the chip essentially be put into the circuit similarly as the "flashing circuit" in that circuit?
Will it be able to run through its code completely free from the Arduino board used to program it in the first place, with also, of course, adding a power supply, some LEDs, and resistors, or will it still have to be hooked up to the Arduino programmer in order for it to initialize its newly uploaded flashing candle code? OR will the chip have to be set up like your standalone circuit where I'll have to add caps and etc to it?

I'm sorry if I'm really dumbing this down, but I'm planning on ordering a Arduino board with some micro chips in the next few days and I just want to make sure I have a good understanding of what all I'll need to get the chips to function by themselves after they're programmed.

In my mind, I'm thinking that once I get the chip programmed with the flashing circuit code, all I'll need to do is put the chip onto a breadboard with a power supply, ground, LEDs, resistors, and of course jumper wires to connect them all and the chip will just run through its code as soon as everything is connected. Is it really that simple or have I missed something as I've been reading through the Arduino info?

Again, thank you so much for all the time and effort you're taking in explaining this to me. Once I get everything sorted out I'll definitely add an Instructable to the site with my finished circuit so that hopefully other newbies to Arduino will have a better understanding of how they work.
The ATMEGA chip can run without the official board but it needs the resonator/crystal. This is the standalone circuit.

Think of it like this, the crystal (16MHz) prods the chip 16,000,000 times a second to say - execute your next instruction. So as it runs through the program it needs prodding to do each next instruction, "if this, do that; set output; etc.".
Hence you have to have the components needs for standalone circuit.
Reset needs pulling high with a resistor or it might float low and reset the chip. It obviously needs 5V supply and a ground connection. Beyond that, a couple of smoothing capacitors across the supply are a really good idea with any chip, especially microcontrollers. They just take any big spikes out of the supply voltage which can confuse the chip.
That's it. As soon as you turn on the 5V, the resonator starts prodding the chip, the chip spends a second or two waking up and running its bootloader to interpret the program you previously uploaded to it, which is now saved on the chip. Then it runs.

So you can't run an ATMEGA with just power supply, but you can run it "standalone" with just a handful of cheap components.

You are right you can use the arduino/ATMEGA solution in place of "flashing circuit" in my first diagram. That should work great.
SmokeGSU (author)  lasersage3 years ago
Since I asked the questions about Arduino, I've been going non stop trying to absorb as much info about them as possible. I saw where you could pretty much make your own Arduino board using ArduinoISP and etc. I've already ordered parts which should be arriving today hopefully. I've already got several ideas together for different projects I can build that will include Arduino. I'm really excited about the technology! Thanks again to you and everyone else who offered help and advise!
sorry diagram should say 12V supply, I cropped off the "1" :s
SmokeGSU (author)  lasersage3 years ago
Massive posts are good! I'd rather think I added too much info than not enough, which is why my original post is so long lol! I appreciate all the time you took to write that up! I've taken electronic courses in the past, never finished, so I have some idea of how basic parallel/series circuits work and how to read schematics, but it was a while ago, so most of the knowledge is a hazy memory! I read through the link you provided.

You hit the nail on the head as far as what I'm needing, one not flashing and two that do flash. Maybe I'm misunderstanding the link, but do the instructions actually lay out how to build an arduino chip itself, or are they just instructions for building a circuit that uses a preexisting arduino chip? About the cheapest arduino chip I've found are in the $15-$30 range on eBay. If I built five of these circuits, I'm assuming I'd need one arduino chip per circuit, and that would be anywhere from $45-80 when all was said and done (which is just way out of my price range). OR do you just need one arduino chip and that can program several circuits which are built in the $5 range?

I could definitely go with a one time price for the arduino chip if it meant I could use it to program several circuits, but I've only ever seen circuits where each circuit uses the arduino (and it makes me wonder why somebody would build at $35+ circuit that only flashes one LED, it just doesn't seem practical). If using an arduino means I need to have one arduino chip (such as this one) per circuit, it's just going to be too pricey.

Here's a few links for circuits I've found that are probably closest to my needs without the use of arduino chips necessarily:
Fireflies - Analog Version
High Current Flickering LED Pumpkin
Multiple LED Pulsing Via 555 Timer

I think the first (fireflies) is the closest (next to using pre-built circuits pulled out of tea lights) for getting multiple flashing LEDs relatively cheaply. Again though, it just comes down to where in that circuit do I put a LED that isn't meant to flash and how do I keep it from flashing alongside the rest of the LEDs.
SmokeGSU (author)  SmokeGSU3 years ago
I'm hesitant to use Arduino simply for the fact I'd never heard of it until a week ago and I've never done programming on that scale before (I've taken an intro to Java class in college). My last post might have alluded to the fact that I just don't know how they're meant to function. Does the Arduino (such as this one) HAVE to stay in each circuit, or is it used SOLELY to program microcontrollers (such as this one)?

I guess what I really need to know is if, for example, I decide to make five of these Halloween lanterns, does that mean I need to buy five of the 8 pin dev boards and five of the attiny13 microcontrollers, or do I buy just one of the dev boards and that programs all five of the microcontrollers used in the five circuits (at which point I just set up the circuit just like any other 555 timer circuit)?

For someone who's already familiar with arduino, I'm sure my questions are coming across as very elementary (such as when my dad asks me to check his voicemail on his phone because he's older and just doesn't understand the technology, though for me it's like "um really? That's so easy to do!"). As someone who's just heard of arduino chips and whatnot, I'm still trying to grasp how exactly they're used, programmed, etc.

If the dev board is solely used to program 1 or more attiny13 (for example) microcontrollers and it does NOT need to remain in the circuit afterwards, that'll make things much easier and cost efficient. I've seen several websites for using 555 timers to make LEDs flash (such as this one). If the arduino simply programs a microcontroller to function like a 555 timer, it should be fairly easy to set up a circuit using one then, I think. I guess I just need clarification on that.
noahh3 years ago
Easier than putting together a circuit  would be making an LED Throwie with this flickering LED.
SmokeGSU (author) 3 years ago
Thank you for the reply :). Several of those are going to be out of my price range as I'm needed to reproduce several of these. Using a microcontroller that alone costs $30 isn't really an option when I'm wanting to make several of these as freebies. I think going the arduino route certainly produces some of the best results, but it tends to be too pricey if you're making more than one circuit.

I had seen http://www.instructables.com/id/Random-Flickering-LED-Snowflake/ before and I really think modifying flameless tea lights is going to be my best option for keeping costs relatively low. I've more or less determined this is going to be the route I'm going to have to take, but how I'd like to wire the circuit could be an issue...

To make the effect more realistic I'd like to use 2 of the tea lights, one yellow and one red LED, and then a single orange LED that will remain solid and not blink. How exactly would I go about wiring this though? Would it work to use all three of those branches in series using a 9v battery while calculating resistance per branch by Ohm's Law, or would the fact the branches of the circuit that make up each individual tea light are more complex mean they would need a higher resistance value?

I feel like it would be a simple circuit to wire up, I just don't know how to go about wiring it up exactly :-(
Goodhart3 years ago
Does anything from HERE work for you? (results of a "graphical search")