# Two voltage sources on the same circuit

I am looking to power a Trinket Pro 5V microcontroller using a 9V voltage source. I have logic running on this controller to gather the data from an accelerometer (powered off of the 5V pin on the controller) and output it to three strands of 21 RGB LEDs (https://www.adafruit.com/products/1655).

RGB LEDs cannot exceed a power source of 5V and after passing through the Trinket voltage regulator the 5V pin on the Trinket just does not have enough power for all three strands.

Please, advise on the appropriate hardware for this case. What is the maximum voltage that RGB LEDs can handle and how does the schematic look on the protoboard.

• Use a second 5V power source for the LEDs. And connect the grounds. Commented Mar 21, 2016 at 17:09
• @Majenko, thank you, do you mean connect the microcontroller ground pin to 9V voltage source gnd pin to the 5V source gnd pin? Commented Mar 21, 2016 at 17:14
• The MCU and 9V will already be connected. Just the 5V and MCU and/or 5V and 9V grounds need to be connected. It's exactly the same as powering a motor, or a relay, or other things from external power supplies. Commented Mar 21, 2016 at 17:15

First of all: 9V means that you are using a 9V "transistor" battery (like this), right?

If so it won't last very long: I suggest you to use a different approach (e.g. four AA batteries in series).

As for your question, I couldn't find the power consumption for these leds. Try to measure it yourself, setting the max brightness and white color. I think that, anyway, the max current for each LED should be 60mA (20mA for each color). This means that each strand absorbs 1.2A (quite a lot!).

This power requires you to use at least a switching regulator. I always used some small modules I found on ebay (they have a LM2596 IC, so just search LM2596 on ebay to find them). They are rated for 3A, so you should put at least two of them (1.2 * 3 strands = 3.6A > 3A).

The connections are quite straightforward: the board has four pins: IN+, IN-, OUT+ and OUT-. IN+ of all the modules go to the positive terminal of the battery, IN- and OUT- of all the modules go to the common ground node (negative terminal of trinket, battery and leds), OUT+ is the 5V regulated output. Oh, by the way, they are adjustable modules, so BEFORE ATTACHING THE LEDS use a multimeter to set the correct voltage (if you attach the leds without regulating the voltage you can destroy them).

Since you will have a lot of current left on the second module, you can power the trinket from there (so you will not waste a lot of power).

One last thought: 9V batteries usually have a capacity of around 600mAh; if you use one of them with the switching modules and drain 4A from the 5V your battery will last 0.6Ah / 4A * 9/5 = 0.27h = 16 minutes; if you switch to 4 AA batteries (around 2000mAh) it will last 2Ah / 4A * 6/5 = 0.6h = 36 minutes. More than double (calculations made rounding up the power drained by 21 leds set at max brightness and white color)

• @frarigu87 could you recommend an optimal power source for the project? Commented Mar 22, 2016 at 3:24
• @K.Nadkina It depends on 1) the leds usage, 2) the desired duration 3) the required size of the battery 4) the money you want to spend. Usually the best weight (or size) over energy ratio is with the lithium batteries (LiPo or LiIon). A 7.4V (2 cells, also called 2S) 5200mAh I found on ebay costs about 30€, is 165x60x35 mm and, at full brightness white, will last about 2 hours. The drawback is that you need an appropriate charger for these (you can also find small modules, but be sure they are for 2S batteries too). I suggest you to avoid 1S (3.7V) batteries, because you will need a step up Commented Mar 22, 2016 at 9:29

According to the link you supply you might either receive the WS2812 or the SK6812, datasheet on Ws2812 claims you can supply up to 7V , but this is still less than 9V , the SK6812 is lacking in max voltage but says 5v typical.

If you still want to use the 9V supply you will need a extra voltage regulator.

A little math: each pixel can max draw 60mA, if you have 21 of them we multiply and get 1260mA, thats 1.26 Amps but thats max values we might divide by two and still be relative safe. Let's not. So we need a 1.26A source from 9V to 5V then we can calculate the power we need to dissipate. (9-5) x 1.26 = 5.04W of heat. Ok you need a regulator that can dissipate that kind of heat.

A 7805 regulator will not do, you need a switching buck converter.

As to driving this on battery power I don't think alkaline will be able to deliver 1.3A (adding for the MCU) without loosing voltage to inner resistance, some rechargeable might. Lipo can deliver but at a different voltage that will need a new calculation of potential waste using linear regulation, or a buck regulator. In my opinion the charging of lipos require special attention and are not my preference, but might be option here.

• The question doesn't give any indication that only half the LEDs are likely to be on, or only at half power. Arbitrarily halving the current draw seems a little dangerous to me. Commented Mar 21, 2016 at 17:39
• I second @MarkSmith; moreover as I wrote in my answer I think that they are 3 strands of 21 leds, not 21 total. Moreover, please, be precise. Currents are expressed in milliamperes (symbol: mA, not mah Commented Mar 21, 2016 at 19:50
• @Mark Smith you are absolutely right. I'll correct my answer Commented Mar 21, 2016 at 20:01
• @HansNeve, do you think using a 3.7V Lithium Polymer Battery @ 2000mAh would be enough and eliminate the need for a regulator? Would it power the Trinket and one LED Strand? Could another battery of that sort power the other 2 LED strands? Commented Mar 22, 2016 at 3:22
• @K.Nadkina You could use one lipo for each strain to lessen the load yes, but be aware that there might not be cirquitry to stop theese lipos from beeing completely drained, which is a bad thing. and you will have to disconnect them to charge them. Commented Mar 22, 2016 at 7:42