Connect with us

fading RGB lamps

Discussion in 'Electronic Design' started by [email protected], Oct 24, 2007.

Scroll to continue with content
  1. Guest


    I'm looking for a circuit which would allow me to continues keep on
    fading RGB lamps in and out.
    I have 3 lamps(Blue, Green and Red) which all can be controlled with a
    voltage between 0 and 10Volt.
    The circuit i'm looking for should have blue fading out while green is
    fading in, when blue is out, green should be on max voltage, then
    green starts to fade out and red starts to fade in. When green is out,
    red should be at max Voltage. Then red starts to fade out, and blue
    starts to fade in. and so on.

    Is there anybody who knows where to find a circuit like this?

  2. Progam a PIC.
    Add an opamp to get 0-10V.
  3. DJ Delorie

    DJ Delorie Guest

    I've done this with a tiny MCU using pulse dithering. It did exactly
    the effect you want, too. You need an MCU, three drive transistors,
    and your lamps.

    Note: an MCU three PWM modules can do this in hardware, the software
    just programs the PWM counts as needed.

    What is pulse dithering?

    Consider pulse width modulation - for every N clock ticks, the output
    is on for the first M of them, and off for the remaining (N-M) of
    them. Your period is limited to 1/Nth of the clock frequency, though.

    For pulse dithering, you spread the M "on" ticks evenly throughout the
    N clock ticks, so your "period" is effectively the same as the clock
    frequency. This lets you have more precision in your "brightness"
    setting, while using a slower clock speed. Of course, your real
    precision is still limited to clock/60Hz.

    The algorithm is amazingly simple, and best implemented in an assembler
    interrupt routine (due to the use of carry):

    int setting;
    int count;

    count += setting;
    if (carry)

    A larger setting will overflow more often, causing the light to be on
    more often.

    You may even get away without conditionals:

    mov #0,bits
    add count_red, setting_red
    rolc #1,bits
    add count_green, setting_green
    rolc #1,bits
    add count_blue, setting_blue
    rolc #1,bits
    mov bits, gpio_port
  4. Tom2000

    Tom2000 Guest

    Here's a very nicely designed and executed RGB LED controller, written
    for the PIC 12F683 (or other selected 12F PICs) by Pete Griffiths:

    Its signature feature is the ease of modifying and adding fade

    Have fun!

  5. Guest

    At your local dollar store.
  6. And the analog way, would it be possible to build a multi stage RC
    ring oscillator, creating the phase shifted signals directly at 10V?
  7. I just did a ring oscillator in LTSpice,
    see sceenshot here:
    But it is not a nice sinewave...
    Add some lowpass in the outputs perhaps, any other way to make it more sine like?
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