Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Will this work??

Status
Not open for further replies.

poolman966554

New Member
i would like to control a bunch of 1 watt leds via Arduino.. The arduino output pins are 5v, and are only rated for 40ma or 50 ma, so i was thinking a transistor is my best solution here.. and that i have a bunch of 2n2222..

I have coded for rgb leds to cross-fade into each other using pwm. Works perfect with 5mm rgbs, but not sure if the transistor i have is capable of the load. Also not sure if grounds need to be tied together?
Ive only put a single series, simply to show what i want to do.

I wanna run these leds around the 300ma range, hence the 2 ohm resistor from battery

2n2222 specs
IC= 800ma
VCE= 30v

EDIT : FIXED PIC


TCaco2U.jpg


Thanks for your time!
 
Last edited:
You're making a rookie mistake, you want an NPN transistor, and the LED's need to be in it's collector, NOT it's emitter.

If you check my PIC tutorials, specifically the 'hardware extras' it gives examples.

The 10K needs to be considerably lower as well, as you want to try and switch the transistor as fully ON as possible - so try and stick 40mA in it's base.
 
You might fry the LEDS if the battery voltage rose to >13.8V, e.g. if charging. Have you considered using a constant-current driver for the LEDs?
 
Assuming the ground of the Arduino is connected to the (-) of the battery.
The base of the transistor is at about 5 volts. The emitter will be at about 4 volts. The voltage across the LEDs is 4 volts.

Try it again. Put the LEDs in the collector. The emitter goes to ground (-).
upload_2014-4-5_10-41-16.png
 
Assuming the ground of the Arduino is connected to the (-) of the battery.
The base of the transistor is at about 5 volts. The emitter will be at about 4 volts. The voltage across the LEDs is 4 volts.

Try it again. Put the LEDs in the collector. The emitter goes to ground (-).
View attachment 85466

ok, i got confused in that pic, i fixed it though.

i wasnt sure the grounds needed to be together. thanks.

what do you mean 4v? 4v addittional to the 13.2 FV of leds?
 
The computer outputs 0 or 5 volts.
The "emitter flower" mode for the transistor can not drive the LEDs with more voltage that the base is at. (The emitter will be 5-0.6 volts = 4.4V at the very most) more like 4Volts.

Don't use a emitter flower configuration if you want more than 4V on your LEDs.
 
just to be clear,
the blue/green leds require 3.3v@ 300ma , and the red series will require 2.1v @300ma
so, the series of 4 blues/greens will require 13.2v, and reds @ 8.4v @ 300ma

I shouldve stated in first post that i dont know the math to calculate transistor values..
also, what calc need applied for voltage drop of resistor? 0.7v?? if so where?

i think im getting confused here, maybe confusing myself over something simple.. Ive never taken an electronics course before
 
Led voltages are not accurate like light bulbs are.
A "3.3V" LED might be 3.1V or 3.5V. If you use four 3.1V LEDs with a 2 ohm resistor and a very accurate 13.8V power supply then their total voltage is 3.1V x 4= 12.4V. The 2 ohm resistor will have a voltage across it of 13.8V - 12.4V= 1.4V. The current is 1.4V/2 ohms= 700mA and the LEDs will soon burn out, especially if the battery voltage is higher.

If the four LEDs are 3.5V each then their total is 3.5V x 4= 14V and they will not light if the battery is less than about 14.4V. The battery might be 12.6V.

Use three LEDs and re-calculate the resistor value so the LEDs light without burning out with any typical battery voltage.
 
1. LED's are current devices. What makes thing wierd, is that you can buy 5V and 12 V LEDs. They have an internal resistor or other stuff in them.
2. The LED drop is largely dependent on color, so you did get that right.
3. The drop is not the same and can vary with temperature.
4. There is a large range of current where the LED will operate.

Now some missing pieces,

