0
\$\begingroup\$

I'm not sure how to do this. I have this LED - the 4 pin 3W RGB led.

I want to be able to control it using an Arduino (ideally I would control 4 - 6 LEDs.) By controlling I mean not only control the color but also turning it on and off.

\$\endgroup\$
17
  • 2
    \$\begingroup\$ I think this question can be answered with a quick google search. \$\endgroup\$ – Damien Jan 18 at 0:43
  • 3
    \$\begingroup\$ I’m voting to close this question because it lacks of research \$\endgroup\$ – Damien Jan 18 at 0:44
  • 2
    \$\begingroup\$ You need a 350 mA PWM low side driver for 3 ch. and a large heat sink. What’s the problem? Choosing a 1V 15A FET? \$\endgroup\$ – Tony Stewart EE75 Jan 18 at 1:11
  • 2
    \$\begingroup\$ You need 3 switches, controlled by arduino. Best choise MOSFETs. \$\endgroup\$ – user263983 Jan 18 at 2:27
  • 1
    \$\begingroup\$ Your web link is very good, because it shows a big variety of products, and also give detailed description of specifications of physical and electrical properties. For newbies, I would recommend to prototype with low power (1W per LED), and more pins (2 pin per LED). My suggestion is this one: 3W RGB 6 Pin 3V 350mA Power LED i.imgur.com/UgfFkHj.jpg. \$\endgroup\$ – tlfong01 Jan 18 at 6:33
2
\$\begingroup\$

First off, note that the LEDs you have chosen have a pad on the back side:

enter image description here

That pad must be soldered, and it must go to a large metal surface on your circuit board. High power LEDs can get hot. The metal helps to radiate the heat away and keep the LEDs cool(er.)

If you don't do that, your LEDs will not live long at full power.

It is not clear if the thermal pad is connected to one of the other pins. Without a note in the "datasheet" (that web page hardly deserves the name) I would assume it isn't connected. If you already have them, check all the pins against the pad with an ohmmeter and see if the pad is connected to anything. It might be connected to the + pin.

As to driving the LEDs:

The simplest is to use a standard pulse width modulation circuit and a series resistor. That's probably not the best, but certainly the simplest to achieve with limited parts.

This is a simple circuit to drive one LED:

schematic

simulate this circuit – Schematic created using CircuitLab

PWM comes from your Arduino. That's a digital signal that switches on and off for a variable time. It comes from the misnamed Arduino "analogWrite" command.

You will need three of those for each 3 color LED you want to drive - one circuit for each color.

You have to calculate the resistor value from the maximum current you want to use, and the approximate forward voltage. You use the worst case forward voltage - that's the lower one.

$$R = \frac{V_{supply}-V_f} {I_{maximum}} $$

Assuming a power supply of 5V, and a maximum current of 300 milliamperes, you get the following resistors:

Color \$V_f\$ Resistor (ohms) R (Adjusted for brightness)
Red 2.0 10 26.7
Green 3.0 6.7 26.8
Blue 3.0 6.7 6.7

I've included an adjustment for the relative brightness (luminous flux as the datasheet calls it) to make the full on brightness of the LEDs come out somewhat close.

The full circuit for one LED would look like this:

schematic

simulate this circuit

The red and green LEDs won't get as much current as the blue one, but they should be somewhat closer in brightness due to the different resistors.

You'll have to pick resistors rated for the dissipated power. The resistor for blue will dissipate the most power. That's \$ P =\frac {V_{supply}-V_f} {R} \times ({V_{supply}-V_f}) = 0.6 watts.\$ You'll want to use resistors rated for at least 1 watt.

You drive each PWM pin with an analogWrite command. It will take three pins to control all three colors of one LED.

All on, fully bright, close to white:

analogWrite(PWM_Red,255);
analogWrite(PWM_Green,255);
analogWrite(PWM_Blue,255);

All off:

analogWrite(PWM_Red,0);
analogWrite(PWM_Green,0);
analogWrite(PWM_Blue,0);

Blue:

analogWrite(PWM_Red,0);
analogWrite(PWM_Green,0);
analogWrite(PWM_Blue,255);
\$\endgroup\$
3
  • 1
    \$\begingroup\$ thanks! Mine don't have pad. But I bought a few so I could solder them and I also bought a couple 3w 6 pin LEDs (with the pad already). After work I'm going to read thoroughly your answer. Thanks! \$\endgroup\$ – GB5 Jan 20 at 14:34
  • 1
    \$\begingroup\$ awesome, following your instructions everything works perfectly! ibb.co/56BCWXz When I have the circuit more organized I will post the image here, the components and the code that I used, so it can become even more newbie friendly. Thanks! \$\endgroup\$ – GB5 Jan 20 at 23:29
  • \$\begingroup\$ @GB5: Thanks for the picture. It's nice to see what comes out of an answer. \$\endgroup\$ – JRE Jan 21 at 7:06
