LED too dim when controlled via PWM

Hi,

I am trying to make an adjustable control of a 10W LED ( e.jpg (458×458) (greenice.com) ) using Arduino Nano and a TIP 120 transistor.

My schematic is like this ( LizEmfb.png (1596×774) (imgur.com) ), except my transistor is TIP 120. Signal is connected to D5 on the Nano.

There are two issues:

  1. With the following code, LED flickers once and then stays off, despite D5 giving off constant 5V, which, according to the TIP 120 datasheet, is above the voltage threshold.
int led_pin = 5;

void setup() {
  pinMode(led_pin, OUTPUT);
  analogWrite(led_pin, 255);
}

void loop() {  
}
  1. With the following code, the LED does light up, going up and down the brightness, but it does not achieve full brightness - only a third of it's capacity according to the PSU powering this LED (LED is consuming only 0.3 A with this setup. Without transistor it usually consumes 1.0 A).
int led_pin = 5;

void setup() {
  pinMode(led_pin, OUTPUT);
}

void loop() {
  for(int i=0; i<255; i++){
    analogWrite(led_pin, i);
    delay(20);
  }
  for(int i=255; i>0; i--){
    analogWrite(led_pin, i);
    delay(5);
  }
}

Questions:

  1. Why does LED only blink once if full-cycle PWM is supplied, but stays on if PWM is changing?
  2. Why does it not reach full brightness even when PWM is at max?

One more note: if I supply 12V to the TIP 120 signal instead of using D5 on the Nano, the LED achieves full brightness. But the specs clearly state that 5V should be plenty to fully open this transistor.

FYI - That's not a "proper" LED driver. LEDs are "current driven". You feed them the proper current and the voltage "magically falls into place"...

Pretty-much the opposite of everything else. It's not easy to build a constant-current (1) supply yourself. With regular little LEDs we use a resistor to limit/control the current but with high-power resistors that requires a high-power resistor and it's just not efficient. For this to work you also need "extra voltage" to drop across the resistor.

LEDs are non-linear.... Their resistance goes down when voltage goes up. A slight voltage increase can over-power and burn it up and a slight voltage decrease will make it disproportionally dim.

There is voltage drop across the transistor. The datasheet says 2V at 2A. (That's the "saturation voltage"... The voltage drop when the transistor is fully-on.) There is probably a graph showing the saturation voltage at 1A but I didn't "study" the datasheet.

It may also be overheating. If it's too hot to touch you should add a heatsink. The LED needs a heatsink too (if you're going to run it at full-power).

MOSFETs tend to be more efficient (less voltage loss and less heat when saturated).

Transistors are also current-driven, so although 5V is enough voltage you may not be getting enough base current. You can try a lower-value base resistor. 1K should be OK but you really want to "slam-on" the transistor, so maybe try around 250 Ohms.

(1) Since you want dimming, technically you want a controlled-current power supply (or a variable constant-current supply).

Hi @DVDdoug, thank you for your reply. It is still not clear to me: why exactly is it bad to control LED brightness with voltage? It seems to be very effective, as it both decreases the brightness and power consumption. Will LED last less if I run it at half voltage?
I will be running this LED off a 3S Li-Po cell, and the purpose of dimming is to save battery when full power is not needed.

The LED will have heatsinks, but the driver will not, because electronics will be in a watertight enclosure, so I am looking for a solution that doesn't produce any significant heat.

So if for some reason dimming via voltage is bad, how exactly would I build a current-control circuit here?

Sorry but any electronics in an air tight container will struggle with the smallest amount of heat, if the walls of the container are an insulator. You need a heat sink on the outside of the container with bolts connecting it to a heat sink on the inside.

It is not just bad it is stupid with a high power LED. Unless you know and understand that you will not get far.

If you use a conventional constant current that you could build yourself you would not achieve your aim of saving battery power, you just burn up the excess as heat.

What you need is a switching constant current driver, which is difficult to build as the layout required is critical, way too advanced for someone asking these sorts of questions. So you buy a board with it ready build.

Stupid why? I attempted to dim my LED by hooking it up directly to my PSU, dropping the voltage, and observing the wattage. It drops very rapidly as the LED dims, which is exactly what I need. If it works, why is it stupid?

Do you have any suggestions of a compact board that would do this? I have very limited space in this enclosure (which is why I wanted to use transistors).

Well for a start because you didn't read the other post from @DVDdoug which told you how power LEDs work. LEDs are basically current driven none liner devices.

With low power LEDs you can get away with a simple resistor to mimic the effect of a constant- ish current supply but this breakers down when the resistors needed are too low to be effective. The forward voltage drop of a power LED will change with temperature and age, so while you might set it up right driving it with voltage successful at first it will soon be off and damage the LED. So no one that knows and understands this behaviour would possibly design a system like this. Ergo anyone who does understand this, could be considered stupid, because it is a stupid design.

