Electronic – Building power/control interface for RGB LED strips

led strip

I am attempting to build/create/design/whatever a way to control my RGB LED strips via a USB or ethernet interface. These strips consume a lot of power and the mass produced controllers suck. I would also like independently controllable "zones" if you will, so ideally this device could power 1 or more strips.

Since a picture is worth 1,000 words I've attached an image of what I am trying to accomplish. Does anyone know of something like this commercially available, or how I can practically create something that will power this many LEDs? At a minimum I would really like each device to power 3 strips at a time which is quite a bit of power. I'm am very new to EE, so this is all kind of overwhelming to me.

enter image description here

Best Answer

Since you are new to electronics, I would suggest you get a development system that will give you an Ethernet connection as well as having USB output control. While I would normally never suggest the use of something like Arduino with appropriate shields or Raspberry Pi, in this case, it makes the most sense for you to get a system with a ton of online support as well as plenty of source code that should work for what you are trying to do, and both of these have that.

However, for typical circuits, even those involving some pretty complex circuitry, I would recommend you skip the development boards all together and learn to design your own circuit around a microcontroller chip, adding whatever external hardware you need. The only real reason I am suggesting a dev board in this case is because you are new, and I am imagining it will take you a long time to get both an Ethernet and USB interface up and running.

LED Control

As for the external hardware to control the LEDs, that is pretty easy to explain, but there are quite a few different ways to do it. To start, the RGB LED is made up of three internal LEDs: red, green, and blue. The resulting color is determined by the intensity each individual LED. In order to control the color, you will need a way to dim each of the three internal LEDs. The exact wiring of a circuit will be determined by what type of LED is use:

  • Common Anode: Each LED shares an anode (side for positive voltage) but has its own cathode.
  • Common Cathode: Each LED shares a cathode (side for negative voltage) but has its own anode.

A very common way to control the LED brightness is by using Pulse Width Modulation. To drive a large current, a transistor is commonly used as such:

MOSFET LED Switch

In this circuit, the MOSFET (Q1) is being used to switch the LED to ground. This would be ideal for the common anode RGB LED as each internal LED should have its own cathode. The brightness is controlled by pulsing the base of the MOSFET. This pulse should be high enough to avoid any noticeable strobe. A safe number is 200Hz. The duty cycle of this pulse (the ON time vs the OFF time) then controls the brightness of the LED. The resistor R1 is necessary to limit the current through the LED.

Here is a discussion on efficient ways of driving LEDs such as a current driver.

If you want all of the LEDs to be the same color, then you would need three of these transistor switches and three PWM outputs with every red, green, or blue cathode (plus current limiting resistor) in parallel.

You could divide the control up as much as you like to set different LEDs to different colors at the same time. The PWM output can be created manually in software, or done automatically using the microcontroller's dedicated internal hardware functionality, although the number of dedicated internal PWM channels is limited in a device. Software versions are limited by the total number of I/O pins unless you resort to using I/O expanders or shift registers to increase the number of outputs available. There are also numerous multiplexing schemes, but they can become overly complicated.

Choosing a Suitable MOSFET

There are a couple of important things to note about picking the right part:

  • Drain to source current (I_ds) - this is the maximum current that can be switched. Give yourself plenty of overhead room!
  • R_ds(on) - this is the MOSFET resistance while it is saturated (switched on). The lower this value is, the more efficient the switch will be (less power dissipation in the switch)
  • Gate Threshold voltage - this is the minimum voltage necessary at the gate for the MOSFET to start conducting. It needs to be a bit higher than this to be fully saturated. For control from a microcontroller, you will want a "logic level gate" which has a very low gate threshold voltage. The R_ds value will drop as the gate to source voltage increases.
  • Power dissipation - The MOSFET will need to be able to dissipate at least the expected current (I_ds) squared times the expected drain to source resistance (R_ds).

It is also a good practice to put a pull down resistor (10k or so) at the MOSFET gate to make sure it is OFF when you want it to be (such as during a system reset).

Additional Information

Unfortunately, I don't know much of anything about the R Pi, so I can't help you there, but I do know you would be programming the GPIO pins as outputs to drive the MOSFET gates. Keep in mind that the Pi has 3.3V I/O pins, so you will need to get a MOSFET with a gate threshold of a bit less than that, try 1V - 2V. The circuit can be built on a breadboard to test it but should be soldered to a perf board or PCB when you are happy with it.

Here is a good MOSFET that should work well. See if you can find the characteristics I mentioned above in this datasheet.