RGB LED Rainbow effect - Page 1
Forum section: electronics / beginners

author: made2hack
author_rank: Frequent Contributor
timestamp: July 20, 2015, 04:55:23 pm
content: Hello,So essentially I want to have an RGB led array that cycles through all the colors of the rainbow (thus Rainbow RGB) without using a micro-controller.I found this tutorial here:Rainbow Led.And this is my schematic that I put on the breadboard:R1 - Pot - I tried both a 5K and 500K pot.R2-R6 = 10kIC1 - NE555IC2 - CD4029BE - binary counterT1-T3 = PH2369 transistor (I had in the parts bin -> 200mA / 15V NPN)RGB Leds - 5mm / 20mA LEDs (individual)C2-C4 - I tried 47uF, 100uF, 220uf (all 25V). The only difference, @ 220uF is the slowest flicker.So, I was expecting the LEDs to create different colors, ie as Red would wind down and start to blend with Green it would create a color and so on with Blue. The only thing that is happening is that they are all flashing together (flickering) and the slowest flicker is with the 220uF caps. But they do it at the same time. They don't progressively fade in out in order to create a rainbow effect.Here is what I essentially want to happen:Any ideas?

author: Richard Crowley
author_rank: Super Contributor
timestamp: July 20, 2015, 05:22:12 pm
content: Your circuit appears to be designed to give a "hard count" from 0 to 7 and each bit drives one of the primary colors. So, we would expect that as it counts from zero to seven, it will give you these "hard" colors:0. dark1. red2. green3. yellow (red + green)4. blue5. magenta (blue + red)6. cyan (blue + green)7. white (red + green + blue)In order to "smoothly blend" from one color to the other, you must have something more than "hard on/off" control of your LEDs.Typically, that means using pulse-width modulation (PWM) to vary the apparent intensity of the LEDs.While you could do PWM without using a microcontroller, it would be enormously complex, expensive, difficult, and fiddly.Using a microcontroller, OTOH, is simple, cheap, easy and foolproof.It appears that your design goals are at odds with your desired outcome. You can't have it both ways. Select one.

author: German_EE
author_rank: Super Contributor
timestamp: July 20, 2015, 05:49:53 pm
content: Try moving the 47 uF capacitors from the 4029 outputs to the emitters of the driver transistors.

author: Dongulus
author_rank: Regular Contributor
timestamp: July 20, 2015, 05:58:53 pm
content: I think you're looking for something like a ring counter instead of a binary counter.

author: mikerj
author_rank: Super Contributor
timestamp: July 20, 2015, 06:15:53 pm
content: You could sort of achieve something similar by doing the following:1) Put the LEDs and resistors in the collector circuit of each transistor, get rid of the caps on the 4029 outputs (very bad idea anyway).2) Integrate the clock output from the 555 and buffer it, and connect the buffered output to the LED anodes.You now have a ramp driving the LEDs, and on each ramp cycle a different combination of LEDs will be active. This won't get you the mixing profile you have posted, but you will get a range of colours.Alternatively just drive the LEDs from 3 separate triangular waveforms running at different (non-integer divisible) frequencies.

author: djococaud
author_rank: Regular Contributor
timestamp: July 21, 2015, 09:42:21 am
content: Simply put the 47µF capacitors between transistors bases and ground, after the base resistors (it's just a little mistake on the schematic !).This makes Resistor/capacitors smooth filters, followed by the transistors.You can play a little with the resistor/capacitor values to adapt to the fading speed you want.This circuit will work with only LED per channel (Vf<3~4V)

author: made2hack
author_rank: Frequent Contributor
timestamp: July 21, 2015, 10:09:30 am
content: Quote from: djococaud on July 21, 2015, 09:42:21 amYeah, I made a mistake in the schematic. IRL the caps are between Base and GND.

author: made2hack
author_rank: Frequent Contributor
timestamp: July 21, 2015, 10:11:46 am
content: Quote from: Richard Crowley on July 20, 2015, 05:22:12 pmYou're probably right, although right now I would of course be happy with it just doing what you mentioned - A hard switch between the primary colors as opposed to all of them flickering on simultaneously.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: July 21, 2015, 10:10:02 pm
content: LED ring oscillator:I've made these using 2n7000 mosfets, they work fine. Vary the capacitor and resistor values for different timings.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: July 21, 2015, 10:18:09 pm
content: Of course if microprocessors are allowed, you can do a lot more. Here's my Arduino-based "mood light". It uses a single RGB combo LED but of course you can use 3 individual ones or arrays as well.

author: made2hack
author_rank: Frequent Contributor
timestamp: July 22, 2015, 12:40:05 pm
content: OMG!!!! Yes. I will try this now.It's not that micros are not allowed, I do want to do one with the MSP430, I just wanted to see if it can be done "passively" first.

author: made2hack
author_rank: Frequent Contributor
timestamp: July 22, 2015, 02:29:29 pm
content: Hey,So I got it to work, but I have some questions which may appear stupid or obvious to some of you.I didn't have any 2N7000 mosfets on hand. So I used 2N2222 BJTs. I noticed that I needed a large amount of capacitance to slow down the transition (on the order of 1000s of uF). Ok, I switched to some IRF634As I had around, which made things somewhat better. With 220uF I can say that I am satisfied by the speed of the transition.Is this the only way to slow down the transition?And, is there a way I can calculate using the datasheets of a Mosfet how much capacitance will give me how large of a transition?Side note, thanks for telling me about a ring oscillator. Now I can use that search term as opposed to "rainbow led".

author: dentaku
author_rank: Frequent Contributor
timestamp: July 23, 2015, 01:14:13 am
content: Just for fun I checked to see if I could build something similar. Right away I knew I needed a 4017B and not a 4029.I ended up using 100uf capacitors but that all depends on how fast your clock is.I breadboarded it then realised that I only havecommon anodethree colour LEDs so I modified the circuit a bit and I now have an LED the fades from red, green, cyan, blue, magenta, red etc... It can't seem to make anything close to yellow for some reasonYou seem to have acommon cathodeLED so my first circuit should work.Where you see the 1Hz clock is where the output of the slowly oscillating 555 timer goes.Doing this with a microcontroller is still better because you can then fade the LEDs using PWM plus you can make lots more controllable colours but this was still a fun experiment.