# How to: drive common cathode led with Arduino?

JohannesTN: So I found this driver circuit which I guess would be appropriate: LED Current Driver

Yes, that would be the circuit I just gave you above - it happens to have a FET instead of a power transistor - the difference in this case is quite immaterial.

JohannesTN: Would a driver like this be appropriate if I choose to buy a driver instead of making my own? each led-pcb would have it's own?

Well, it might, but it depends on whether you mean "like" that or that one in particular, which is rated at 1.5 Amp whereas you specifically want 330 mA. And at \$4 each for six of them assuming it could be re-adjusted to 330 mA, it would be rather more expensive than the circuit I gave you.

17V would be quite a reasonable voltage. However you can easily get 19V laptop power supplies rated at 3 or 4A (dirt cheap second hand too) which would work just fine in this application. If each current driver is dropping 4V at 330 mA, then the dissipation in the control transistor would be no more than 1.5W.

17v - because it have to be more than 15v (can it be much more than 17v)?

Yes but as Paul says get what you can, I have never seen a 17V power supply, you can't get all values.

• minimum 5W - because that's what each led-pcb is?

That is the wrong way to think about it. You need a power supply to deliver the voltage at the current you want. So if you need 75mA or even 350mA for each LED plate then you have to provide that current times the number of plates. As it is never a good idea to run a power supply at its maximum current then look for one that provides at least 20% more than this current. Remember the current rating is only what it can supply not what it will supply.

I guess the led "takes what it needs"

No the LED takes what it is given, the constant current supply gives that. What you need to do is to power the constant current supply with a power supply that will deliver that voltage and current.

Would a driver like this be appropriate if I choose to buy a driver instead of making my own?

As it stands no. This is because it will deliver 1.5A into your LED and fry it. You might be able to modify it to only give 350mA but that will take a bit of understanding and some test equipment. Look for one that delivers 350mA or less if you don't want it as bright.

I would like to make my own current driver, one for each led following your schematic Paul__B :-) I've "calculated" a fitting power supply to be 19V 6*350mA=2.1. This means I'll use a laptop power supply at 19v, 4.5A. If I send 19V in to the current led driver, would I get 19V out in the led-pcbs or how do I control that?

But what about the values in the schematic, what is the easiest way to calculate those? - Is it possible to use the BC337 NPN transistor in the making, I've got that on hand already. Which power transistor/Mosfet would be suitable? :-)

Best regards Joe

if I send 19V in to the current led driver, would I get 19V out in the led-pcbs

No you get what ever voltage that is needed to drive the current through the LEDs. That is what a constant current supply does. It automatically and constantly, adjusts the voltage so that the current is guess what - constant.

Is it possible to use the BC337 NPN transistor

For the feedback transistor yes.

Which power transistor/Mosfet would be suitable?

Lots, it depends on what you can get locally.

I feel like I'm finally getting a hold on this :-) - Are there any advantages/disadvantages choosing a transistor over a mosfet in this particular case? if not, I feel like buying some mosfets for the job.

I believe that both a mosfet or a transistor would allow me to still operate the driver with a PWM signal?

What values should I look out for when choosing a N-type mosfet for the job? :)

Best regards Joe

JohannesTN: Are there any advantages/disadvantages choosing a transistor over a mosfet in this particular case? if not, I feel like buying some mosfets for the job.

I would think that the transistors would be cheaper, but nowadays that may not be so. Note however the point below.

JohannesTN: I believe that both a mosfet or a transistor would allow me to still operate the driver with a PWM signal?

Absolutely. That's what they are for.

JohannesTN: What values should I look out for when choosing a N-type mosfet for the job? :)

It must be a "logic level" device if the control input is to come from an Arduino (or any other microcontroller at 5V). It must turn on fully at 3V on the gate and be able to dissipate 2W if you are going to use a 19 or 20V power supply.

Note that I said 3V on the gate, and an Arduino running at 5V. All transistors - except for Darlingtons which you should in general avoid - switch on at 0.7V or so, so this is no problem with transistors.

I will get a hold on some transistors/mosfets on monday and then report back when I know what I've got my hands on :-)

• where in Paul__B's circuit would I apply the pwm-signal coming from the arduino? - is it just where I normally would connect the Arduino, that would be the control-line following his circuit :-)

Best regards Joe

The leds are diodes. They only conduct in the one direction. If the led cathode is connected to ground (schematic in Reply#6) , you shouldn’t have a reverse current (opposite of the direction when the led is on) flowing through the led because it should block current flow in the reverse direction . In order to read -9 V across the led as you indicated, the cathode would have have to be biased positive with respect to the anode.

JohannesTN: where ... would I apply the PWM signal coming from the Arduino? - is it just where I normally would connect the Arduino, that would be the control-line following his circuit

Curiously enough, that is what PWM actually is - you turn the LED on and off.

I really don't understand why I sometimes read -9v to -15v raschemmel, I know a led is only conducting in one direction, so I find it mysterious too. For now, I hope I will not read any weird values by using a proper driver :)

Thank you Paul__B I'll report back on monday.

You guys are great ;)

Best regards Joe

So I got some of these IRLZ34N power mosfets: IRLZ34N

Are they usable in Paul's circuit? :)

Best regards Joe

I played around with the constant current driver circuit I found on Pcbheaven, because it's build around a mosfet like I'm using: Constant current driver

