Capacitor values

For a simple lighting project with an Adafruit Trinket controlling 36 Ws2812B LEDs, taking power via the Trinket micro USB socket from either a mains adapter or a phone charger type battery pack, what is the recommended size of capacitor to connect across VCC and GND? I’ve seen both 0.1 microfarad and 1000 microfarad mentioned (I think)...but it’s possible I’m confusing two different reasons for using them.

Thanks!

0.1 uF is for decoupling (noise filtering)
There should be obe of these as close as possible to EVERY digital chip.

1000 uF is a filter cap to filter out ripple.
There should be one of these across Vcc & Gnd.
By "Vcc" do you mean +5V ?

GreyArea:
...an Adafruit Trinket controlling 36 Ws2812B LEDs, taking power via the Trinket micro USB socket...

36 addressable LEDs could draw 36*0.06= 2.16Amp.
Do you think the 0.5Amp rated USB backflow protection diode between USB socket and 5volt pin would be able to handle that?
Leo..

36 addressable LEDs could draw 36*0.06= 2.16Amp.
Do you think the 0.5Amp rated USB backflow protection diode between USB socket and 5volt pin would be able to handle that?

That's a trick question right ? (rhetorical)

Just a 0.1uF decoupling capacitor should be fine (on each . If after installing the, you see erratic behavior, consider a larger capacitor. But, the 5V supply ("Mains Adaptor" etc.) should have its own adequate filtering (though, the cheaper ones do tend to be a bit "noisy", so more filtering might be needed.

Also, are those discrete LEDs or are they installed on a "module". If the latter, they probably already have decoupling caps. Otherwise, the datasheet, on it's "Typical Application Circuit" shows a 100nF cap on each WS2812B chip, and as raschemmel said, mounted as close to the VCC and Gnd pins as possible. Also, it should be a ceramic capacitor designed for decoupling.

Here's a link to the datasheet: http://www.sinistercircuits.com/docs/WS2812B_18031509254757.pdf

Also, consider that the current demand on the supply lines increases as more LEDs are added to the circuit (parallel currents add up), so be sure to use a conductor size that will supply enough current without a significant voltage drop. Also, the power supply (aka the "mains adaptor" etc) must be able to supply enough current to power that many LEDs. As Wawa pointed out, that could be as much as 2.2 Amps! Ask, if that doesn't make sense.

BTW: 100nF is the same thing as 0.1uF

Note to raschemmel: a capacitor value magnitude doesn't suggest the application. The application suggests the magnitude. A 1000uF capacitor may be used for filtering, but it may also be used for other things, too, like timing, or rapid discharge (e.g. in a xenon strobe light, or a pulse laser). And a 0.1uF cap has many uses, and there are many types.

And, an aside: The assessment of the amount of current needed assumes you will ever program all of the LEDs to full white. If you know that will never happen -- e.g. if you plan to, for instance, only light say 10 at a time, or you plan to never have an LED light up all three colors at a time (i.e. "white"), then you might be able to get away with it.

Use the following formula to assess the maximum current demand:

(Summation of Red LED currents) + (Summation of Green LED currents) + (Summation of Blue LED currents) = Max current required.

Summation of currents means: adding up the currents of all the LEDs of that color (i.e. the internal LEDs in the WS2812B). Each LED current is a function of the 0 to 255 digital intensity value sent to that particular WS2812B TIMES 20ma.

For example: say there will only be, at most, three WS2812Bs active at a time. Using the following table of worse case LED intensity values:

Module # Red Green Blue
1 150 200 250
2 200 100 50
3 30 70 90

The total current would be:
Red(150/25520 + 200/25520 + 30/25520) = 29.8ma
Green(200/255
20 + 100/25520 + 70/25520) = 29.0ma
Blue(250/25520 + 50/25520 + 90/255*20) = 30.6ma

29.8 + 29.0 + 30.6 = 89.4ma total

a capacitor value magnitude doesn't suggest the application. The application suggests the magnitude. A 1000uF capacitor may be used for filtering, but it may also be used for other things, too, like timing, or rapid discharge (e.g. in a xenon strobe light, or a pulse laser). And a 0.1uF cap has many uses, and there are many types.

Thanks.
I have a BSEET.
I don't think the OP needs a whole class in electronics.
If the OP is asking this question do you think he needs to know about rapid discharge or xenon strobe lights ?

raschemmel:
Thanks.
I have a BSEET.
I don't think the OP needs a whole class in electronics.
If the OP is asking this question do you think he needs to know about rapid discharge or xenon strobe lights ?

Sorry, you're probably right. So often I have encountered people (seasoned technicians, even) who have picked up wrong ideas about electronics. And often that's because of the way an "authority" worded something. I was concerned that the notion that a capacitor value defines an application might be taken away from this discussion, by a Newbie, now, or in the future.

I mean, I have heard quite a few strange ideas in my time, and it wasn't always an easy thing to correct their thinking. For instance, and this is a common one, the notion that voltage "flows". Current flows, and voltage exists "across" things. Or that the color of the insolation on the wire is crucial to proper current flow. Or that ground can only be the negative pole. Or that an LED's forward voltage is the best determining factor in how to drive it. Stuff like that.

Excuse my wide eyed noob moment at receiving seven detailed replies to what I thought was a fairly simple question...

...now that’s done...

It is unlikely the LEDs will ever all be full white due to the Arduino program in fact as for this project I only work with primary colours the maximum current would only ever be one third (ie all on at either R, G or B).

They are these exact LEDs;

I don’t know if they have the “per LED” capacitors, it doesn’t say, but there is a component of some sort on the strips other than the led itself. Does anyone know what it is?

I am still quite new and yes by VCC I meant +5v...if someone would like to explain the difference, please remember to use small words :-).

I think these lights are always in parallel, yes? Even though one might initially think a long strip would be in series? I wire them into a 6 x 6 grid using six strips. I know I could wire the voltage from one side only, but I find it easier and neater to just connect the ends so I have a “snake” of lights making up the grid.

I’ve had no problems without capacitor thus far and my power packs of choice have happily driven 144 of the same LEDs (well, same individual LED but the 60 per metre ones instead of the 30s) in a 12x12 matrix. However that has been mostly for me tinkering with them and as it now appears I may have customers for them I want to ensure everything is as robust as possible. Yes, that means I am adding a resistor (470 ohm is recommended I believe?) to the data line too.

Thanks for all your help.

raschemmel:
I don't think the OP needs a whole class in electronics.

Or for that matter, would understand one if given

GreyArea:
I don’t know if they have the “per LED” capacitors, it doesn’t say, but there is a component of some sort on the strips other than the led itself. Does anyone know what it is?

Those little brown cube thinghies with silver ends are decoupling capacitors for the driver chip inside the LEDs.

The resistor in the data line is to protect the first LED in the strip.
A buffer cap (large, electrolytic) across strip supply is to smooth the Trinket/strip supply when LEDs are turning on/off.
Both above parts are also there to protect the strip in case of long-ish wiring between Trinket and strip.
Leo..

The LED is the combined driver+LED module WS2812B, there is a cap next to the part.

If you're going to turn on more than a few (and 36 is well more than a few), I would strongly suggest a separate power supply for the strip.

WS2812B preliminaryV2.0.pdf (265 KB)

CrossRoads:
The LED is the combined driver+LED module WS2812B, there is a cap next to the part.

If you're going to turn on more than a few (and 36 is well more than a few), I would strongly suggest a separate power supply for the strip.

So just to be sure I’ve got this;

I don’t need decoupling capacitors as the strip has them built in.
I do need the resistor (470 ohm?) on the data line.
I do need a (1000 microfarad?) capacitor across +5v and GND.
Ideally I should use a separate power supply for the LEDs.

I can’t do a lot about the last one. The project requires a simple, single socket power supply. Even if I provided two, very few users are going to plug two in; I know there are things like lipo packs that could be used, but the project is limited in both space and cost, so would not accommodate them.

Given that, could you clarify what the actual risk is of not doing so and if there is any other way to mitigate it? As I said I’ve run my demo versions of these for hours at a time over the last six months with neither capacitor, resistor or any other protection and not lost any LEDs, controllers or had any other adverse situations. I realise I may just have “got away with it” and hence if the cost is only a few pence (cents) I can happily add, but if it’s a few £ ($) it becomes a problem.

Thanks all!

If you are planning to solder your WS2812's on your own (4 wires and one .1uF must be solderen onto each diode), you should mind that this is quite tricky. You will definately need some extra diodes since you will most likely "burn" some of them. For each diode you solder, you should check if it works before attaching them together.

If it is possible for your project, I would recommend you to buy a 1m LED strip with 60 diodes (WS2812B or better SK6812 and best APA102). You can cut each diode out of the strip with a capacitor and some nice solder-pads already on it. This is MUCH easier to handle :slight_smile:

"I can't do a lot about the last one. The project requires a simple, single socket power supply. Even if I provided two, very few users are going to plug two in; I know there are things like lipo packs that could be used, but the project is limited in both space and cost, so would not accommodate them."

You can probably get away with just the "single socket power supply" if you make the proper connections. It's important to understand that wires are also resistors. The only things that makes a wire a "wire" is the fact that it's resistance is usually MUCH higher than anything else in the circuit. And, because of this, you can usually ignore the resistance in a wire. But, in cases where a wire is carrying a significant current, that resistance can have a significant impact on the performance of the circuit.

The above figure shows how current surges, caused by changes in the LED currents in the WS2812B devices, when flowing through the wire that supplies these devices, results in a varying voltage drop across the length of the wire -- in other words, noise on the VCC line. If the Arduino is connected at the point where this noise is greatest, it can result in erratic behavior in the Arduino.

A more "proper" way of connecting the strip and the Arduino to the one supply is like this:

I forgot to include it in the diagram, but the ground connections should be done in a similar way (I usually do a copper pour on a PCB for the ground connections, so I forget to think about his.)

C1 is optional. If you have a scope, have a look at the VCC line and if there's a lot of noise, try adding various values of capacitor until the noise abates -- you probably won't be able to get rid of all of it, and I'm attempting to use "small words" so perhaps erratic behavior is your "test" of how much (or if any) capacitance is needed. Also, doing something like a 1000uF in parallel with a 0.1uF can make a big difference, for reasons that are probably too complicated to go into here.

do need the resistor (470 ohm?) on the data line.

You may not need it, but again, the test is erratic behavior. The resistor might be the solution [it has to do with transmission lines and reflections -- i.e. big words].

I don't need decoupling capacitors as the strip has them built in.

If this is a pre-made WS8212B LED strip, then it almost certainly has the decoupling caps already installed.

I think these lights are always in parallel, yes? Even though one might initially think a long strip would be in series?

They are both. And I think the confusion might come from them being called "LEDs". They are not individual [discrete] LEDs. They are RGB LED Modules with an Integrated Addressable Driver. Calling them "LED"s is shorthand.

The Power lines are a parallel connection, but the data that controls them is serial. Thus, the data lines are serially connected. That's important to know if you ever want to connect more than one strip in a way that they are all controlled by the same serial line. DOUT of one strip connects to DIN of the next strip (that's assuming the strip provides a "DOUT"). And, VCC of the one strip connects to VCC of the next strip, and the same with GND.

