Drivers for three 1W LEDs with PWM control from ATmega8

I want to control three 1W (~320mA) power LEDs using PWM from ATmega8 (yep, this is a well-known "mood lamp" -- seems to be a "hallo world" for Arduino :)). My plan is to use three BC337 or three channels of ULN2003A on PWM pins to control load, but I'm not sure about LED drivers.

It seems I will have 1.5A power brick with 9V or 12V output (I'll try to get 9V for minimun power loss) for powering the project (LEDs and MCU). So I'm wondering which voltage regulation\led driver combination is the best:

  1. 9-12V power supply -> LM7805 -> simple resistors as LED drivers. LM7805 is rated at 1A, three LEDs will have ~ 960mA, for sure LM7805 will be very hot.

  2. 9-12V power supply -> LM7805 -> MCU (just for MCU). LED drivers on LM317T connected to 9V (http://led.linear1.org/a-cheap-current-regulated-luxeon-star-driver-design/1/)

  3. 9-12V power supply -> LM317 as regulator to 5V (it is rated at 1.5A) --> simple resistors as LED drivers

Questions:

  1. Will LED drivers on LM317 be more efficient than resistors in such configuration?

  2. I like the option #1, but the question is may I use more than one LM7805 in a circuit (if I connect their grounds). Can I connect MCU and one LED to one LM7805 and two other LEDs to another LM7805?

  3. If there is any other LED driver cicruit with PWM input support?

Thanks in advance!

If you are going to use a current regulator approach, each leg (or COLOR) will need its own current regulator otherwise each individual LED as it changes brightness will affect all the other LED's brightness.

Yes, I will need 3 LM317, and it seems that this will not be more efficient than simple resistor. What do you think?

317 is overkill I think. Just figure out your current requirements for each module and select a appropriate current limiting resistor and do a power calculation so you understand if you need higher WATT resistors.

I did the same with an atmega88 recently.

I've used a constant current driver with mosfet found at the instructables-site. It took me 4 components/colour worth $3 in total.

Basics of the driver are described here :

In step 6-8 of the next instructable (same author) is shown how you can use an pwm-pin to drive it.

BTW, My dog strongly disagrees the "Lightning" menu of my mood light is part of an "Hello World" application ]:slight_smile:

Simpson_Jr:
I did the same with an atmega88 recently.
I've used a constant current driver with mosfet found at the instructables-site. It took me 4 components/colour worth $3 in total.

Basics of the driver are described here :
http://www.instructables.com/id/Power-LED-s---simplest-light-with-constant-current/

In step 6-8 of the next instructable (same author) is shown how you can use an pwm-pin to drive it.
http://www.instructables.com/id/Circuits-for-using-High-Power-LED-s/

I've found this tutorial too, but I haven't found such FETs locally, what is a subsitution?

What power supply have you used? How efficient (how hot :)) were drivers?

Simpson_Jr:
BTW, My dog strongly disagrees the "Lightning" menu of my mood light is part of an "Hello World" application ]:slight_smile:

Sorry, I haven't understand the joke :frowning:

artvolk:
I've found this tutorial too, but I haven't found such FETs locally, what is a subsitution?

What power supply have you used? How efficient (how hot :)) were drivers?

I used the IRF540. My mood light uses 3x3 watt leds and is powered by PC, 5 volt.
The driver of the red led, tuned at 1.2 amps, warms up a little after several minutes full power,
but it's hardly mentionable. Mosfets for blue and green, tuned to 1 amp, don't warm up at all.
The 3 watt resistors I used don't heat up at all.

At 5 volt, single led, it seems pretty efficient, at higher voltages it will be less, but probably efficient enough
to drive a 1 watt led without needing a heatsink for the mosfet.

artvolk:

Simpson_Jr:
BTW, My dog strongly disagrees the "Lightning" menu of my mood light is part of an "Hello World" application ]:slight_smile:

Sorry, I haven't understand the joke :frowning:

She seems to understand thunder&lightning outdoors, but indoors, no way...
Normally she's not afraid fast, but this was true panic.
She's 10 years old, I had never seen her like that.

I deleted the routine and I'm still thinking of replacing it with some sort of thermometer, showing more red when it's hot / blue when it's cold.

