fading RGB lamps

Oct 24, 2007 6 Replies

Hi,



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?



Greetings, Yves



On a sunny day (Wed, 24 Oct 2007 07:39:10 -0700) it happened snipped-for-privacy@gmail.com wrote in :

Progam a PIC. Add an opamp to get 0-10V.

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;

interrupt() { count += setting; if (carry) light_on(); else light_off(); }

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

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

formatting link

Its signature feature is the ease of modifying and adding fade routines.

Have fun!

Tom

At your local dollar store.

On a sunny day (Wed, 24 Oct 2007 15:07:31 GMT) it happened Jan Panteltje wrote in :

And the analog way, would it be possible to build a multi stage RC ring oscillator, creating the phase shifted signals directly at 10V?

On a sunny day (Wed, 24 Oct 2007 15:07:31 GMT) it happened Jan Panteltje wrote in :

I just did a ring oscillator in LTSpice, see sceenshot here: ftp://panteltje.com/pub/rgb.jpg But it is not a nice sinewave... Add some lowpass in the outputs perhaps, any other way to make it more sine like?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required