Most of your post is over my head...but I’ll try to digest tomorrow. Serial data I knew about...ie, not like in the image here;

BTF-LIGHTING 3Pin WS2812B WS2811 SK6812 Corner Connector 10mm Wide led strip right angle L shape solderless No soldering 10sets;

:smiley:

I was waiting for components or I'd have posted this sooner; this is the grid of LEDS I'm using. Power and data will come in at bottom right of the picture which is where the trinket will be sited.

Is it okay to solder the resistor directly to the hole on the chip (I use pin 8 for data) and similarly is it okay to solder the 1000 microfarad capacitor directly between the +5V and GND holes, or would I be better putting them at the start of the LED strip?

Thanks all for help!

Will these be okay?

GreyArea:
Is it okay to solder the resistor directly to the hole on the chip (I use pin 8 for data)

Yup. But, try to ween yourself from the term "chip" when referring to an Arduino or Trinket, etc. -- the WS2812B is a chip. The Trinket is a "board" or "module". I had to stumble over your wording a bit before comprehension kicked in :wink:

GreyArea:
is it okay to solder the 1000 microfarad capacitor directly between the +5V and GND holes, or would I be better putting them at the start of the LED strip?

At the start of the first WS2812B strip -- or even further on, like at the junction on the far end of the second strip or even a few caps, at various points along the string (and probably could be smaller value if done that way). But, if it's working fine, then no need to go to such lengths. I mean, long strings of these WS2812Bs function just fine without all the fuss :wink: But, the one cap a the beginning of the string is still a good idea.

