Driving 3W LEDs with PWM on Arduino?

Hello everyone,

I'm a bit unsure as to what method I can use to drive some powerful LEDs. Here's the question - I have some powerful 3W LEDs which I plan to flash on and off and to modulate using PWM. However the output from the Arduino can only support perhaps 20mW LEDs, and not 3 W ones.

I've heard that it is possible to use a IRF520 MOSFET which is connected to the Arduino output and my powerful LEDs to light them up, but I have heard that the IRF520's are not 'logic-gate' and do not turn on fully - so does this not work? Some people also have used a 'Darlington array'. Does anyone have any chips I can use for this purpose? It should be able to switch at least 1A and do so fast enough for PWM.

Thanks a lot everyone!

First I'd try simple 3W LEDs driving, without PWM. Don't try to solve complex task with no experience in less complex.

Use this simple solenoid drive circuit and instead of the solenoid wire your LED with current limiting resistor or current driver in it's place. The TIP102 is a cheap common NPN transistor that will handle your current fine. You will need to pick a digital output pin that supports PWM analogWrite commands: http://arduino.cc/en/Reference/AnalogWrite

Lefty

Thanks for the help; I'll definitely try out some TIP102s.

Regarding the circuit diagram; lets say I am powering my big LED using a high current 5V DC supply and I am powering my Arduino using the USB power - does this mean I have to connect the - part of my 5VDC to Arduino's ground?

Does anyone know why the IRF520 would not work in this case?

Cheers.

loneoceans:
Thanks for the help; I'll definitely try out some TIP102s.

Regarding the circuit diagram; lets say I am powering my big LED using a high current 5V DC supply and I am powering my Arduino using the USB power - does this mean I have to connect the - part of my 5VDC to Arduino's ground?

Does anyone know why the IRF520 would not work in this case?

Cheers.

Yes you will have to wire your external 5vdc power supply negative terminal to a arduino ground pin. That transistor will not conduct base current without that connection.

A IRF520 won't work because it's a standard N-channel MOSFET that requires +10vdc gate/source voltage to fully turn on for rated current flow. A logic level N-channel MOSFET will fully turn on with just +5vdc output voltage from a arduino output pin. Here is an example of a true logic level mosfet:

Lefty

Hi,

Thanks for the help! Just one more question to make sure I get everything right:

I understand that the TIP102/120 transistor should be able to switch my PWM LEDs just fine (right?), and also the logic-level MOSFET RFP30N06LE should be able to do the same thing also. The question is what is the basic difference in terms of operation and capability between these two devices? Why would one choose one over the other?

Thanks for helping a beginning! :slight_smile:

retrolefty:

loneoceans:
Thanks for the help; I'll definitely try out some TIP102s.

Regarding the circuit diagram; lets say I am powering my big LED using a high current 5V DC supply and I am powering my Arduino using the USB power - does this mean I have to connect the - part of my 5VDC to Arduino's ground?

Does anyone know why the IRF520 would not work in this case?

Cheers.

Yes you will have to wire your external 5vdc power supply negative terminal to a arduino ground pin. That transistor will not conduct base current without that connection.

A IRF520 won't work because it's a standard N-channel MOSFET that requires +10vdc gate/source voltage to fully turn on for rated current flow. A logic level N-channel MOSFET will fully turn on with just +5vdc output voltage from a arduino output pin. Here is an example of a true logic level mosfet:

N-Channel MOSFET 60V 30A - COM-10213 - SparkFun Electronics

Lefty

The MOSFET has a low Rds, that is resistance between drain & source.
If you have 3W, 5V, Power equation Pwatts = Icurrent x V volts, thus 3W/5V = 600mA of current thru the switching device.
You will need a current limit resisto also.
P=IV, doing some substituting with Vvolts=Icurrent x Rresistance, you can obtain P = I x I x R, and P = (V x V)/R
The MOSFET with its low Rds of say 5 mOhm (0.005 ohm) will dissipate 600mA x 600mA x 5mOhm = 1.8mW of power,
while the transistor with a typical voltage drop of say 0.5V from collector to emitter will dissipate 500mV * 600mA = 300mW and run much hotter.
The MOSFET only needs a very small amount if curre20.6nt to switch its input Hi/Lo, while the NPN transistor will need many mA of current to turn it on.
If the NPN has a gain of say 150, then to allow 600mA to flow thru you will need 4mA to turn it on.
If the gain is less, then more base current is needed. And the device must dissipate that power as well.
You haven't said what the voltage drop across the LED is while it is turned on. Say it is 3V. The other 2V (less the transistor drops) must be dissipated across the current limit resistor. So 2V/600mA = 3.3ohm resistor, rated for 0.6 x 0.6 x 3.3 = 1W, so you'd go with a 2W part for safety.

Does that help?

Just read the sparkfun part's datasheet: rDS(ON) = 0.047?
Kind of high, there are better parts availavble, this is okay for 600mA tho, dissipating 17mW.

