SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By rappa
#58664
I recently acquired a 3W RGB LED http://www.sure-electronics.net/DC,IC%2 ... L007-2.jpg and now I'm trying to figure out a circuit that will allow me to drive it, using PWM from Arduino/AVR.

My first question is how to power the circuit. Would a 5V power supply be a good choice? Something like this http://www.sparkfun.com/commerce/produc ... ts_id=8269 I want to be able to control each color independently with PWM. The blue and green LEDs have an average Vf of 3.4, and the red is 2.4. The max current is 350mA, so I think I would need at least a 5 Ohm resistor for each color [(5-3.4)/.350 = 4.5], with about .5 W dissipated in each resistor. I already have a 9V power supply but it seems that would just waste more power?

As for interfacing with the Arduino, it seems that the Darlington Array is a popular choice. Am I on the right track? I am looking at the ULN2003 and its data sheet says it can handle only 500mA, so would I need 3 of them, one for each color? Also, I am unsure of what resistor values would be appropriate between the Arduino and Darlington.

Lastly, the LED manufacturer recommends a heat sink for running at max current. What type of heat sink would be a good choice and how would I bond the LED to it? The LED mounted on a nickel-sized aluminum board.

Thanks,

Andrew
User avatar
By bigglez
#58833
rappa wrote:My first question is how to power the circuit. Would a 5V power supply be a good choice? Something like this ... I want to be able to control each color independently with PWM.
The 1A 5V supply is five watts, so you can burn 3W for
the LED, but if you add any extra circuitry later you will
need a larger supply (or two of these).
rappa wrote:I already have a 9V power supply but it seems that would just waste more power?
Correct.
rappa wrote:As for interfacing with the Arduino, it seems that the Darlington Array is a popular choice. Am I on the right track? I am looking at the ULN2003 and its data sheet says it can handle only 500mA, so would I need 3 of them, one for each color? Also, I am unsure of what resistor values would be appropriate between the Arduino and Darlington.
A bipolar transistor array (like the ULN2003)
can be made to work, but a much easier circuit is to
use three N-channel Power MOSFet transistors (PMOSFets).
These do not require any additional components,
as the gate is driven directly form the 0 to 5V
swing form the AVR IO ports. A safety resistor to tie
the gate to ground would be smart, to stop the FETs
from conducting due to open (Hi-Z) drive. A 10k
resistor per FET would suffice.
rappa wrote:Lastly, the LED manufacturer recommends a heat sink for running at max current. What type of heat sink would be a good choice and how would I bond the LED to it? The LED mounted on a nickel-sized aluminum board.
There are two issues, firstly, you must
remove the heat from the LED cluster, and secondly,
you must remove the heat to the air. Heatsinks can be
made form found materials (a metal chassis for example),
or as a separate item. Go to Digi-key or Mouser on-line
and search for "heatsink".

The safest method is to use a much bigger that needed
heatsink to make sure the temp does not rise high
enough to kill the LED cluster. The LED is dumping
3.5W into the metal tab, and the heatsink needs to
dissipate that energy without significant temp rise.
A "one degC per watt" heatsink or better would be
very safe, even allowing for poor contact with the
LED cluster.

The LED cluster can be attached with epoxy glue,
make sure the heatsink does not short out any
contacts on the LED cluster.
By rappa
#58971
I have a few IRF520 N-Channel MOSFET transistors. Would those suffice? I also have a TIP102 and a TIP120 (Darlington).

As for the heat sink, I'm going to try and scavenge one from my collection of old computers/electronics.

Thanks for the help.

Andrew
User avatar
By bigglez
#58985
rappa wrote:I have a few IRF520 N-Channel MOSFET transistors. Would those suffice? I also have a TIP102 and a TIP120 (Darlington).
Yes, use the FETs (they are overkill, unless if you have them already).
rappa wrote:As for the heat sink, I'm going to try and scavenge one from my collection of old computers/electronics.
Be careful not to let the LED cluster overheat. It will die.
By rappa
#59180
If the IRF520 is overkill, could you recommend a better match? I have to order new parts anyhow.

I couldn't find an appropriate heat sink, so will need to order something. Most of what I see online are designed to attach to the top of a component, but in my case I need to attach the bottom of the LED to the sink and somehow secure the sink to the circuit board.

Here's one I found that might work http://search.digikey.com/scripts/DkSea ... 45-1089-ND

The problem I see with this one is that it would need to be upside down and therefore would not transfer heat as well.

Any ideas?
User avatar
By bigglez
#59203
rappa wrote: If the IRF520 is overkill, could you recommend a better match?
Sure! Do you work with SMD/SMT? There are
quite a few small packages to be had, such as SOT223, SOT23,
or even SOT89. For TH (Through Hole) the DIP4 is a good choice.
Anything over one amp, under one ohm, and over 20V
will work. (BTW, the IRF520 is 9A, 270mR, 100V, TO220).
SOT23 (very tiny SMT)
SOT223 (bit larger SMT)
4 PIN DIP
rappa wrote:Here's [a heatsink] I found that might work [...]
The problem I see with this one is that it would need to be upside down and therefore would not transfer heat as well.
That heat sink is very neat in appearance but a little
under performing for your job.
Thermal Resistance @ Forced Air Flow 15.0°C/W @ 200 LFM
Firstly, it expects a fairly strong air flow, much like a
PC silver brick power supply with its own fan.
Secondly, even with air flow its going to rise 15degC * 3W
= 45degC. Assume your ambient is 30degc the heatsink
will be 75degC. The LED cluster will be hotter due to the
barrier from cluster to heatsink (perhaps another 5deC
per watt, worse case) so the LED cluster could reach 90degC.
The LED chips are even hotter due to their thermal
resistance ot the mounting surface (check the datasheet).
Under worse case I wouldn't go pass 100degC for the
chips (less if directed by the datasheet).

