How to: drive common cathode led with Arduino?

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 :)

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

LOL,

Yes, I know that and you know that. I was hoping Johannes would figure it out. It is quite obvious he is consulting multiple sources....

I do find it interesting, somewhat maddening actually, that people attempt to produce a working product with zero knowledge using Arduino. Arduino has probably been responsible for more newcomers to the "hobby" of electronics than any other product, and yet equally responsible for more destroyed components than any other product! And people like Paul, Mike, Crossroads, myself, keep coming on here trying to help teach this stuff.... This stuff that took months, and most cases years, to learn.... And many more years of experience developing our skills.

Those of you who have been here a long time: Is there anyone here, who gives sound instruction/teaching/advice, who learned it on a forum such as this? I suspect not. ;)

The reason why I consulted multiple sources (namely PCB Heaven) was to try figuring this thing out on my own, while waiting for you guys replies :slight_smile: I can see now, that it wasn’t my best idea do to that. I’ve played around with the Arduino before, and I know how to use it. I just didn’t knew how to use a current driver as I never has been playing around with high power leds before.

I agree that you just can’t always learn these skills from a forum, but this forums users is definitely helping people, including myself in the right direction :slight_smile:

I would like to thank all of you who helped me on this, your help and guidance is highly appreciated. Hope you didn’t pull out to much of your hair, or knocking your head against the wall to many times :wink:

I’ll be back! :wink:

Over and out
Joe