Hello everbody! new to the community, look forward to learning lots!
i would like to crossfade 1w rgb leds with pwm, but i cant directly do it off arduino. so i was thinking of using a transistor, but need help calculating values of base, and collector resistors..

Id like the leds to run around 300ma.
by my Ohms math of R=V/I
Blue/green(3.3v) - (13.8-13.2)/.3 = 2ohm
red(2.1v) - (13.8-8.4)/.3 = 18ohm
now i know just enough that, thats not right.. because somewhere, i have to factor in the base voltage from arduino to the emitter..
i found a transistor base calc, and it said for a 2n2222, to use a 1.3k resistor to be able to saturate the transistor.. not sure what/how to calculate R1 or R2, or where to add the .7V drop of transistor itself..

Any help would be greatly appreciated!!

Heres an example of the blue circuit from arduino:

Typical gain hfe for a 2n2222 is between 100 and 300. If you figure 200 then 5V-0.7V=4.3V/ [0.3A/200]=2.8k ohm for R1
.3A/200=0.0015, (gain of 200 so R1 current should 1/200th Collector current. Your calculation for R2 is ok but even though the
calculation for R1 comes out to be 2.8k ohm, I would say go ahead and use a 1 k ohm because you are already limiting the current with R2
13.8-13.2)=0.6V
0.6V /2 ohm = 0.3A

0.3A/200=0.0015A
(5V-0.7V=4.3V/ [0.3A/200]=2.8k ohm for R1)
Anything between 1 k and 2,8 k is fine.

raschemmel:
Typical gain hfe for a 2n2222 is between 100 and 300. If you figure 200 then 5V-0.7V=4.3V/ [0.3A/200]=2.8k ohm for R1
.3A/200=0.0015, (gain of 200 so R1 current should 1/200th Collector current. Your calculation for R2 is ok but even though the
calculation for R1 comes out to be 2.8k ohm, I would say go ahead and use a 1 k ohm because you are already limiting the current with R2
13.8-13.2)=0.6V
0.6V /2 ohm = 0.3A

0.3A/200=0.0015A
(5V-0.7V=4.3V/ [0.3A/200]=2.8k ohm for R1)
Anything between 1 k and 2,8 k is fine.

This is the answer i was searching for! thank u very much for writing it out, it get the math now.
i didnt see a "thanks" button, or anything.. or ida def engaged!
Thanks again!

The "karma" button on the left is the "THANKS " button. Just click that whenever you get a reply that answers a question.

That gain of 100 to 300 is for small signals only. If you want to drive a transistor to saturation, you'll need a lot more current than indicated from that. Gain goes down as the transistor reaches saturation, and you want the transistor to be fully On.

I usually use about a 10:1 ratio to fully saturate a 2N2222. So for 300mA, I'd push 30mA into the base.

This PDF specifies 15mA IBE for 150mA ICE with VCE(sat) of 0.3 to 0.4V, and VBE(sat) of 1.2 to 1.3V, depending on if it is a 2N2222 or 2N2222A.

So 5V - 1.3V = 3.7V, 3.7V/30mA = 123 ohms so use R1 = 120 ohms

As for the current limiting resistor on the LEDs, I think you'll need to split the blue/green LEDs up into two parallel strings. That battery is going to vary in voltage quite a bit. If you don't leave enough headroom, the current in the LEDs will vary widely as the battery goes from fully charged to discharged. The red LEDs should be fine.

So for blue/green at 3.3V per LED, (13.8 - (2 x 3.3 + 0.4))/0.3 = 22.7 ohms or 22 ohms in two sets of 2 LEDs with one 22 ohm resistor on each string. That's about 6.8V of headroom.

For Red at 2.1V per LED, four in series is fine. (13.8 - (4 x 2.1 + 0.4))/0.3 = 16.7 ohms or 16 ohms. That is only 5V of headroom.

As the voltage drops from 13.8V to 12V, current in the blue/green LEDs will drop to about 73.5% or about 220mA, current in the red LEDs will drop to about 64% or about 190mA.

I wouldn't be too quick on thinking you have an answer. Plug it in, take some measurements.

I agree about two strings and separate collector resistors (ie: R2 ,R3)
We don't have a parts list yet says how many of each color.
He just said 4 and mention red and blue.

polymorph:
That gain of 100 to 300 is for small signals only. If you want to drive a transistor to saturation, you'll need a lot more current than indicated from that. Gain goes down as the transistor reaches saturation, and you want the transistor to be fully On.

I usually use about a 10:1 ratio to fully saturate a 2N2222. So for 300mA, I'd push 30mA into the base.

This PDF specifies 15mA IBE for 150mA ICE with VCE(sat) of 0.3 to 0.4V, and VBE(sat) of 1.2 to 1.3V, depending on if it is a 2N2222 or 2N2222A.

So 5V - 1.3V = 3.7V, 3.7V/30mA = 123 ohms so use R1 = 120 ohms

As for the current limiting resistor on the LEDs, I think you'll need to split the blue/green LEDs up into two parallel strings. That battery is going to vary in voltage quite a bit. If you don't leave enough headroom, the current in the LEDs will vary widely as the battery goes from fully charged to discharged. The red LEDs should be fine.

So for blue/green at 3.3V per LED, (13.8 - (2 x 3.3 + 0.4))/0.3 = 22.7 ohms or 22 ohms in two sets of 2 LEDs with one 22 ohm resistor on each string. That's about 6.8V of headroom.

For Red at 2.1V per LED, four in series is fine. (13.8 - (4 x 2.1 + 0.4))/0.3 = 16.7 ohms or 16 ohms. That is only 5V of headroom.

As the voltage drops from 13.8V to 12V, current in the blue/green LEDs will drop to about 73.5% or about 220mA, current in the red LEDs will drop to about 64% or about 190mA.

actually, ill have 4 of each in series( each with own transistor)
4 reds, on Output 9
4 blues on output 10
4 greens on out put 11

i only showed 1 series circuit so i didnt have to draw for an hour in MSpaint, to get my question across.

i must be blind, but i still cant find a "karma"button on the left??
i see a star, but nothing i can "obviously" click
Maybe my accounts too new? idk. ill take screenshot if needed

For the blue and green LEDs, I'd put them 2 in series with a resistor, and another 2 in series with another resistor.

However, 30mA is about the maximum you should ever take out of an Arduino pin. So you should use two separate circuits from different pins. Also, 600mA would be a bit too close to the maximum current allowed in a 2N2222, and we've not even considered the power dissipated.

Under where it says "karma", there is a little Plus sign + with a number next to it. You click on the Plus sign to add to a person's karma.

Id like the leds to run around 300ma.

Alarm bells. !!!

If you are running LEDs at this sort of current then a current limiting resistor will not cut it. This is because the forward voltage drop will change too much with heat and age. You actually need a constant current supply to drive LEDs safely at this current.

Grumpy_Mike:

Id like the leds to run around 300ma.

Alarm bells. !!!

If you are running LEDs at this sort of current then a current limiting resistor will not cut it. This is because the forward voltage drop will change too much with heat and age. You actually need a constant current supply to drive LEDs safely at this current.

hmm. any suggestion of an lmxxx? or maybe a cheap preassembled china chip? im trying to be cost effective here, as budget is requiring that..

polymorph:
Under where it says "karma", there is a little Plus sign + with a number next to it. You click on the Plus sign to add to a person's karma.

still cant find it? iswear im not being a troll!! maybe circle it ?
this seems ridiculous i cant find it

May be there is a minimum number of posts before you can Plus someone's karma.

I agree with Grumpy_Mike, a constant current sink is a good idea for something with this much current.