Connect with us

flickering light emulator

Discussion in 'Electronic Design' started by Piglit, Mar 28, 2007.

Scroll to continue with content
  1. Piglit

    Piglit Guest

    Have a need to emulate a flickering light, kinda like a faulty
    My first attempt (using a pic) has an 8 bit pseudorandom sequence
    the output being compared with the result of an a/d conversion of a
    (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
    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 ?
  2. MooseFET

    MooseFET Guest

    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.
  3. D from BC

    D from BC Guest

    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
  4. Wouldn't on off pulses be more realistic?
  5. Bob

    Bob Guest

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

  6. 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.
  7. Luhan

    Luhan Guest


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

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

    jasen Guest

    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
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day