-1
\$\begingroup\$

Question

How to use Arduino to control 3W RGB LED lamps?


Answer

Update 2021jan22hkt2201

BAD NEWS!!!

As pointed out earlier by @K H, the I-V characteristics of different colours of LED are very different (in turning points and non-linearity, etc), at shown below.

So it would be difficult to balance the brightness. @K H suggests using different voltage sources, and PWM etc. I have not explored his ideas further. I am afraid now I need to search this forum for old posts on LED control to get more ideas.


red blue led i-v plot


Update 2021jan21hkt1700

Now I am setting a test rig for calibrating constant current source (LM334Z) controlled blue LED. The starting point to calibrate is 2.5V 1.3mA, when Blue LED is just bright enough for my eyes. At 3V, 100mA, it is dazzling and blinding my eyes.

For this low current of 2mA, I am using 36Ω / 2 = 18Ω as the series register.

ccs setup


Part 3 - RGB LED Brightness Turning Point and 100mA Point Measuremeents

I found the dim to bright and bright to dazzling points (at 100mA) are very different for R, G, and B LEDs. So now I appreciate very much why it is efficient and reliable to use Constant Current Source to control the brightness of the RGB LEDs.

I have never used any Constant Current Source (CCS) in my projects. So I need to google a bit to see how to use it, ... :)


rgb led turning and 100mA points

Note: I found the multi-meter readings not very stable. I suspect the small hexagonal aluminium heat sink plates are not big enough at high power.

/ to continue, ...


Part 2 - RGBYW LED I-V Measurements

1. Red LED V-I-B Test

red led test 01

red led test


  1. Blue LED Test

    a. 2.7V, 10mA Turning point, dim to pale bright

    b. 3.2V, 87mA Bright

    c. 3.3V, 102mA Very bright, but not dazzling


Part 1 - Preliminary Testing of RGB 1W LED lamps

I knew Cree's 3W LED lamps would be too bright/dazzling for my eyes. So I decided to try the 1W LED's first. I wired 4 single 1W LEDs, R, G, B, Y and use a button adjustable regulator to test the brightness.

I found the results very disappointing:

  1. Red and Yellow turns on at around 1.7V,

  2. Yellow only turns on at around 3V, and

  3. Blue only turns on later at around 3.3V.

At this voltage level of 3V3, other three RGY become very dazzling and I need to use a shade to soften/darken the lights, so not to blind my weak eyes.

I have too many photos to upload with the comments. So I am uploading them as part of my answer here.


rgby led test


References

(1) AliExpress YD-XGJH RGB/RGBW/RGBWY LEDs, 3W/9W/12W/15W, 2/4/6/8 pins - US$5 ~ US$110 (The 3W RGB LED the OP hopes to control by Arduino)

(2) AliExpress Chanzon - Aluminum Heatsink Base Plate 1W, 3W, 5W LED PCB Board, 20mm Heatsink Substrate, 20mm Star Kit, for 1, 3, 5W - US$1.56-2.59

(3) AliExpress 5x3W Cree XPE XP-E High Power LED Emitting Diode, Neutral White Cool White Warm White Red Green Blue Yellow with PCB - US$4.5/5 pcs

(4) P2N2222A Amplifier Transistors NPN Silicon - OnSemi

(5) ULN2003 Seven Darlington arrays Datasheet - ST

(6) ULN2803 ULN2803A Darlington Transistor Arrays Datasheet - TI

(7) LED Lamp 1W (3V ~ 3.5V, 300mA ~ 350mA) - DigiKey

(8) 1W High Power LED Datasheet - MultiComp

(9) Cree XLamp XHP70 LEDs Datasheet

(10) AliExpress Diymore LED Lamp Driver Support PWM Dimmer DC 7-30V to DC 1.2-28V 350mA 1W DC-DC Converter Buck Step Down Module

(11) AliEXpres Diymore-DC-DC Step-Down Button Adjustable Power Supply Module with LCD Display DC5-23V to DC0-16.5V 3A US$ 2.84

(12) AliExpress XY-LPWM 1Hz-150Khz, PWM Pulse Frequency Cycle Adjustable Signal Generator Module 3.3V-30V LCD Display US$1.72