Orientation ('upside-down') doesn't matter here, the
moving air is doing the cooling work.

To avoid the fan, use a bigger heatsink (or one with a
lower thermal resistance), as this is the biggest part
of the equation that you can control.
An easy method of attachment is two part epoxy glue.
By unsped
#59273
this may sound dumb, but do you have a diagram handy of an io pin hooked to the mosfet with the safety resistor?
User avatar
By bigglez
#59279
unsped wrote:this may sound dumb, but do you have a diagram handy of an io pin hooked to the mosfet with the safety resistor?
Not a dumb question at all. In fact we have been kicking
around some ideas using FETs driven by uC (PIC) ICs
in another thread.

The physical pinout is in the datasheet. Most are the
same but its wise to check for the actual FET you have.
By rappa
#59293
Thanks for the MOSFET recommendations. I'm looking for something breadboard friendly and easy to solder, so the 4-pin dip seems to be the best bet.

I tried hooking up my LED to the IRF520 MOSFET but it didn't work so well. I uploaded an Arduino sketch that turned the output on and off with a 1 second delay but it never turned off; instead it dimmed a bit but that's it. So any ideas why it wouldn't turn off?

Here's my circuit: http://rappnet.dyndns.org:8080/led-circuit.jpg
User avatar
By bigglez
#59302
rappa wrote: I tried hooking up my LED to the IRF520 MOSFET but it didn't work so well. I uploaded an Arduino sketch that turned the output on and off with a 1 second delay but it never turned off; instead it dimmed a bit but that's it. So any ideas why it wouldn't turn off?
You can do some simple testing with just the FET,
LED and the supply (plus two resistors).

Using the diagram that you posted, disconnect the
FET gate from the Arduino, but keep the resistor
in place. Firstly, return the gate to ground (gate and
source now shorted) and the LED should not light.
If it does your FET is damaged and must be replaced
with a fresh one.

Secondly, connect the FET gate to the five volt supply,
and the LED should light fully. If you have a DMM
handy make and record some voltages and report
them here.

For these voltages measure from ground to the supply,
then across the FET (drain to source) and across both
the LED and the 20 ohm resistor.
By rappa
#59330
Here's what I get:

Gate grounded: LED is offt
Gate at 5V: LED is on
Voltage across drain/source: 33mV
Voltage across LED: ~3.4V

Do the Arduino and power supply grounds need to be common?

I see that some MOSFETs are listed as Logic Level Gate, but I'm not sure if the IR520 is. Would that make a difference?
By winston
#59333
Why not use a purpose built LED power supply IC? Most of them have an input specifically for controlling brightness via PWM, and won't waste a shed load of power like a resistor will (after all, half the point of using an LED is for better efficiency). LED power supplies often can take a wide voltage range.

Purpose built LED power supplies (they are a current regulator - set the current required for your LED) usually just need decoupling caps, an inductor, current sense resistor and a schottky diode as external components.
By rappa
#59337
winston wrote:Why not use a purpose built LED power supply IC? Most of them have an input specifically for controlling brightness via PWM, and won't waste a shed load of power like a resistor will (after all, half the point of using an LED is for better efficiency). LED power supplies often can take a wide voltage range.

Purpose built LED power supplies (they are a current regulator - set the current required for your LED) usually just need decoupling caps, an inductor, current sense resistor and a schottky diode as external components.
Are you referring to a buckpuck http://www.instructables.com/id/SRY2QBSFGJWYVCS/ I only have about .5W wasted in the resistor so I may continue with the resistor method and save this for phase 2. It looks like I would need three of these (one for each color) http://search.digikey.com/scripts/DkSea ... -5961-1-ND plus additional parts so a bit more pricey.
User avatar
By bigglez
#59340
rappa wrote: Here's what I get:

Gate grounded: LED is offt
Gate at 5V: LED is on
Voltage across drain/source: 33mV
Voltage across LED: ~3.4V
Great! your FET is healthy!
rappa wrote:
Do the Arduino and power supply grounds need to be common?
Yes. Every electrical circuit needs to be 'circular'
Current flows out and back to the source.
rappa wrote: I see that some MOSFETs are listed as Logic Level Gate, but I'm not sure if the IR520 is. Would that make a difference?
The idea behind "logic level" FETs is that they turn on
with a logic one and don't require any interface
components. To make it work the FET has to have
a Vth (threshold voltage) lower than the logic one
voltage. Your circuit does, we got the FET to conduct
when you placed five volts on the gate.

The IRF520 VGS(th) requires 2.0V min to 4.0V so its
not a 3V logic level compatible device.

If your Arduino/AVR was running from 3V instead of
5V the FET may not work!