Also, be sure to connect both the power and the ground of the WS2812B array, to the same point where you connect the power and ground of the Trinket. This is especially important if you are planning on feeding the string directly from the data out on the Trinket, since it will be a 3V signal being fed to a 5V system. By using a 3V signal, noise immunity will suffer. In Fact, I would try it without that resistor in the data line -- the Trinket output is close enough to the beginning of the string, that the chance of reflections [the reason for the series resistor] are nil. And the resistor might reduce the signal amplitude even more. The first WS2812B will boost the signal amplitude so the rest of the WS2812Bs will be driven properly.

GreyArea:
Will these be okay?

Probably, but can't be sure because of the lack of data (as if I could determine anything were the "data" present :wink: -- I'm more of a "digital guy" - MCUs and code. Let's just say, it's always worked for me :wink: ). I would also include a .1uF cap in parallel.

BTW: I'm used to having access to a nice scope and thus the ability to probe for problems. So, if you don't have a scope, or other way of troubleshooting such a system as you are making [really cool, BTW :wink: ], then you'll probably need to over-do things, like adding extra caps and translating the data output from 3V to 5V, use bigger wires for the power lines, etc. merely because it's way harder to refine anything. In other words, forget finesse -- break out the sledge hammers!

Thanks for all the advice...

It's a Pro Trinket...5V...apologies if I didn't mention that... (edit: I just checked, and no, I didn't...everything is 5V, I just thought it was easier that way for a novice like me).

This is a portable item, so where to connect the ground is a bit of an issue...If I connect GND on the strip to GND on the chi....sorry...board, when it's plugged into mains I assume that's okay...how does it work if plugged into a battery pack?