(13) AliExpress Chanzon Aluminum Heatsink Base Plate 1W/3W/5W LED PCB Board, 20mm Heatsink Substrate, 20mm Start Kit -US$1.56-2.59

(14) AliExpress LM334Z TO-92 three terminal adjustable constant current source IC - US$1.5/5pcs

(15) LM134/LM234/LM334 3-Terminal Adjustable Current Sources - TI

(16) LED Tutorial (Including power LED) - Nick Poole, Bboyho, SparkFun

(17) Constant Current LED Driver (FemtoBuck LED Driver) US$8 - SparkFun

(18) High Power LED Driver Circuits (Low cost, DIY) - Dan, Instructables, 2020, 1,594,948 views, 1,692 likes


Appendices

Appendix A - Testing 3 independent 350mA LEDs (recommended to newbies)

1w x 3


Appendix B - RGBYW 5 x 3W (Warning - Ninjas only)

3w x 5


Appendix C - AliExpress 1W 350mA LED Lamp Driver Module - US$1

AliExpress Diymore LED Lamp Driver Support PWM Dimmer DC 7-30V to DC 1.2-28V 350mA 1W DC-DC Converter Buck Step Down Module

Specification: Input voltage: DC 7 -30V Recommended input voltage: 24V DC Input filter: condenser Output voltage: 1.2-28V Output current: 350mA Output current accuracy: ± 3% Output current stability: Vin = 24V, Vo = 1.2-22V, ± 1% Internal power dissipation: Vin = 24V, 5 LEDS maximum 700mW Temperature coefficient: environmental protection temperature -40 ℃ -71 ℃, ± 0.015% / ℃ Full load efficiency: 96% Wave and noise (vp-p): Vin = 24V, 5LEDS, 120Mv Output short circuit protection: sustainable Package size: 25 * 15 * 10 (mm) without pin Weight: 4g

Use: In +: positive power supply Input: negative power supply. LED +: access the LED anode LED-: then the cathode LED PWM: dimming control signal (2.8V -6V open) PWM signal limit frequency: 20HZ -20KHZ nominal recommended: 1KHZ Buck operating mode to ensure that the full pressure of the LED below the input supply voltage 2 -3V works.

Package Included: Metal Melting Torch Mini Gold Furnace Graphite: 1 * DC in 7-30V 350mA LED Lamp Driver 1W Support PMW Dimmer


Appendix D - Newbie Cheat Sheet for RGB LED Circuit Design

RGB LED chest sheet

\$\endgroup\$
17
  • 1
    \$\begingroup\$ @tlfonf1: You've shown that it can be done, but not how. The how is the important bit, and belongs in the answer, not in some link. \$\endgroup\$ – JRE Jan 19 at 11:54
  • 1
    \$\begingroup\$ The trick is not just in doing it, but in doing so safely and reliably. 3W is (comparatively) a lot of power. Just brutally PWMing the LEDs may "work" but burn them out in short order. You need to be sure that you won't exceed the current limits for the LEDs. The LEDs may be able to withstand higher current for short periods - maybe the PWM pulses are short enough. Who knows. There's no data on pulse current on the site, and no datasheet. \$\endgroup\$ – JRE Jan 19 at 12:01
  • 1
    \$\begingroup\$ #GB5 and JRE, I am bearing in mind the rough voltage and current limit from the Op's datasheet: For Red LED, voltage is 2.6V, current is 500mA. Part 2 measurement starts with Red LED. My firing budget is 5 damn cheap LEDs per day, ... :), \$\endgroup\$ – tlfong01 Jan 19 at 13:55
  • 1
    \$\begingroup\$ Very nice post. As you've been discovering, RGB LEDs require different voltage sources and also wattage levels in order to balance the colors and achieve "white" light. One option is to provide a source per voltage(preferably a current source), tune the output voltages to what you want to be "100% duty cycle" white light, and then achieve 0-100% dimming by using 0 to 100% duty cycle at that voltage. Testing LEDs with a voltage source is fine to learn their properties, but some form of current limit is necessary to prevent thermal runaway if the LED stays at 100% duty cycle and heats up. \$\endgroup\$ – K H Jan 20 at 2:12
  • 1
    \$\begingroup\$ I've waited to see if you actually post a circuit or other practical tips on driving the LED. So far, it appears to be a blog post and a shopping list with nothing to actually suggest how to drive the LEDs. \$\endgroup\$ – JRE Jan 20 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.