Have a need to emulate a flickering light, kinda like a faulty fluorescent. My first attempt (using a pic) has an 8 bit pseudorandom sequence generator the output being compared with the result of an a/d conversion of a pot (over turns the light on, under turns it off) hence am able to vary the average duty cycle, plus another pot controlling total loop time to slow down or speed up the flicker. It doesn't look very convincing - sure it all works as coded, but it just doesn't look random enough. Dunno if the brain can remember an 8 bit pseudorandom sequence or what. Unfortunately this has to drive a big incandescent (via an opto and a triac), so a "real" faulty fluro is out of the question. Any better ideas ? M
flickering light emulator
Mar 28, 2007
8 Replies
If you have an 8 bit psudorandom generator coded and you want to make more bits without having to think too hard, you can do like this:
byte PsudoRand(byte Prev) {stuff}
int Seed1,Seed2,Seed3;
int BigRand(){ Seed1 = PsudoRand(Seed1); if (Seed1 & 1) Seed2 = PsudoRand(Seed2); else Seed3 = PsudoRand(Seed3);
return ((Seed1
I've had a similar problem. Some notes:
- You may need to match the pattern of a faulty fluro by analyzing a recorded sample pattern. Then make a matching rnd generator.
- Is a faulty fluro mostly on or mostly off?
- You may need to randomize the trigger time, ton and toff.
- You loose some reality if a faulty fluro has random varying intensity levels. D from BC
Wouldn't on off pulses be more realistic?
Stage lighting people sometimes take the crude approach of wiring a flourscent tube starter in series with a 60watt bulb.
Bob
IIRC, there was a Circuit Cellar project a while back to build an 'LED candle'. It was a yellow LED driven by a small uC. The designer did some research to determine what would produce a convincing flicker and developed an algorithm to produce it.
Paul Hovnanian mailto:Paul@Hovnanian.com
------------------------------------------------------------------
If you\'re not part of the solution, you\'re part of the precipitate.
Hi,
Here's what I did to simulate a candle. The random number generator has a very long sequence.
formatting link
Luhan
I'm sure Elektor will have done one in their 300 circuits series also.
the equal spacing of the firing times is probably the problem,
change your algorithm so that the on and off durations come in more than 7 different lengths.
trigger the opto using a phototransistor and use a real fluoro to trigger that.
Bye.
Jasen
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required