Arduino PWM for 1W LEDs

I've ordered this 3W RGB LED with a max of about 350mA per color. I also got some NPN transistors (PN2222) and a 5V 2A power supply.

I have a circuit with an Atmega168 driving a 5mm RGB LED with PWM, but it's not very bright, so I'd like to use the more powerful LED. I was hoping that I could just use the NPN transistors and some resistors to power it. Something like the following schematic, which has a 5V source:

circuit

But I've been trying to research the correct way to drive a 1W LED with a microcontroller and I'm seeing people say that resistors aren't the way to go for large LEDs, and that it should be a constant current driver. I'm not sure exactly what I'd need though.

Do I need something like the PicoBuck LED Driver? Are there cheaper options that will let me power a 350 mA LED with 5V power and PWM?

I'm guessing with the PicoBuck, I wouldn't need transistors since PWM goes right into the driver. But are there less pricey constant current drivers where I would do the PWM into transistors?

circuit

You have the transistors installed wrong.

Emitter goes to GND.

Change 1k to 220R.

Oh oops, yeah I know how they're supposed to go, I didn't notice the schematic symbol was upside down.

Someone on Reddit did this calculation to get the 1K:

Let's assume you want to 500mA collector current, and conservatively assume beta is ~100. That means base current will be 100x smaller than collector current, or 5mA. Let's also assume you're running your atmega off of 5V, so a high on a port pin will be 5V. The BE junction will drop 0.7V (being a diode), so to make Ib = 5mA you need a base resistor = (5 - 0.7)/0.005 = 860 ohms. A 1k resistor will give you a base current of 4.3mA, which probably is enough.

We are trying to saturate the transistor.

@ 350mA = Ic, you want 1/10 that value for base current to fully saturate the transistor.

(5v - .7v) / 220R โ‰ˆ 20mA which is less than 35 but 20mA is a safe value for an UNO output pin.

When connecting your circuit always confirm the transistor Vce ON voltage (saturation voltage).
If this sits at less than Vbe (.7) we have saturation, even better about .4v or less is great.

If this still happens at Rb = 1k you are fine.

A logic level MOSFET is a better choice over the BJT.

Something like this? https://www.mouser.com/ProductDetail/onsemi-Fairchild/FQU13N10LTU?qs=%252BcPjv7P54lb2seXL0rOAzg%3D%3D

If I can do it with the NPN's that'd be nice since they're already on their way.

That looks good; at 350mA V(ds) will be โ‰ˆ.05v very low :+1:

Also here are some that I use.

1 Like

Assume Vce(sat) you measure was .7v
.7v * .35A = 245 mW. (1/4 watt should run cool).

If the Vce is < .7 (smaller is best) you will be okay.

Ok, thank you.

I found a really good guide for making a cheap current regulator that I think I'm going to try. It uses an NFET and an NPN:

FHYYUTRRCQEWP86JFY

At only 350mA your first circuit will work fine.

You would need a 2 watt 12ฮฉ.

W

I'd seen people say that with just a resistor, it's hard to keep a >1W LED current constant with the LED changing voltage with temperature and whatnot, so there's risk of it being too dim or burning out.

It'd need to be a different resistor for red vs blue/green though, since it has a lower voltage drop, right?

Yes.


If you want perfect current regulation, solid state will be the way.

Similar cct. to yours.

I'll probably experiment with both methods.

Oh cool. It is a very satisfying concept for current regulation.

Keep in mind the series pass transistor will need heat sinking.

Assume Red LED, 2V.

.6v across emitter resistor R2

Vce = 5v - .6v - 2v = 2.4v

W(transistor) = 2.4v * 350mA = 840mW.

I was planning some sort of heat sink for the LED, so I'll try to make it work for the transistor too.

I'm a little confused on this. Don't transistors act like short circuits, meaning 3V drop on the resistor?

Sorry, 0.6v across R2

V(R2) cannot go higher than Vbe of Q2 โ‰ˆ.7 to .8v

At about .6v, Q2 starts conducting.


In a constant current source like this, the transistors are operated in the linear mode i.e. not ON/OFF.

If you want 350mA
R2 = .6 รท 350mA โ‰ˆ 1.7 ฮฉ

When the R2 voltage gets to โ‰ˆ .6v Q2 turns ON, Q2 steels base current from Q1 therefore the current thru Q1 is locked at (in your case) 350mA.

The voltage Vce on Q1 is = 5v(supply) - .6v(R2) - 2v(led) = 2.4v

W(Q1) = 2.4v * 350mA = 840mW

Awesome, I didn't actually understand the circuit until your explanation.

I had thought that transistors act like diodes that always have a .6V drop. Or is that just between base and emitter?