WS2812B-Pingponglamp

Hey
so i have been building a lamp for a friends birthday which contains 231 pingpong balls with leds(ws2812b). together they form a matrix of 11x21 pixels. i am pretty new to all of this, meaning i am no electronics or porgramming expert and i have an issue i cant resolve by myself, so i came here in hope you guyes can help me.

the lamp works fine if i am using only the primitive colors(red,green and blue) but as soon as i mix colors(more than one led per ball) the programm freaks out and i get some weird images on the matrix.
i am using two 5v/8amp power supplies.
since the program is working fine exept for mutli-colors i assume it is not the problem and the problem is found somwhere in the wiring or hardware. if wanted i could upload a short video on youtube which shows the problem more accurate.

#include <FastLED.h>
#define NUM_LEDS 231
#define DATA_PIN 13

CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(200);
}

void loop() {
  for (int i = 0; i < NUM_LEDS; i ++) {
    leds[i] = CRGB::Green;
    FastLED.show();
    delay(10);
  }
  for (int i = 0; i < NUM_LEDS; i ++) {
    leds[231 - i] = CRGB::Red;
    FastLED.show();
    delay(10);
  }
  for (int i = 0; i < NUM_LEDS; i ++) {
    leds[i] = CRGB::Blue;
    FastLED.show();
    delay(10);
  }
  for (int i = 0; i < 1000; i++) {
    leds[random(0, 230)] = CRGB::Red;
    FastLED.show();
    delay(5);
  }
  leds[230] = CRGB::Red;
  FastLED.show();
  delay(20);
  for (int i = 0; i < 115; i ++) {
    leds[i] = CRGB::Black;
    leds[231 - i] = CRGB::Black;
    FastLED.show();
    delay(10);
  }
  leds[115] = CRGB::Black;
  leds[116] = CRGB::Black;
  FastLED.show();
  delay(10);

  for (int i = 0; i < 115; i ++) {
    leds[i] = CRGB::Black;
    leds[231 - i] = CRGB::HotPink;
    FastLED.show();
    delay(10);
  }

  delay(1000);
}

i hope you can help me
thanks

So clearly all white would be a problem?

231 times 56 mA = 13 Amps. Well, the power supplies should be adequate!

Now I can't immediately say whether the wiring is the problem but there are quite a number of major errors suggested by the layout you illustrate if that is indeed an accurate depiction.

The 1 mF capacitors must connect directly across the supply of the first LED in each bank. Locating them near the power supply is totally meaningless as the power supply already contains such a capacitor. Similarly, the resistor connects at the data input to the first LED.

You show the Mega (not sure whether a Nano is sufficient for 231 LEDs, I think it probably is) connected to the second power supply and the data wire travelling from it to the first. That is an obvious blunder!

The grounds are shown connected somewhere other than where the two banks meet. Another clear blunder.

It is important to understand that everywhere the data wire runs from one part to another, it must run as a pair with the ground wire, never separated. So the data wire from the Arduino must run paired with the ground. Since the ground wire also supplies power to the Arduino you need to run all three - data, ground and 5 V - back as a bundle from the LED strip where the data connects, to the Arduino to power it.

Now I presume you are "zig-zagging" the data from the end of the first strip of eleven to the end of the second strip so that it does not have to travel all the way back to the root of the second. This means that the ground at the end of the first strip must also connect to the end of the second strip.

Similarly, where the data travels from the first bank to the second, must be the exact point where the grounds of the two banks connect together, desirably with as sturdy a wire as used everywhere for the power supply ground. For eleven LEDs, it is reasonably acceptable that you connect power (which of course, always includes ground) only to one end of each strip, noting again that the grounds must connect where the data connects.

OK? :grinning:


And - it should also be obvious as you have illustrated, that the 5 V and ground wires always travel everywhere as a pair. :sunglasses:

thank you for youre very detailed answer to my problem.
yes, all white would be e problem.
i will change the location of the capasitors and redo the complete wiring. i think i know now what it is causing the problem thanks to you.
the resistor is already connected to data in off the first led and yes the data line is zig-zagging through all leds.
i used a mega because i had one and for now it is only e small experimental programm that i would like to expand. didn't know how much power i would need.
unfortunately i don't have much time in the next couple of days but as soon as i redid all of the wiring i will write again. hopefully resolved the problem.
thank you very much :wink: