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:
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?
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.
@ 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.
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?