A diode TYPICALLY also has a voltage drop and 0.6 or 0.7 V is usually assumed for that. So, therefor a transistor also has a voltage drop when it;s used as a switch. That parameter is Vce(sat) or the Voltage from the collector to emitter in saturation (fully turned on).

So, you can't just add up the voltages of the LED's and transistor drop and call it a day. You have to limit (or regulate) the current to 300 mA which means you will need a bit of wiggle room. A few volts to drop across a resistor.

What you also might find is that the intensity and currents are different for each color so it might be better to have the blues in series with a resistor B and the reds i series with resistor R and greens in series with resistor G.

So, each resistor would be R < (Vled*n-0.7)/0.3A; Wattage of the resistor R > (I^2)*R

You might have to tweek R, to get the same intensity or look at the data sheet.

Your transistor is wrong. You need an NPN with the Emitter tied to ground, the collector to the LED string and a series resistor to your 13.8 V source.

A resistor is needed to limit the base current to the transistor and to turn it on. Again, there is an assumed drop there of 0.7 V to ground.
 
Your transistor is wrong. You need an NPN with the Emitter tied to ground, the collector to the LED string and a series resistor to your 13.8 V source.

i thought i fixed it, and redesigned in the first post just as you described..

ok, after a bit of studying last night, i come up with this to calculate transistor base

2n2222 hfe = 100 - 300. (im gonna use 200 in respect to the currents listed on datasheet)

(5v-.7v) / (.3/200) = 2866.66666 (2.8k)
so, ive taken arduino voltage, subtract transistor voltage drop, and divide current by hfe value. is that correct?

As for the leds, they are 3watt rgbs, but each die is rated at 350ma, hence why i said 1 watt leds.
i will be running 2 series strings of these rgb's, so that will require 6 pins from arduino, , and 6 transistors.

i realize the best method of driving them is CC, but ill need 6 drivers here..
i also understand the voltage curve vs current flow. All thats on the datasheet. I also agree that not every led has same performance, even from the same bin type.

i just used ohms law of r= i/v
blue = (13.8-13.2)/.3 = 2 ohm
green (same as blue)
red = (13.8-8.4)/ .3 =18 ohm

edit:
I2 x R = watts
blue = (.3x.3) x 2 = 18mw (1/4w resistor)
red= (.3x.3) x 18 = 1.62w (2watt resistor)


so, in a led perfect world, am i close??
 
Last edited:
ok, after a bit of studying last night, i come up with this to calculate transistor base

2n2222 hfe = 100 - 300. (im gonna use 200 in respect to the currents listed on datasheet)

(5v-.7v) / (.3/200) = 2866.66666 (2.8k)
so, ive taken arduino voltage, subtract transistor voltage drop, and divide current by hfe value. is that correct?

No, not in this case - as I said in post #2 you want to stick as much current in the base as you can to try and switch the transistor as hard ON as possible - if an Arduino (or what chip it uses) can supply 40mA, then calculate the resistor to provide 40mA to the base. Hfe is meaningless in this case, as it drops greatly as the transistor approaches saturation (so it won't be as high as the lowest figure).

Assuming it did make sense to try and calculate (which it doesn't) you wouldn't choose 200 anyway, you'd choose the worst case of 100.
 
You want the transistor to saturate. The datasheet for the 2N2222 lists hFE when the voltage between the collector and emitter (Vce) is 10V (then it is an amplifier, not a switch) so it is no where near being saturated.
The maximum collector to emitter saturation voltage (Vce SAT) is listed as 0.4V when the collector current is 150mA and the base current is 15mA. The maximum collector to emitter saturation voltage is listed as 1.6V when the collector current is 500mA and the base current is 50mA. Its hFE is not used in a calculation for its saturation voltage loss.

Therefore if the collector current is 300mA and the base current is 30mA then the max VceSAT is probably as high as 1.4V.
If you use a little power transistor instead like a TIP31 then with 300mA collector current and 30mA base current the saturation voltage loss will be much less at typically 0.075V.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top