Anyone who doesn't understand this needs to be told. And listen when they are told.

I did read Doug's post.

So you're saying that even if I run my LED at less than 12V, it will still get damaged? It needs to be exactly 12V for LED to function properly? Considering that I will be running it off 3S LiPo, this means voltage will vary, and eventually drop to around 11V. Will this damage the LED as well?

But you appear not to have understood it.

No, please read what I said before.

No, to function properly it has to be driven with the correct amount of current, voltage is not an issue.

You appeared not to be able to understand voltage is not important, it is all down to the current.

Okay, thank you for the explanation and your patience. I think I get it now. So what kind of a current regulator should I use? I am searching for switching constant current driver, but all of them seem to be aimed at controlling voltage, not current, and they also have massive heat sinks, indicating that they are not very efficient and create lots of heat.

Perhaps you need to provide actual links to justify that assertion as we do not believe it! :roll_eyes:

Ok, for example: https://www.aliexpress.com/item/1005001454543782.html

I know it says "motor controller", but this is all I can find by searching for "current controller". The rest are just buck/boost converters, which deal with voltage, not current. I need output voltage to be the same as input, but control the current with the PWM from Arduino. I can't seem to find any module that does this.

How about searching for what you actually want? Give it a try

Say
High power led constant current driver

Sorry. You mean something like this? https://www.aliexpress.com/item/1005001526115784.html

Or this one? https://www.aliexpress.com/item/4000052126087.html (prohibitively expensive, unfortunately).

Sorry for stupid questions, I am still trying to get the hang of this. I want to find a solution that is better than my "stupid" one, but so far what I find is oversized and overpriced items, which makes the "stupid" solution look better in comparison...

No. If you really believe that then it is time to give up this hobby and take one more suited to you.

I think you need to get more realistic in what you consider expensive, just over a fiver each. Note that that board does not allow you control over the current so it won't dim.

I don't know, I am actually seeing lots of projects on the internet where people dim high-power LEDs with voltage alone. I understand it is not the "right" way, but if it works, why not?

I meant the module from the second link is too expensive. First one would be okay, but you said it won't allow me to control current. So what exactly am I looking for? I hate to ask others to do searching for me, but I searched myself for over 2 hours with what you suggested, and I still can't find the right thing. I don't even know how to recognize it. Again, sorry for being such a newbie.


Well now, that one is interesting - it is for PWM driving a motor of up to 20 A at 60 V which means about 1 kW, not 10 W. It has no control of current as such, it just switches.


This one is a boost module, rated up to 250 W - or so it says. Has some heatsink, but no provision for dimming.


Well, it again is a boost module, so not necessarily suitable for your application, rated for substantially more than 10W, but clearly intended for dimming (pin marked "PWM").

Certainly cheaper than anything you could construct yourself. :grin:

Basically because it doesn't work. Many designs on line are absolute crap, strung together by beginners who have he attitude if it functions for an hour or so it works.

So go ahead and do something crappy, even publish it on instructables as there is zero quality control on that rubbish web site, but don't come running to the grownups when it lands in a heap.

Past caring with you now as you seem determined to misunderstand the subject.

Goodbye.

Thank you for your comments, Paul. So I understand that none of these modules I found are suitable for this application. Would you be so kind to give an example of a module that is appropriate for dimming high-power LEDs? It seems to me that such a thing should be very common, but I can't seem to find anything. Clearly I am missing something here.

Search for CVCC buck converter on eBay.

Thanks for the suggestion. I looked, and I am not sure if I found the right ones or not, but it is irrelevant now. I found a solution.

I went to a local makerspace, and talked with a very experienced electronics engineer who works with high-power LEDs a lot. We tested the LED I have, recreated a voltage-current curve for it (there were no specs, it's a Chinese product), and then together constructed a following solution:

Sorry for a poor drawing. "A" represents Arduino, "B" represents buck converter. Power supply is 3S LiPo battery (12.6 V - 10.5 V). Transistor is a N-channel MOSFET (30N06L).

The idea here is that the buck converter will provide clean, stable 10V voltage for the LED, and the Arduino will control the intensity via MOSFET through PWM. This will ensure that no matter what, the LED cannot destroy itself.

We tested this out, and it seems to be working great. Maybe this is not as a good as the constant current module, but it is still way better than the voltage control idea that I had initially.

P.S. we changed the pin on the Arduino to D5 and added a resistor after it, just in case.

Thank you all for your help, patience and explanations. The project moves on :slight_smile: