WS2812B LEDs behaving different when connected to laptop (circuit question)

Hi all,

I am creating a pixel matrix of 16x16 WS2812B LEDs with Arduino UNO like pictured in ''A"" in the attachments. I hope they are readable. I am using the FastLED library.

I have a Mean Well IRM 60 5ST 5V 10A power supply with a power cord like this one:

When I power up the circuit through the wall outlet as pictured in attachment A, the LEDs are working properly. The Demo Reel of the FastLED library runs no problem.

Since I want to be able to update the pixelbox with new animations every once in a while, I need acces to the USB port of the arduino. I believed that if I hook up a laptop to the arduino and leave the power supply connected to the LEDS I could write to the arduino no problem (see Attachment B for how I did this).

However, with Attachment B's circuit, the LEDs are clearly not working properly. Only 12 light up and flicker randomly. What is going on here? Is this because the arduino and LEDs are on different power sources?

If this will never work, do you have any suggestions for how I cán still acces the arduino's USB to change the animation on the LEDs?

I am roughly following this guy's process (except he did not mention how to change/test out animations, which is why I am here asking this):

Thanks in advance,
Cheers,
J

However, with Attachment B's circuit, the LEDs are clearly not working properly.

The one on the right does not have a connection between the Arduino ground and the power supply ground. You need it.

Both diagrams are wrong.

For the first one, take the 5 V and ground connections from the start of the first strip where the data feeds in, and bring those power connections along with the data wire back to the Arduino, connecting to the "5V" pin and ground.

Then when you wish to plug into the laptop/ PC USB, temporarily disconnect - only - the "5V" connection. The data wire must always travel as a pair with the ground, not separately. Did you realise the 330 Ohm resistor in series with the data wire needs to be where it connects to the strip? What about the 470 µF capacitor across 5 V and ground at the same place?

bijzettafel69:
I am roughly following this guy's process (except he did not mention how to change/test out animations, which is why I am here asking this)

Which guy?

Paul__B:
Both diagrams are wrong.

Thanks for your answer. I did not know that the data wire travels with the ground. I thought the led strip can be powered from ''anywhere''. I see now that the grounds have to be shared.
Do you mean the circuits to be like this (see attached) ?

Image A makes sense for me with what you are saying. The power supply supplies 10A to the USB (which is regulated).
Image B does not fully make sense to me still. Why should I only disconnect the 5V pin? Sorry, I am not very experienced with arduino and external power.
I am not sure what you mean with ''470 µF capacitor across 5 V and ground''.
Should I connect a capacitor at the 5v and ground pins of the arduino? I have a 1000uF 16V capacitor, would that work? Just stick in into the pins?

Which guy?:
Sorry, original post edited with the link. It's a tutorial from a website.

Ha Ha! Both wrong again!

Your original diagrams were correct insofar as you need to connect the power - direct from the power supply - to at least both ends of 256 WS2812 pixels. This is of course necessary as the foils on the strips are not particularly sturdy and will lose voltage over any significant distance when carrying substantial current - 256 LEDs will be 14 Amps so now you mention it, your power supply is quite inadequate!

But you can do a lot better than that! You say a 16 by 16 matrix and you are using the "Zigzag" format where the data runs in opposite directions in alternate rows, which is the proper way to do it as it means that the data line does not have to traverse back to the "start" of each row. Your library will take that into account.

So what you actually do, is to connect 5 V and ground to every row in parallel at each end. And for only 16 LEDs per row, it will generally be sufficient to connect only one end - either end - to the power supply. Having all the strips tied together for power at the other end will mean that any one row drawing full power will be supported by the others and in any case, each 16 LED strip draws less than one Amp on its own.

So you bring the power back to the Arduino UNO (should really be a Nano, UNOs are inconvenient to use) along with the data wire from the first strip, not via the USB jack and not separately from the power supply. The important thing is to avoid any open loops in the wiring.

bijzettafel69:
Image A makes sense for me with what you are saying. The power supply supplies 10A to the USB (which is regulated).

Not sure what you mean by "which is regulated", but there are components between the USB connector and the actual 5 V supply line in the UNO - the "5V" pin - including a 500 mA "polyfuse" so supplying ia te "5V" pin is more direct. With a caveat which follows:

bijzettafel69:
Image B does not fully make sense to me still. Why should I only disconnect the 5V pin? Sorry, I am not very experienced with arduino and external power.

With power supplied to the "5V" pin, it can potentially feed back into the USB port of a connected PC and this appears to be a particular danger with laptops, it may temporarily or even permanently shut down the USB system requiring removal of the battery to (maybe) resolve. This is not certain, but a risk which has been reported, so the advice is not to connect an external supply of 5 V to the "5V" pin if you are going to connect a PC to the USB jack.

bijzettafel69:
I am not sure what you mean with ''470 µF capacitor across 5 V and ground''.

That is routinely advised to stabilise the signal at the first LED. Also the resistor.

Adafruit reference.

OK, just to make it clear, this diagram is only about the location of the capacitor, nothing else!

bijzettafel69:
Should I connect a capacitor at the 5v and ground pins of the arduino? I have a 1000uF 16V capacitor, would that work? Just stick in into the pins?

Value is OK (as in the diagram, no quibble on the exact value) but it goes across the LED strip, not the Arduino.

What you have to realise here that there are two aspects to a circuit:-

  1. Where the wires connect to. In other words the topology of the interconnections. Normally conveyed by a schematic.

  2. The layout. How the wires are arranged to get that topology in practice.

The use of a Fritzing layout diagram often muddies this distinction.

When Paul says the diagrams are not correct he is referring to the layout. Layout is important in getting good reliability, signal integrity and interference immunity. So why a project might appear to work, like the left hand diagram in the opening post, it has a poor layout. Where as the right hand diagram will not work because the topology is wrong, it is missing a common ground.

I am not sure what you mean with ''470 µF capacitor across 5 V and ground''.
Should I connect a capacitor at the 5v and ground pins of the arduino?

No it should be physically located at the strip. And both ends of the strip ( power and ground ) should be connected together and directly to the power supply. The ground of the Arduino should also be connected directly to the power supply, and not to the far end of the strip as while topologically correct it, the ground is physically a long way from the power supply in terms of wire length.

You always need a common ground when using two power supplies. See:-http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.