Should... you have some carved crystal vases/glasses, they're great in combination with an RGB-Moodlight.

Thanks for the detailed description!

I've browsed instructables (second tutorial have a lot of circuits) and sorry, one question left:

  • Say, I have 5V power supply and single 1W LED on a channel (3.3V drop, 320mA) it seems that with any circuit (except switching regulators) will turn (5-3.3)*0.32 = 0.5W into heat. So is there a reason to use constant current source on FET from instructables instead of simple resistor?

  • If I have 7V or 9V power supply and single 1W LED (3.3V drop, 320mA), is it true that using either method (linear regulator like LM317, regulator on FET, simple resistor) it will burn (Vin - 3.3V)*0.32 into an air.

I just want to make sure that I understand everything right.

P.S. Does your dog like your other projects? :slight_smile:

I did play a lot with electronics as kid, haven't done for years and started again about 18 months ago,
so I hope someone will correct me when I'm wrong.

As far as I understood, your reasoning is right, all will burn (Vin - 3.3V)*0.32 into the air.
That's probably also why the mosfet of my red Led heats up most, its voltage drop is 2.4V.

Maybe a DC-DC converter wouldn't, but I didn't really look into that... too much components/techniques to discover after so many years :wink: The buck-puck seemed interesting, but... far to expensive.

Main reason for me was that the voltage drop of the green/blue leds was quite high, the voltage drop of normal NPNs I had laying around would also be quite high and I was afraid I never could light 'm full power at 5 volts. A Led powered with less volts as its voltage drop hardly lights up.

I also bought 3 Leds of each colour, not realising they were so bright and had the intention to use a 12 volt supply, but 2 more atmegas/attinys and mosfets is probably better for me and more fun.

Electronic projects my dog likes.... you've got me there !
Fortunately she doesn't mind the other simulations, candle, full spectrum loop or the random changes.

Thanks for such detailed responses!

Main reason for me was that the voltage drop of the green/blue leds was quite high, the voltage drop of normal NPNs I had laying around would also be quite high and I was afraid I never could light 'm full power at 5 volts.

Can I ask what NPN has such big voltage drop? I plan to feed 1W LED from 5V with resistor and PWM it using plain old BC337. Will BC337 introduce voltage drop on its own?

Can I ask what NPN has such big voltage drop? I plan to feed 1W LED from 5V with resistor and PWM it using plain old BC337. Will BC337 introduce voltage drop on its own?

It's a part of electronics I don't really understand completely yet, the data sheet of the 337 speaks of an collector-emitter saturation voltage of 0.7 volts at 500 Ma. I don't know whether that is/works exactly the same as voltage drop, but... I calculated it as such. 4.3 volts to power the led would... be enough by "my" calculations, but I welcome anyone explaining whether my reasoning is right.

I had several different BD-darlingtons with CE saturation voltages ranging from 1.8 up to 3 volts and guessed those wouldn't work for that reason.

Thanks for the response. I should look what saturation voltage really is. If someone can explain in two words -- will be great.

It seems things are not so straightforward as I thought, again some questions:

  1. If I power my LED from 5V source via ULN2003A (PWM controllable) which have 1.2V saturation voltage, should I calculate resistor for 5V input voltage or for (5V-1.2V)? The same story with any other transistor -- should I consider saturation voltage while calculating resistors?

  2. Thanks for the reply, one quick question about BC337 (or any other transistor) parameters:
    http://www.translocal.jp/radio/micro/bc337.pdf
    How I can calculate how much current I need to feed to the base to fully open (saturate) this particular transistor? I want to use it as a switch for PWM.

  3. How can I check if transistor is fast enough to switch with PWM frequency (200-500 kHz)?

Thanks in advance!

Ok, so there is no separate spec for base max current, and I can calculate max like Ic/hfe, for BC337 it will be 0.8A / 60 (min value) ~ 10mA. By the way, what is "Base Emitter On Voltage" (Vbe (on))?

I have PWM simple 20mA LEDs using BC337 and ULN2003A, both are silicon and it works. BC337 fT is 100Mhz, doesn't this matter that it's max frequency is 100Mhz?

Thanks!