RGB led astable circuit

Hi,

probably everyone knows astable multivibrator circuit, using two transistors, two capacitors and some resistors.

I would like to light RGB led and make it cycle through “rainbow” colors by using triple astable circuit. The problem is that I don’t know how to design it to work (I’m not experienced enough to understand principles).

Could somebody help me and design this kind of circuit? Less parts = better, but I need to be minimalistic, that means probably no IC. The whole thing should fit 2.5 x 3.5 cm PCB, ideally with battery CR2032 and LED.

Any help is greatly appreciated!

Edit: Added image of the proposed (by me) circuit. I have nothing better to draw it at the moment, I’m sorry :blush:

rgb_astable_circuit.PNG

To get a continuous varying signal you will have to tap the voltage directly at one of the capacitors. But this will take charging current away from it so you need to buffer it by using a transistor in the emitter follower mode. Connect the base via a resistor to the capacitor, the collector to the + supply and emitter to the anode of the LED with the cathode to ground.

Grumpy_Mike: Well, I don't understand that much. I knowh how emitter follower circuit looks like, butI don't know how to adapt it.

I will add image of "my proposed circuit" to the first post right after sending this. Could you please comment it and/or draw EF into it?

Just to add - I saw the kind of circuit (on the image in the first post) working ~10 years before, but there was fourth capacitor, bt I don't know where in the circuit. That fourth capacitor madeone color to fade more quickly than the others.

It does help it you don’t edit the original post as it makes subsequent replies make less sense.

everyone knows astable multivibrator circuit

Everyone except you apparently. That is not a multivibrator, a multivibrator looks like the attached photograph.

What I was thinking was that you would have three of each of these circuits one for each colour. They would run at slightly different speeds and each one would control one colour of the RGB LED.

multi.png

But the multivibrator only turns the led on and off. There's no fading. This whole thing can be done with a Nano. Although more effort, an attiny45 would be perfect for it. One 8 pin IC, 3 resistors, RGB LED, battery. Yes, I know that you said,

but I need to be minimalistic, that means probably no IC.

,but the most simplistic circuit will be the attiny45. I don't remember the current requirements being mentioned, but I think the output pins can source or sink 40ma. Most LEDs work fine with 20ma.

It sounds like you want a ring counter (commonly used with ancient neons and often used 4 layer devices instead of transistors)... but that would only turn on or turn off a stage at a time... to get the "run-down" that controls brightness, you might need to have triggered an additional circuit with each stage.

A wild guess here... but I feel that this could be created cheaply and at low current with some legacy parts like; a CD4017 and some LM555's. Still not "simpler" that using a tiny microcontroller.

This is my (feel free to use it) code and works on an UNO, NANO, and Pro Mini.
You can change the fade rate, max brightness, and min brightness, for each of the three colors.
You could also throw in a random generator at the end of each colors fade to make the cycling random.
You could also add a random seed so the random generator is truly random.
Compiled “as is” takes 5,830 bytes so it would fit on an attiny85 and most likely would still fit with the random code. I used this in conjunction with a L298 shield to drive 3, 10w LEDs (RGB).

/*
 Fade
 
 This example shows how to fade three LEDs on pin 9 10 11
 using the analogWrite() function.
 */
#define MAX_BRIGHTNESS_BLU  200
#define MAX_BRIGHTNESS_GRN  240
#define MAX_BRIGHTNESS_RED  100

#define MIN_BRIGHTNESS_BLU    5
#define MIN_BRIGHTNESS_GRN   10
#define MIN_BRIGHTNESS_RED    2

#define FADEAMOUNTBLU  5   
#define FADEAMOUNTGRN  4   
#define FADEAMOUNTRED  7  // 3   

#define DELAY_VALUE  30

#define LED_BLU   9
#define LED_GRN  10
#define LED_RED  11

int fadeAmountGrn = FADEAMOUNTGRN;    // how many points to fade the LED by
int fadeAmountRed = FADEAMOUNTRED;
int fadeAmountBlu = FADEAMOUNTBLU;
int brightnessBlu= MIN_BRIGHTNESS_BLU;
int brightnessGrn= MIN_BRIGHTNESS_GRN;
int brightnessRed= MIN_BRIGHTNESS_RED;

// the setup routine runs once when you press reset:
void setup()  { 
  // declare output pins:
  pinMode(LED_BLU, OUTPUT);
  pinMode(LED_GRN, OUTPUT);
  pinMode(LED_RED, OUTPUT);   
} 

