Making a led flicker

Thread Starter

Jonlate

Joined Dec 21, 2017
110
As we know there are many led flicker candle things on the market now, however the colours they come in are the basic colours.
However I don’t really find these to be the right sort of light for a candle flame.
Warm white looks a good candle colour, but there are not many flicker warm white available cheaply
Also many only seem to come in 3 or 5 mm leds.
So…..
Is it possible to make a simple flicker led circuit using micro, nano, pico, etc leds in the colour you want?
Can one be made with components only?
Or can one be made using a aTtiny, or nano boards, with a small bit of code?

I have seem circuits made using a flicker led to flicker others, but then if you join 3-4 together they all flicker the same.
My wife has a tealight thing, that holds 8 tea lights, but want it made into battery or electric instead.

So really I would like a diagram to make up a 8 string flicker circuit, using a power supply (5-12 volt) that makes each led flicker differently, using the smallest AWG wire possible, and 1 switch turns them all off!!

Not much to ask for on a Thursday evening!!

Thanks guys n girls.
 

Alec_t

Joined Sep 17, 2013
12,744
An MCU with 8 general purpose 5V digital outputs free could control 8 individual flicker rates. Coding for the MCU should be relatively simple for a programmer (I'm not one!).
What LEDs do you intend to use?
 

dl324

Joined Mar 30, 2015
14,325
Is it possible to make a simple flicker led circuit using micro, nano, pico, etc leds in the colour you want?
This will be the easiest.
Can one be made with components only?
It would take a lot of discrete components.
I would like a diagram to make up a 8 string flicker circuit
If you want multiple colors, use RGB LEDs. If you want them to be independent, you need a PWM'ed signal for each one. If you use RGB LEDs, you need 3 PWM signals per LED.

Arduino Uno/Nano have 6 PWM outputs, Mega has 15. If you were so inclined, you could write code to PWM the normal digital outputs and you could use the analog ports as more digital outputs.

If you wanted to be clever, you could multiplex the LEDs to cut down on the number of outputs you'd need.

Before you do anything, think about the wiring required.
 

Irving

Joined Jan 30, 2016
2,554
Here's my stab....

1639072461634.png

If you don't mind only 1 LED on at a time (obviously still multiplexed so they all appear to flicker together) then you can replace R3 to R10 with a single resistor to each group of 4. R3 to R10 currently sized for a 4v LED @ 40mA on a 7.5v supply, so adjust to suit....

Using chip LEDs this could easily be assembled on a PCB under a simulated row of 8 tealights with a light pipe for each 'wick' - no wiring needed.
 

Audioguru again

Joined Oct 21, 2019
4,536
The easiest way to make an ordinary different color LED flicker is to connect it is series with a flickering LED and use a higher supply voltage. The flickering LED already has the flickering circuit inside it.
 

Irving

Joined Jan 30, 2016
2,554
The easiest way to make an ordinary different color LED flicker is to connect it is series with a flickering LED and use a higher supply voltage. The flickering LED already has the flickering circuit inside it.
Of course it is......

but where's the fun/challenge in that?:D
 

AnalogKid

Joined Aug 1, 2013
9,967
It sounds like what you want are 8 uncorrelated random number generators, each one driving one LED.

Nothing will be smaller than a PIC with 8 GPIO pins, but then this is a typing project rather than an electronics project.

And of course this can be done with an analog noise source plus other stuff.

But another way is an LFSR - Linear Feedback Shift Register - with 8 of the taps driving the LEDs.

1 - Relaxation oscillator - 1 or 2 XOR gates, 3 resistors (two for hysteresis), 1 capacitor
2 - 8-bit shift registers
1 to 3 XOR gates deriving the feedback
1 - ULN2803 Octal driver
8 - Current limiting resistors
8 - LEDs

Because the clock freq will be so low, and this is not a part of an encryption system, you probably can get away with only 1 shift register.

https://en.wikipedia.org/wiki/Linear-feedback_shift_register

ak
 
Last edited:

SamR

Joined Mar 19, 2019
4,131
To get the "flicker" effect you will have to program a randomly variable PWM signal. Otherwise, you will just have a fixed rate pulsing LED.
 
One problem with a PIC that I found is coming up with a way to make random numbers. Luckily my project involved enough LEDs I could use a couple timers based on different clocks to come up with somewhat randomness by adding the current timer values together when the LED intensity matched it's final value and using that value as a base for a few more calculations for the next intensity target. There was a slight pattern to it, but the only way to see it was to log the numbers. There are most likely better ways, but I was after a strictly software solution at the moment (I just wanted to be done with it for a while).

The project has been upgraded and downgraded a few times to try different ideas, but the program has moved outside of a PIC's capabilities. To get a candle effect I found you have to generate a target intensity between an upper and lower limit to start. You will also need a random step value to use to increment or decrement your current intensity until it reaches your target intensity. Once you reach the target then generate your new target and step values. That much will get a basic variable flame. To get a flicker I also count each time the target is hit, and compare that to another randomly generated value. When the count matches the next target is adjusted to be above the normal upper limit and the "flicker" upper limit, and the step limits are adjusted to make the transition faster.

If you have the space to fit it and the LEDs are not spaced too far apart an ESP12 along with some through hole WS2812 RGB LEDs would make a very flexible setup and narrow it down to just one wire to run all eight LEDs other than power connections. The ESP12 has some random number generation capabilities along with it's other features. The WS2812 have the PWM and everything built in. All you have to do is tell it what color to show. The through hole variety are a bit pricey compared to the surface mount variety, but for only eight it would be worth it.
 

djsfantasi

Joined Apr 11, 2010
8,257
I accomplished this with an Arduino Nano and 6 LEDs for a prop birthday cake . The code drive each LED candle by randomly picking a direction up and down and randomly choosing an updated value in that direction, a random amount.


While this only works with 6 LEDs due to the PWM pin limitation on the Nano, for more candles, one could use a second Nano and have each drive 4 LEDs

I also implemented routines to light the candles one by one and simulate blowing them out.

I don’t have access to the code right now, but if you’re interested, I’ll dig it up.
3DAFC6DF-B256-4E51-BF20-20841E04699C.jpeg
 

Irving

Joined Jan 30, 2016
2,554
The ATTINY85 I suggested has 8k of flash memory; this is more than enough to store a 256 byte array of an externally generated random sequence of each 8 bit #. To get multiple random streams you can traverse the array from a different start point,skip a prime # of entries, etc etc. No need to generate on the fly.
 

SamR

Joined Mar 19, 2019
4,131
Easy way to generate random numbers for Arduino is to poll an unconnected analog input pin. The random noise on it seeds the generator.
 

AnalogKid

Joined Aug 1, 2013
9,967
The ATTINY85 I suggested has 8k of flash memory; this is more than enough to store a 256 byte array of an externally generated random sequence of each 8 bit #. To get multiple random streams you can traverse the array from a different start point,skip a prime # of entries, etc etc. No need to generate on the fly.
I was going to suggest that implementing a LFSR in software is much easier than growing a random number generator, but I'm kicking myself for not suggesting the look-up table approach. To me this is the winner.

In lieu of 8 PWM generators for random brightness levels instead of just random full-on / full-off transitions, add a capacitor across each LED sized to work with the current limiting resistor to produce a perceivable brightness ramp.

ak
 

Thread Starter

Jonlate

Joined Dec 21, 2017
110
Thankfully guys.
I understand that using pre chipped warm white flicker 3 or 5mm leds would be easiest, and wire them together.
This would mean that I would only have two wires in and out and would look tidy.
These 3mm Candle led Flickering / DC 3.0V-3.2V (IF=20mA) / 0.06 Watts are about normal parameters for these.
If I went this simple route, what is the thinnest wire I could use?
What sort of power supply would I need?

Now buying non flicker leds would give me a variety of sizes I could use, but it seems that each one would need to be wired independently or else they would all flicker at the same time.
This will make the tea light display look to messy as the wires need to be run on the outside as the display isn’t hollow so I can’t run them up the inside.

But if I was to use ws2812 chip warm white ones, neopixel, then it would only take 4 wires, which might be doable.
So if I went this way, again what’s the thinnest wire I could use?
What power supply would be needed?
How could I program a flicker circuit for them?

thanks all for your thoughts so far.
 

Audioguru again

Joined Oct 21, 2019
4,536
I took apart a flickering tea light and inside there was an orange flickering LED and a CR2032 3V battery.
It has an on-off switch but it has no resistor. The small battery will have a very short lifetime.
 

Thread Starter

Jonlate

Joined Dec 21, 2017
110
It was these flicker tea lights that gave her the idea!!
But instead of trying to get them in and out of the candle holders and turning them all on and off individually, she wants to do it all in one step. Hence wiring them into a DC output and joining them all together. This also saves on buying batteries!

I suppose the easy way is the best way, even though there’s no fun it that.

I would have liked to go the ws2812 RGB route, so she can get the exact colour she wants, but that’s a bit beyond my coding skills, unless I can find code written somewhere already.

Just so you can picture what she wants, here’s a photo of her candle holder.

Thanks again for all your suggestion.
 

Attachments

Top