I have an existing circuit made to power a high power RGB LED using 1 LM317N for each color to provide constant current to the LED. This works well with 5V input and a 2.2 ohm resistor on each LM317N to regulate the current for each color, but that means the LEDs are just on full brightness.
Edit Update: The 2N3904 is only rated up to 200 mA and is not suited for high power LEDs. Plan to use a IRF520N MOSFET to control the LEDs now.
I want to control the brightness and colors of the LED with an Arduino. After looking at multiple online examples, it seems that a 2N3904 transistor is needed to switch the Adjust of the LM317N. Is this an ok way to control a high power LED? Are any of the connections wrong?
The datasheet for the LM317 shows it used as a constant current source and this online manual shows it used for an LED.
LEDs are "current operated" and even with PWM normally you do need current control (or current limiting).
With no current limiting, PWM will control the average current but you can still get excess current during the on-time and "bad things" can happen. For the same reason, you should use a current-limiting resistor when driving a regular LED from the Arduino, even if it's dimmed with PWM.
Dimmable constant current (or controlled-current) LED drivers can either switch the LED on & off with PWM like we do with regular little LEDs or the current can be constant and "smoothed", similar to how a regular switching power supply puts-out a constant voltage. And sometimes the smoothed-constant current is controlled from a PWM input.
I made new diagrams of the circuit. I only included one color of the RGB LED for simplicity but there is one for each color. The first image is the current circuit that works to light up the LEDs. The second image is the planned circuit.
I want to be able to dim each color of the LED from 0% to 100% so the RGB color value can be controlled from 3 potentiometers with the Arduino.
Current Circuit
This works to power the LED at full brightness, even though the adjust pin is not connected.
Since LEDs are current operated I picked the LM317N since there is an LED example on Texas Instruments' website. It seems that there might be better ways to control high power RGB LEDs but the plan is to control 3 LEDs and already have 9 LM317Ns soldered to perfboard powering the LEDs. Now I need a way to control them.
This post by @Crossroads shows a simpler diagram for the transistor, it puts it in series. Is the LED supposed to get + current from the LM317 and then get the - negative side directly from the transistor?
That makes sense to me, just a little confused by all the drawings that show the adjust pin connecting to the out leg of the LM317 after the resistor and before the LED. Does the adjust leg connect to the transistor? Or is it only connected to the - negative side of the LED, GND and the Arduino?
That is a design fault, violating the manufacturer's recommendations. The circuit behavior is undefined.
Crossroad's circuit is fine, except that there is no reason for the LM317. All you need is a suitable resistor. As previously mentioned, a logic level MOSFET works too.
That was a wiring / soldering mistake that I plan to correct, just noted it in the drawing to be accurate to current circuit state.
I redrew the planned circuit to show all 3 LM317 and how the 2N3094 transistors are going to be hooked up in series with the red, green, blue LEDs and ground. I believe this is just like @CrossRoads circuit diagram with the addition of 2 more LEDs. Does this look correct?
You mention using a resistor but @DVDdoug and most LED documentation describe LEDs as constant current devices that may work with a resistor but will work better with constant current. Is that not correct?
Thank you for helping with this circuit and project. If the in series transistors are correct then I am going to solder it all together to test.
Updated Circuit with 3 LEDs
Shows the 2N3904 transistors in series with the LED and ground.
"may work ... will work better" are not defined, and therefore meaningless in this discussion.
If the goal is to push the LED to near its limits, such that it heats up considerably, then a constant current driver, designed and used correctly may prevent it from burning out.
Achieving that requires a well defined goal, some test equipment and advanced engineering skills, but if it makes you feel better, by all means use a constant current source.
How much current for your LEDs maximum? As drawn in your last drawing your LED current will flow through your 2N3904 transistors. I suggest you read the data sheet for a 2N3904.
Next I run with jremington's thinkihng. When I want to fade in/out a RGB LED I just use PWM and a series resistor for each color. It would look something like this.
I would add a 1K series gate resistor to each channel. I used FQP30N06L MOSFETs but any logic level MOSFET will do fine as long as you don't exceed the MOSFET current ratings.
I suggested 1K for the gate but sure a 150R should do just fine. Yes, guilty I use the FQP30N06L because I have a pile of them so they turn up in my drawings. It's like when you have a pile of lemons you make lemonade.
The LEDS have max forward current of 1000 mA but will be driven at 350 mA and 700 mA.
I have RFP30N06LE and 2N7000 Mosfets on hand. Will they work with my already wired and solder LM317 chips?
So the high power LEDs don't need a constant current device like the LM317? Confused about which is correct, using a series resistor or a constant current device.
No, of course not. Crossroads did not specify a transistor, assuming that the builder would understand how to choose an appropriate one. Same goes for choice of MOSFETs. You have to read the data sheets, with a design goal in mind.
Have you looked at the data sheet for the LEDs, and chosen a target current and acceptable power dissipation level? That is where this process should have started.
The 2N7000 is a small signal MOSFET, like the 2N3904 is a small signal bipolar transistor. Both are totally inappropriate for high currents, as you can see if you look at the data sheets. But if you have not yet chosen an LED current...
LEDs will run at 350 - 500 mA with 700mA max for red and 1A max for blue and green..
Thank you for the reply. You are right, best to check the data sheets. after checking, the 2N7000 can only handle 200 mA and 60V so it will not work. This is the same rating for the 2N3904 which won't work either.
The RFP30N06LE is rated for 30A and 60V so that will work for the 700 mA to 1A LEDs.
I also have an IRF840N which handles 8A and seems to switch at 4V. Will search for a more appropriate transistor to switch the LEDs
That is a nice package and has all the parts, although I would need 9 of them for 3 RGB LEDs. I will either find a suitable transistor to switch the current setup I have or get something like this. Thank you for the suggestion and link.