loneoceans:
Hello everyone,

I'm a bit unsure as to what method I can use to drive some powerful LEDs. Here's the question - I have some powerful 3W LEDs which I plan to flash on and off and to modulate using PWM. However the output from the Arduino can only support perhaps 20mW LEDs, and not 3 W ones.

I've heard that it is possible to use a IRF520 MOSFET which is connected to the Arduino output and my powerful LEDs to light them up, but I have heard that the IRF520's are not 'logic-gate' and do not turn on fully - so does this not work? Some people also have used a 'Darlington array'. Does anyone have any chips I can use for this purpose? It should be able to switch at least 1A and do so fast enough for PWM.

Thanks a lot everyone!

HI Loneoceans
I think this simple dual channel PWM Arduino shield will help you to drive your power led.
I tested it with 3pcs of 1w leds and 1pcs of 10w. Later I will upload some images.
DIY-GreenE

Forget the TIP102, that type of device (Darlington transistor) is pretty much obsolete. If you use them to switch high currents, they get hot because they have a large saturation voltage (i.e. voltage drop) and a mosfet is a better solution. At low currents, a carefully chosen bipolar transistor will have enough gain and lower voltage drop than a darlington.

A good mosfet for many applications is the IRLU8726PBF - it is inexpensive, has logic level gate drive and a very low Rds(on). A good bipolar transistor for switching modest currents (up to 1A or a bit more) is the ZTX851.

I have heard that the IRF520's are not 'logic-gate'

That part is correct.

and do not turn on fully

That part is also correct, assuming you are talking about 5v Vgs.

  • so does this not work?

That part is incorrect. For low current applications (like yours), a IRF520 will work. It will have slightly higher dissipation but not so much to be of any real concern.

The issue with driving those mosfets matters for high current applications where conduction losses dominate.

Both IRF520 and IRF510 are remarkable devices in that they have exceptionally low gate capacitance (vs. their peers), making them ideal to be driven by a mcu.

I sell a board for exactly this purpose: http://shop.elcojacobs.com/powerleddriver

Article on how to use it here: http://www.elcojacobs.com/using-shiftpwm-to-control-350ma-high-power-leds/

You could try something like this but note there is no PWM. and it's a 12V bottom Rail for not just one LED but LED Strip.

int BluePin = 11;
int RedPin = 10;
int GreenPin = 9;

String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete



// the setup function runs once when you press reset or power the board
void setup() {
 // initialize digital pins as an output. Also get Serial ready.
 pinMode(BluePin, OUTPUT);
 pinMode(RedPin, OUTPUT);
 pinMode(GreenPin, OUTPUT);
 Serial.begin(9600);  //setup Serial port for terminal
 // reserve 200 bytes for the inputString:
 inputString.reserve(200);

//Set Pins to low to turn off LEDS
 digitalWrite(BluePin, LOW);
 digitalWrite(GreenPin, LOW);
 digitalWrite(RedPin, LOW);
}


void serialEvent() {
 while (Serial.available()) {
   // get the new byte:
   char inChar = (char)Serial.read();
   // add it to the inputString:
   inputString += inChar;
   // if the incoming character is a newline, set a flag
   // so the main loop can do something about it:
   if (inChar == '\n') {
     stringComplete = true;
   }
 }
}

// the loop function runs over and over again forever
void loop() {
serialEvent(); //call the function
 // print the string when a newline arrives:
 if (stringComplete) {
   color (inputString);
   // clear the string:
   inputString = "";
   stringComplete = false;
 }
 
}

//Colors
void color(String PinColor) {
 Serial.println("Checking Color.....");
 int pin = NULL;
   
 if (PinColor == "Blue\n") {
   int pin = BluePin;
     Serial.println("Turning on Blue");
     fadein(pin);
 } else if (PinColor == "Red\n"){
   int pin = RedPin;
     Serial.println("Turning on red");
     fadein(pin);
  } else if (PinColor == "Green\n"){
   int pin = GreenPin;
     Serial.println("Turning on Green");
     fadein(pin);
 }else if (PinColor == "off\n"){
     Serial.println("Turning off all colors");
     digitalWrite(RedPin, LOW);
     digitalWrite(GreenPin, LOW);
     digitalWrite(BluePin, LOW);
     Serial.println("");
 }else {
   Serial.println( "No color found" );
   delay(2000);
 }




}
void fadein(int pin)
{
   for (int i=0; i <= 1000; i++){
   digitalWrite(pin, HIGH);   // turn the LED on (HIGH is the voltage level)
   delayMicroseconds(i);
   digitalWrite(pin, LOW);    // turn the LED off by making the voltage LOW
   delayMicroseconds(i + 1800);
  }
  Serial.println("Fade in done...");
  digitalWrite(pin, HIGH); 
 }

I wonder if you noticed the date of the previous post to this thread? :roll_eyes: