color shifting LED Light Design

Hi guys I'm creating what most of you would consider a simple design. a slow color changing light with common cathode LEDS using a stand alone ATmega328P-PU. PWM pins will drive the anodes via Transistors ( BC547 NPN 45V 100mA ). just need some help on some of my electronic concerns to do with my design. please look over my schematic. all my concerns and questions are listed and all components labeled on the schematic drawing.
Also if my design write were would be a good place to post my drafts to help other people like me.
Any advice would be very much appreciated. thanks in advance

The LED common cathode needs to be connected to ground. You could drive the LEDs (with series resistors) using PNP transistors in common emitter mode (with series base resistors). However consider driving the LEDs (with series resistors) directly from the microcontroller chip. Either way you are likely to have inadequate voltage available to enable each LED resistor to satisfactorily determine the LED current. The transistor option, with the transistors going into saturation, will give you only slightly more voltage available. I therefore suggest you use your 5.15V supply instead of 3.38V, including for the microcontroller.

The value of the resistors in series with each LED needs to calculated using forward voltage information from the LED datasheet.

Also you have no supply decoupling on that chip if it is going to be a stand alone design.
And you have no pull up resistor on your reset line.

Archibald:
The LED common cathode needs to be connected to ground. You could drive the LEDs (with series resistors) using PNP transistors in common emitter mode (with series base resistors). However consider driving the LEDs (with series resistors) directly from the microcontroller chip. Either way you are likely to have inadequate voltage available to enable each LED resistor to satisfactorily determine the LED current. The transistor option, with the transistors going into saturation, will give you only slightly more voltage available. I therefore suggest you use your 5.15V supply instead of 3.38V, including for the microcontroller.

The value of the resistors in series with each LED needs to calculated using forward voltage information from the LED datasheet.

Oh I did connect the cathode to the 3.38v instead of the Ground, and on my NPN transistor I have the emitter and collector around the wrong way i think to. Also i have miss counted all the pins on the left hand side too. I will have to fix that. I'll change the power using the 5.15V rail instead. I was thinking of using 25 RGBs in parallel with individual resistors on all 3 legs although the aim is to have them all dim the same amount at the same time.
RED= 2.4V @ 20mA : Blue = 3.4V @ 20mA : RED = 3.4V @ 20mA Maxium values
Maxuim potentail Current on each output is 25 X 20mA = 500mA But If I was to use the other 3 PWM outputs that would draw 270mA on the heavest loaded side. I can find the max current values on the chip (pb1 pb2 pb3)etc.

Sparks32:
I was thinking of using 25 RGBs in parallel with individual resistors on all 3 legs although the aim is to have them all dim the same amount at the same time.
RED= 2.4V @ 20mA : Blue = 3.4V @ 20mA : RED = 3.4V @ 20mA Maxium values
Maxuim potentail Current on each output is 25 X 20mA = 500mA But If I was to use the other 3 PWM outputs that would draw 270mA on the heavest loaded side. I can find the max current values on the chip (pb1 pb2 pb3)etc.

So you will need PNP transistors capable of switching that current.

With paralleling of LEDs, it's advisable to have a resistor for every colour of every LED. Note red LEDs will need a higher value of resistor than green and blue.

If the maximum rated current of your LEDs is 20mA, you need to consider the minimum forward voltage, not the typical forward voltage.

Thanks for pointing out the decoupling, i included a 470uF capacitor between 3.38v and ground I found out that I should place it closer to the chip though. Do you think 470uF is a good value? I found a reset on pin1 is that why you are talking about? I'm going with the 5.15v rail suggestion to run it all. should i connect pin 1 to that rail and with what resistor would you recommend?

So why do i Need a PNP instead of a NPN? When the input is low is there electrical continuity between the pin and ground?
Thank you all for your patience and help

So why do i Need a PNP instead of a NPN?

Because you want to top switch.

Do you think 470uF is a good value?

No.
See:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

So you have made so many changes you now need to post a schematic that reflects the circuit you have or are going to build.

470uf is not decoupling, it's power supply filtering. You may well need filter caps - but you always need the decoupling caps.

0.1uf right next to the chip between each power pin and ground, on every IC (not just uC's). Sometimes it will appear to work without them, but then fail unpredictably or seemingly at random.

Ok guys I'll whip up a new scematic and upload it , I have learned about inductive reactaince and capitive reactance but mostly to do with phase angle shift and power factor in AC. Never got into filtering so I'm learning alot of things here it might take me about 2 days to read up and draft up. i'll value all of your options on my second draft. thanks again.

Ok guys I'm Back, I had never worked with transistor before. they were more complicated than I imagined. alot of the terminology went right over my head. but after a lot of careful reading on everything you guys were trying to tell me i feel like i'm much closer to being on track. I feel alot better about my newly drafted schematic. I'm can't wait to here what you guy's think. I hope i got the transistors right. if the 2nd draft doesn't show up here I will put it with my original upload

OK better. In fact if you are only switching to 5V you don't need the first NPN, just connect the base resistor of the PNP direct into your Arduino output pin.

If you do want to use that configuration then I would suggest a pull up resistor for the PNP base to the +ve line you are switching.

Other notes, make R1 10K.

Your calculations are way off resulting in very low values of base resistor, too low in fact. I can't see where you have used the gain of the transistor. As a rule of thumb use half the minimum value shown in the data sheet, so that:-
base current X gain = collector current.
Note base resistors are not very critical and can easily be +/- 80% of the calculated value. The idea is to get enough current to saturate the transistor.

Sparks32:
I hope I got the transistors right.

The DC current gain (Hfe) of the BC327 drops off considerably at collector currents approaching 500mA. You will need to take that into consideration but I think you can still do without the NPN transistors (taking note of the current rating of Arduino output pins). You will need to be careful to ensure the BC327 transistors switch fully on into saturation, otherwise they will probably dissipate more than their maximum rated dissipation and blow up.

As mentioned before, it's advisable to have a resistor for every colour of every LED. That means 75 resistors! The 25 LEDs (of each colour) will not drop exactly the same voltage with 20mA current. So when paralleled together some LEDs will take more current than others. I don't know how much variation in electrical characteristics there will be so I don't know whether you can get away with paralleling them.

Archibald:
The DC current gain (Hfe) of the BC327 drops off considerably at collector currents approaching 500mA. You will need to take that into consideration but I think you can still do without the NPN transistors (taking note of the current rating of Arduino output pins). You will need to be careful to ensure the BC327 transistors switch fully on into saturation, otherwise they will probably dissipate more than their maximum rated dissipation and blow up.

As mentioned before, it's advisable to have a resistor for every colour of every LED. That means 75 resistors! The 25 LEDs (of each colour) will not drop exactly the same voltage with 20mA current. So when paralleled together some LEDs will take more current than others. I don't know how much variation in electrical characteristics there will be so I don't know whether you can get away with paralleling them.

I think it might get real messy with 75 resistors though I agree it would be a safer option, but if i was to go with 3 resistors instead of 25 the resistors would be 2.1 ohms for red, 4.1 for green and blue if you could get those values the tolerance wouldn't be 1% or something like that. the lowest value trim pot i've found was 50 ohms. how could i trim the voltage? And I don't know how to connect a PNP to the chip output. I can't connect it to the gate like i did with the NPN. And just another thing doesn't convental flow flow into the collector then through the base? in the data sheet it keeps on talking about base and emitter this and base and emitter that. and says nothing about collector and base unless conventional current on a pnp goes through the emitter and into the base.

Sparks32:
I think it might get real messy with 75 resistors though I agree it would be a safer option, but if i was to go with 3 resistors instead of 25 the resistors would be 2.1 ohms for red, 4.1 for green and blue if you could get those values the tolerance wouldn't be 1% or something like that. the lowest value trim pot i've found was 50 ohms. how could i trim the voltage?

It's the current that you are trimming. I suggest you purchase say 2.7Ω and 4.7Ω resistors and trim each by adding a resistor in parallel. You will need resistors rated for the power dissipation required.

Surely the red LEDs require the larger series resistance.

I still think it is dodgy paralleling the LEDs. I am having difficulty finding any device data that gives a minimum voltage drop at say 20mA. Anyway if you look at the voltage/current curve in a datasheet for a red LED you may see it has a typical voltage drop of (for example) 2.0V but would draw very little current at 1.8V. You may also see the maximum voltage drop is specified as 2.5V. So let's say you place just two LEDs in parallel, one of which has a voltage drop of 2.0V (at 20mA) and the other has a voltage drop of 2.2V (at 20mA). The first will take nearly all the current. If the series resistor is designed to supply 40mA for the two diodes in parallel, the 2.0V LED will probably burn out quite quickly.

Sparks32:
And I don't know how to connect a PNP to the chip output. I can't connect it to the gate like i did with the NPN. And just another thing doesn't conventional flow flow into the collector then through the base? in the data sheet it keeps on talking about base and emitter this and base and emitter that. and says nothing about collector and base unless conventional current on a pnp goes through the emitter and into the base.

With a PNP transistor voltages and current are simply reversed. You can connect the base of each PNP transistor to an output of your chip via a series resistor of at least 120Ω (ensuring the current will be less than the 40mA chip specification). The current through an output pin can be in either direction.

the lowest value trim pot i've found was 50 ohms. how could i trim the voltage?

It is the current you need to trim, look at the data sheet and you will see you can get no where close to the current you want from a trimpot, you will just vaporize it.

You can't parallel up LEDs with a single resistor because they will not share current anywhere close to evenly. It might be a pain having a lot of resistors but it is the only way if you use a resistor to limit the current.