Go Down

Topic: How to: drive common cathode led with Arduino? (Read 9167 times) previous topic - next topic

Paul__B

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.

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.

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.

JohannesTN

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

raschemmel

#32
Jan 18, 2015, 01:24 am Last Edit: Jan 18, 2015, 01:26 am by raschemmel
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.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Paul__B

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.

JohannesTN

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

JohannesTN

So I got some of these IRLZ34N power mosfets:
IRLZ34N

Are they usable in Paul's circuit? :)

Best regards
Joe

JohannesTN

#36
Jan 19, 2015, 11:10 pm Last Edit: Jan 20, 2015, 01:35 am by 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: 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

Grumpy_Mike

#37
Jan 19, 2015, 11:15 pm Last Edit: Jan 19, 2015, 11:17 pm by Grumpy_Mike
Quote
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.

Quote
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.

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.


JohannesTN

Quote
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
Quote
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

Grumpy_Mike

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.

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

Best regards
Joe

Paul__B

#42
Jan 20, 2015, 05:26 pm Last Edit: Jan 20, 2015, 05:44 pm by Paul__B Reason: Always more.
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.

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

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

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.

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.

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.}

Paul__B

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!

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
Quote
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,

JohannesTN

#44
Jan 20, 2015, 06:24 pm Last Edit: Jan 20, 2015, 06:25 pm by JohannesTN
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 :)

Go Up