I'm building a project with a high-power 10W RGB LED controlled by PWM from a microcontroller. Right now I'm using a wall wart to power the LED, and powering the MCU through my computer's USB.

My question is: what are the best practices for powering the MCU and LED from just one wall wart that plugs into the final enclosure? I don't want the final box to have two power lines going into it since that strikes me as ugly and I want to eventually show off the final product.

I want just one wall wart that splits its power inside the box to provide anywhere from 6 to 12V (ESP32 regulator accepts 6-12V) with at most 400 mA to my MCU, and another line or lines going to the RGB LED to power the Green+Blue channels at 3.5V and ~500mA and the Red at 2.5V and ~700mA. Something like a 9V, 1.5A wall wart would provide plenty of power for the whole thing.

I'm asking this now because I'd like to understand what sort of Buck converter/switching/linear power supply I would need to design/buy right now that will integrate with the single power source.

Strangely, I can't find any example on Google of finishing a project like this, so if anyone knows of a resource with an example or education on this, I'd appreciate a link.

EDIT: I was thinking of an LED like this one. Except RGB, and not RGGB. I'm open to LED suggestions.

Based on this article on wall warts it seems risky to use them because they're often unregulated.

After looking around some, I found this board mountable AC-DC converter at the right power and with the right over voltage/over current/short circuit protections. This seems like a good solution for a safe final product and I could plug the mains directly into the enclosure and into this power supply.

  • \$\begingroup\$ you've got a 10W LED but seem to be running it at 3W. \$\endgroup\$ Commented Apr 14, 2019 at 4:00
  • 1
    \$\begingroup\$ take a look at the mini360 modules avaialbe for about 50c each on-line, 4 of them could provide all your voltages from a 9V or 12V DC input. \$\endgroup\$ Commented Apr 14, 2019 at 4:03
  • \$\begingroup\$ which 10W RGB LED do you have? \$\endgroup\$ Commented Apr 14, 2019 at 4:11
  • \$\begingroup\$ @Jasen. I plan to leave some headroom in a 10W LED to ensure I don't run it near it's max capacity, maybe only 1/3 or 1/2 of max. For longevity, I hear that running an LED lower than its rating can help. I haven't finalized my LED choice yet, the test bed only uses the little 20mA LEDs for now. Edited question to include a possible LED. \$\endgroup\$
    – BenAndo
    Commented Apr 14, 2019 at 19:33

1 Answer 1


Treat the shared wall-wart as dumb, bulk power, and regulate everything separately from that. (everything that needs to be regulated, anyway)

For example:


simulate this circuit – Schematic created using CircuitLab

The regulators will stop a lot of the crosstalk between the isolated power "groups". Everything on the same "group" will "hear" each other pretty well, but have a harder time "hearing" things from the other "groups".

Of course, you still need to bypass each chip individually with a small capacitor, in addition to the bulk capacitance before and after each regulator.

It seems to me that you want to run the LED's directly from the MCU output pins, but I don't know of any that can provide that much power directly. So you'll need an amplifier of some kind. The simplest way to do it is probably with a single transistor per channel, like this:


simulate this circuit

Putting the LEDs in series like this adds voltage instead of current, which is much lower stress on both the transistor and the power supply, and it allows a single resistor to set the current for the entire array.
R1 = (V_LED - Vf*N) / If:

  • Vf is the LEDs' forward voltage
  • N is the number of LEDs in the string
  • If is the design current when on

Don't forget R2! (or you'll blow up the transistor or the MCU or both) You can buy "pre-biased" transistors that include Q1 and R2 in the same package, but one way or another, it must be there.

If you only have a single diode per channel, and it really does take almost 1A at 3V, then I'd be tempted to use a variation of the circuit above, but fed from a 3V or so pre-fab switching regulator. There's a tradeoff here, between R1 having very sensitive control over the operating current because of too-low voltage (also consider some natural variation in the supply voltage), and excessive power dissipation in R1 itself because of too-high voltage with unchanged operating current.

(this is one of several reasons why high-voltage, low-current arrangements are preferred if possible)

  • \$\begingroup\$ I think he's got a single 10W RGB led. \$\endgroup\$ Commented Apr 14, 2019 at 4:04
  • \$\begingroup\$ I was wondering about that. Not enough information to tell conclusively either way. It's a bit more annoying if it is though. I don't think I'd want to regulate that linearly as shown here, and switching supplies tend to have their own problems if they're not done just right. I'm not sure I want to attempt that for what appears to be a novice. Maybe someone else can? \$\endgroup\$
    – AaronD
    Commented Apr 14, 2019 at 19:13
  • \$\begingroup\$ @AaronD I would send the MCU PWM to a MOSFET and use that to switch the power. One MOSFET for each color on a single RGB LED. 78xx's would be simple, but I'd be concerned about the heat that would get contained in, say, a 10inch cube-sized enclosure. What sort of problems do switching supplies have? Voltage droop under increasing loads? \$\endgroup\$
    – BenAndo
    Commented Apr 14, 2019 at 19:38
  • \$\begingroup\$ @BenOnBikes Mostly noise, and some stability. Switchers are inherently noisy, and require filtering on both sides to reduce conducted noise to something reasonable, and possibly EMI shielding as well to work against radiated (radio) noise that gets picked up by something else. You'll never get rid of all the noise (that's true even for linears, but at least they don't generate their own), but you might be able to reduce it to something that works, or it might be done for you on a pre-fab unit. Just be sure that the pre-fab works in every way that you need and not just the obvious ways. \$\endgroup\$
    – AaronD
    Commented Apr 14, 2019 at 20:14
  • \$\begingroup\$ Stability can be interesting too. This is also technically true for linear regulators, but the pre-fab units of both tend to be pretty forgiving in that area, in the sense of not going crazy and self-oscillating or something like that. If you really want to design your own and optimize it, then you'll have to trade between correction/response time, accuracy, and a few other things, and you'll probably find yourself fighting self-oscillation a lot. But the end result can be something that drives the LED directly, with no other parts. \$\endgroup\$
    – AaronD
    Commented Apr 14, 2019 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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