// the loop routine runs over and over again forever:
void loop()  { 
       // set the brightness of each pin:
  analogWrite(LED_BLU, brightnessBlu);
  analogWrite(LED_GRN, brightnessGrn);    
  analogWrite(LED_RED, brightnessRed);
  
     // change the brightness for next time through the loop:
  brightnessBlu = brightnessBlu + fadeAmountBlu;
  brightnessGrn = brightnessGrn + fadeAmountGrn;
  brightnessRed = brightnessRed + fadeAmountRed;

  
      // reverse the direction of the fading at the ends of the fade: 
  if (brightnessBlu <= MIN_BRIGHTNESS_BLU || brightnessBlu >= MAX_BRIGHTNESS_BLU) {
    fadeAmountBlu = -fadeAmountBlu ; 
  }
  if (brightnessGrn <= MIN_BRIGHTNESS_GRN || brightnessGrn >= MAX_BRIGHTNESS_GRN) {
    fadeAmountGrn = -fadeAmountGrn ; 
  }
  if (brightnessRed <= MIN_BRIGHTNESS_RED || brightnessRed >= MAX_BRIGHTNESS_RED) {
    fadeAmountRed = -fadeAmountRed ; 
  }
 // wait for 30 milliseconds to see the dimming effect    
  delay(DELAY_VALUE);                            
}

But the multivibrator only turns the led on and off. There's no fading.

Look at the voltage on the capacitor on the base.

Look at the voltage on the capacitor on the base.

You are correct; it will be a positive going ramp. Put LED in series with the base and it will fade on, then cut off sharply. Excluding LED, 9 components vs 4 components using the attiny85 which gives you fully customizable fading. And, if you can get away with using the internal pull up resistor of the attiny, make it 2 component (and LED).

I'm sorry guys, my bad with not knowing what exactly I am talking about and editing first post.

I just know how to connect two leds that switches "blinks". I know I had some kind of circuit, which was fading 3 bulbs constinuously - imagine "ring" going around when one of bulbs is off, one is going on and one is going off, all around. This is what I need to do. The problem is, that I don't have the circuit, otherwise I would just copy it :frowning:

For the ATtiny45 - LED draws ~30mA, but it can work on lower, no problem. Problem is, that I'm completely new to microcontrolers... Can I program ATtiny45 using Arduino (or its board)?

Anyway - I could still use the "old" method, using some classic circuit, at least it has more pure electonics feeling, when it comes to show off.

I'm sorry for that confusing beginning of this thread. Thanks for your time and replies, I appreciate it.

imagine "ring" going around when one of bulbs is off, one is going on and one is going off, all around. This is what I need to do.

That will not give you all the possible colours.
It is not a ring counter either. It is a phase shift oscillator. I have never seen one light up LEDs though. I am not sure there is enough voltage swing without amplifying each three stages to specifically drive the LED. It is not a simple circuit though.

The UNO can be used to program an attiny84, and 85. There are several tutorials out there.
Programming ATtiny 2313 with Arduino UNO r3 | beeforever is just one. Where do you live Pavouk106 (country) ?

May want to look at these too.
http://www.hobbytronics.co.uk/arduino-attiny

http://www.robot-italy.net/downloads/pighixxx/attiny.pdf
http://jeffmurchison.com/blog/docs-how-to-use-the-tinyloadr-shield/

There are some shields out there that just sit on top of your UNO. You could also buy an USBASP programming module about $4 USD.

other than an attiny85 or similar.

Try this.


or

the 2nd circuit is a lot easier to read, each capacitor slowly rises pulling in the collector/emitter, then again another cap fills slowly switching on the 2nd transistor... the last transistor
switches on the 1st and we start over....

This circuit should be easy enough to modify to suit your 3RGB idea.

Mark_Grass: I'm from Czech Republic (central Europe). Thanks for manuals, I will go through them, this knowledge may be handy :wink:

cjdelphi: That's probably what I meant. I just didn't how to connect the last capacitor. I will start with these schematics and experiment a little next week.

Thanks to all. I will try to provide a video of it working.

That's a lot of work just to get the colors. If you aren't on a deadline, I could burn it into a attiny84 (DIP) and mail it to you (from USA).

even so count the component cost up and it still works out cheaper than an attiny..... and have spare to build another 5 if you know where to buy in cheap components

I get my attinys for about $1USD.
What's time worth?
I can't buy time!
Just say'n, 8)

Mark: Thanks for your offer, I appreciate it. I'm not on a deadline, but it should be a gift, so I have to do some work myself to be proud of it :wink: I will certainly try ATtiny at some point, but this circuit will be done by "old" electronics. It will make more impression, which is what I want.

Oh, and by the way, this will be soldered on as-small-as-it-can-be PCB, powered with CR2032 battery (standing, on the PCB too) and fitted on a ring. It won't be ever used as a ring, I just want to do it and present it.

Thanks again for your time and your replies. I think everything that I needed was anwered and I learned about ATtiny. Thanks