I built the following circuit:

I've calculated the RS-resistor by using the BC337's Vbe-value which is 1.2V following the datasheet. The rs-resistor is calculated by 2.1V/0.35A = 3.4ohm. (I used a 3.6ohm resistor because that's what I had on hand (2x1.8ohm))

The RG-resistor is just a 10k as it's stated at pcbheaven that it should be fine - should I also calculate this to be sure?

The circuit works great with PWM and all. But there's something I find a little strange... With the above circuit the led-pcb draws 160mA, I guess it should actually draw 350mA as that's what the RS-resistor is calculated for (to my knowledge). If I lower the value of the RS-resistor I can get it to draw more from the power-supply, but then the calculation for the RS-resistor isn't what I calculated it to be anymore.

If anyone knows why, I would like to know what can cause that my led-pcb isn't actually drawing 350mA when that's what I calculated the RS-resistor for :-)

Best regards Joe

I built the following circuit:

Why? That was not on the page you linked to.

You have two outputs connected together, a great way to screw up components.

f anyone knows why, I would like to know what can cause that my led-pcb isn't actually drawing 350mA when that's what I calculated the RS-resistor for

Your input voltage is not high enough.

The 1.2 Vbe (I am assuming your 2.1 above was a typo) is the Max on the datasheet, not typical. I actually suspect it is less than 1V.

You have two outputs connected together, a great way to screw up components.

I guess you're referring to the connection of the PWM pulse Grumpy_Mike? - if not, I would like to know where I've done wrong :-)

As I described I was playing around with the constant current driver circuit found at Pcbheaven here: Constant current driver

And then, on this page the guide says that

the best position to inject the PWM pulses is the gate of the MOSFET. The gate resistor RG will act as a pull-up resistor for the PWM generator.

Found in the bottom of the page: PWM

I believe I did it right following the guide at PCB heaven, but as far as I can tell from your comment, it isn't right at all. I would like to know what to do then. :)

Paulcet: You're absolutely right, the 2.1 was a typo (fixed now). If it's less than 1.2V which I haven't really thought of, that explains a lot, thanks for clearing that out :) !

Best regards Joe

Look at the circuit in reply #33, that is the way to inject a PWM signal. The way you have it then you can draw too much current out of the PWM pin when it is outputting a high but the collector of the transistor is low. There is nothing to limit the current here.

As far as I can see from the circuit in #33 to the circuit in #36 I'm using is the resistor at the control-line in #33. If I add such resistor (10k?) to my circuit, I should be good? :)

Best regards Joe

JohannesTN: I played around with the constant current driver circuit I found on Pcbheaven, because it's build around a mosfet like I'm using

Boy, are you ever persistent in doing the wrong thing and completely ignoring the advice you get here.

JohannesTN: I've calculated the RS-resistor by using the BC337's Vbe-value which is 1.2V following the datasheet.

:astonished:

You picked a number out of the datasheet without knowing what it meant.

JohannesTN: If anyone knows why, I would like to know what can cause that my led-pcb isn't actually drawing 350mA when that's what I calculated the RS-resistor for :-)

Because you ignored my instructions in reply #17 and went and did something totally random.

Paulcet: The 1.2 Vbe (I am assuming your 2.1 above was a typo) is the Max on the datasheet, not typical. I actually suspect it is less than 1V.

Nothing to "suspect". I specified it in reply #17.

JohannesTN: As far as I can see from the circuit in #33 to the circuit in #36 I'm using is the resistor at the control-line in #33. If I add such resistor (10k?) to my circuit, I should be good? :)

Don't "add" anything at random. Use the circuit we gave you.

[Yes, it makes no difference whether it is a transistor or a logic FET.}

JohannesTN: As I described I was playing around with the constant current driver circuit found at Pcbheaven here: Constant current driver

Why? Just - why? Either you muck about trying to comprehend multiple random sources, or you get serious and believe us. If you don't want to, well, don't post to this forum!

JohannesTN: And then, on this page the guide says that Found in the bottom of the page: PWM

I believe I did it right following the guide at PCB heaven, but as far as I can tell from your comment, it isn't right at all. I would like to know what to do then. :)

Except that you didn't actually read it, because it says

Remember that the PWM controller i use sinks current and does NOT source. The base of the transistor grounds on every pulse of the generator, thus the transistor turns off completely, turning off the LED as well.

This has nothing to do with an Arduino,

Wow...

I guessed (Yes I'm new) that the circuit from PCB Heaven was just as good as the one you supplied me with, since they were close to being equal. To revert my circuit from PCB Heaven to yours #17 all I did was to remove the RG-resistor and add the 10k resistor to the control-line. It works great.

I do know what Vbe-value means, I just missed that the 1.2V was the max-value for the transistor... I used a 2.2ohm resistor for the sense-resistor as you told me to, it made my led-pcb draw 350mA from the power supply as it should. I raised the resistor to 3.4ohm to lower the current to 160mA which suits the led-pcb better as it lights a little less which suits the application great.

I use this forum to learn how to use electronic components I haven't used before. I fully believe you and the other guys helping me out, and I appreciate all the help I've got on this topic, believe it or not, I've learnt a lot in this. I used the circuit at PCB Heaven to try things out on my own, and explore while waiting on replies, I find that a good way to learn too.

Best regards Joe :)