Login Join Maker Pro

# flickering light emulator

P

#### Piglit

Jan 1, 1970
0
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

M

#### MooseFET

Jan 1, 1970
0
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

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<<8) | Seed1) \$ ((Seed2<<8) | Seed3);
}

The results are not as good as a read 16 bit psudorandom but still
very hard for mere mortals to predict.

D

#### D from BC

Jan 1, 1970
0
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

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

H

#### Homer J Simpson

Jan 1, 1970
0
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

Wouldn't on off pulses be more realistic?

B

#### Bob

Jan 1, 1970
0
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

Stage lighting people sometimes take the crude approach of wiring
a flourscent tube starter in series with a 60watt bulb.

Bob

P

#### Paul Hovnanian P.E.

Jan 1, 1970
0
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.

L

#### Luhan

Jan 1, 1970
0
Stage lighting people sometimes take the crude approach of wiring
a flourscent tube starter in series with a 60watt bulb.

Bob

Hi,

Here's what I did to simulate a candle. The random number generator
has a very long sequence.

http://mondo-technology.com/candle.html

Luhan

H

#### Homer J Simpson

Jan 1, 1970
0
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.

I'm sure Elektor will have done one in their 300 circuits series also.

J

#### jasen

Jan 1, 1970
0
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.

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.
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 ?

trigger the opto using a phototransistor and use a real fluoro to trigger
that.

Replies
32
Views
7K
D
Replies
7
Views
2K
D
Replies
9
Views
572