Need guidance for selecting appropriate power supply and for connecting a lot of LEDs properly

@ gilshultz 9 volt 1 amp wall-wart power supply worked OK for 1 hour without heating Arduino Nano's voltage regulator. Now i want to know one more thing, "Can i use 5 volt directly from main power supply (5v 30a 150w) to connect it to Arduino Nano's +5v pin, just as i have shown in the image below?"

It should work just fine!

Hi,

Yes, BUT put a fuse in line with the Nano and/or your project, so if you have a short on your project you do not blow the PCB and controller to smithereens with the full 30A from the power supply.

Tom... :smiley: :+1: :coffee: :australia:

1 Like

That would be what I recommended in #13. :roll_eyes: It makes no sense to use a non-5V power supply if you already have the proper 5 V power supply.

Note however that I explained some important things about the layout of the wiring, not quite the way your diagram indicates.

@gilshultz Thanks for your guidance :slight_smile:

@TomGeorge I will follow your advice for sure. Thank you :slight_smile:

But that 5 volt comes with way higher amps; So i was bit scared to run Nano with it. Yes, i will surely follow your guidelines. Thank you very much for spending your time helping me and others.

So here i have exactly 540 ws2812b led lights mounted in “L” shape on the edge of the main roof of my house. Now can someone please tell me where can i learn creating my own sketches/codes. I mean if there is any book available on this subject, then i would like to read it.

Yes, we get this here a lot.

The answer goes like this: My power outlets in the house are rated at 240 V, 10 Amps. I can plug in a toaster that draws 10 Amps, or a heater, it is rated at 2400 Watts.

I have in front of me an Ikea LED light which is 3 Watts. This means the power supply needs only 3 / 240 or about 12.5 milliamps.

How then is it safe to plug it into my power outlet which comes with way higher Amps - 10 Amps, eight hundred times as much in fact?

1 Like

The power supply only takes what it needs. For an analogy, you go to the sink and get a glass of water, no problems. You have thousands of liters available at many atm pressure why was the glass not blown out of your hand? You do the the control with the faucet. The power supply only takes what it needs by controlling the flow with electronics. There are several books on basic electronics that will explain this.

The power supply load only takes what it needs. For an analogy, you go to the sink and get a glass of water, no problems. You have thousands of liters available at many atm pressure why was the glass not blown out of your hand? You do the the control with the faucet.
The power supply load only takes what it needs by controlling the flow with electronics due to its resistance across the power supply terminals.
There are several books on basic electronics that will explain this.

Say you can have a 240V 10A power supply.
Your load can be a 240V 2A lamp and it will only draw 2A from the supply at 240V.
Your load can be a 240V 8A lamp and it will only draw 8A from the supply at 240V.

What it is advised not to do is make your load 240V 15A lamp, as it will try and draw 15A from the supply, this is an overload condition.
Power supplies have different ways of dealing with the 15A overload.

  1. Some lower the output voltage until only the rated 10A flows.
  2. Some shutdown to zero volts output, requiring a power supply OFF/ON to reset.
  3. Some shutdown and briefly cycle ON/OFF checking if the overload is still there, if not then the supply restarts. (They tick..tick.. tick..)
  4. Some blow a fuse.
  5. Some just let the smoke out (A very effective method as it notifies the Audio, Visual and Olfactory senses.)

Tom... :smiley: :+1: :coffee: :australia:

2 Likes

@Paul_B Do you think, It is more proper to power Nano through a 5v 30a 150w power supply using Nano’s +5v pin than powering it through a 9v 1a wall-wart power supply using Nano’s VIN pin? If yes, then can i please know why?

Do i need to start a new topic for my #28 post? And do i need to post it under “Programming Arduino” section of this forum?

Absolutely. See #24. Also avoids the risks of having one supply turned on while the other is not.

Note that you must run the three wires all together - as a bundle or single cable - from the start of the LED strip where the 470 Ohm resistor is, back to the Nano; the ground, the data wire and the 5 V power for the Nano. And just in case, since these are much lighter gauge wires than the main power that is connected into the LED strip every 50 LEDs, you also put a 1 Amp fuse in series with only the 5 V connection for the Nano, at the LED strip.

If it is for an entirely different project, Otherwise it would constitute a "cross" posting duplicating information on the same project and would automatically (once reported as such) be merged back to this post.

Not if it is for guidance on your project. :grin:

Hello,

Before i begin, i want to acknowledge Arduino forum team that, i have absolutely no knowledge related to programming language such as c++. So please go easy on me and if possible please help me write some awesome Arudino codes for my 540 LED project.

---> Here is my first pattern of imagination. I want all 540 leds light up in 'Fire' CRGB(255, 45, 0), and then i want to gradually turn them into 'Gold' CRGB(255, 65, 0); And then Gold back to Fire; And this cycle continues forever. But whenever Fire turns Gold, there should be bright glitter effect (Same as glitter effect of "DemoReel100"). Now that glittering should increase as Fire approaches Gold, and decrease as Gold approaches Fire.

---> Second pattern: How can i add custom color palette into "TwinkleFox"? For example, i want to add a custom palette of 'Gold' CRGB(255, 65, 0) and 'Fire' CRGB(255, 45, 0) and make it twinkle.

---> Here is third pattern of my imagination. I want first 352 LEDs gradually light up to it's full brightness in Cyan color and then gradually light off to complete darkness (Just like a time lapse video of a blooming flower bud and reversing the bloom). Now as first 352 LEDs lights off, rest 188 LEDs should repeat the same pattern but with Magenta color, instead Cyan. And this cycle should continue, but the time period of blooming flower bud and reversing the bloom, should gradually decrease; And as it gets fast enough, 352 Cyan and 188 Magenta LEDs should all light up to their full brightness for couple of seconds and gradually fade out to complete darkness. And this whole cycle continues forever.

---> Fourth pattern: Below is a code for a custom pattern i created from a youtube tutorial video (Tutorial video link - Use Addressable LED Strip with Arduino || Essential Engineering - YouTube). In my code, light color changes as it travels from one end to the other. For example Red to Yellow, Yellow to Green, Green to Cyan, Cyan to Blue, Blue to Magenta and Magenta to Red.

[code]
#include <FastLED.h>
#define LED_PIN 12
#define NUM_LEDS 540

CRGB leds[NUM_LEDS];


void setup() {
  FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 5000);
  FastLED.clear();
  FastLED.show();

}

void loop() {
  // Turn lights from red to yellow from left to right
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB(255 - 0.2 * i, 0.2 * i, 0);
    FastLED.show();
    delay(0);
  }
  // Turn lights from yellow to green from right to left
  for (int i = NUM_LEDS; i > 0; i--) {
    leds[i] = CRGB(255 - 0.2 * i, 255 - 0.2 * i, 0);
    FastLED.show();
    delay(0);
  }
  // Turn lights from green to cyan from left to right
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB(0, 255 - 0.2 * i, 0.2 * i);
    FastLED.show();
    delay(0);
  }
  // Turn lights from cyan to blue from right to left
  for (int i = NUM_LEDS; i > 0; i--) {
    leds[i] = CRGB(0, 0.2 * i, 255 - 0.2 * i);
    FastLED.show();
    delay(0);
  }
  // Turn lights from blue to magenta from left to right
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB(0.2 * i, 0, 255 - 0.2 * i);
    FastLED.show();
    delay(0);
  }
  // Turn lights from magenta to red from right to left
  for (int i = NUM_LEDS; i > 0; i--) {
    leds[i] = CRGB(255 - 0.2 * i, 0, 0.2 * i);
    FastLED.show();
    delay(0);
  }
}
[/code]

Now the issue with the code above is, LEDs turns on from left to right and right to left at very slow speed because number of LEDs are 540. If i try the code listed below on my 30 LED test strip, it works fine!

[code]
#include <FastLED.h>
#define LED_PIN 12
#define NUM_LEDS 30

CRGB leds[NUM_LEDS];


void setup() {
  FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 5000);
  FastLED.clear();
  FastLED.show();

}

void loop() {
  // Turn lights from red to yellow from left to right
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB(255 - 4 * i, 4 * i, 0);
    FastLED.show();
    delay(40);
  }
  // Turn lights from yellow to green from right to left
  for (int i = NUM_LEDS; i > 0; i--) {
    leds[i] = CRGB(255 - 4 * i, 255 - 4 * i, 0);
    FastLED.show();
    delay(40);
  }
  // Turn lights from green to cyan from left to right
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB(0, 255 - 4 * i, 4 * i);
    FastLED.show();
    delay(40);
  }
  // Turn lights from cyan to blue from right to left
  for (int i = NUM_LEDS; i > 0; i--) {
    leds[i] = CRGB(0, 4 * i, 255 - 4 * i);
    FastLED.show();
    delay(40);
  }
  // Turn lights from blue to magenta from left to right
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB(4 * i, 0, 255 - 4 * i);
    FastLED.show();
    delay(40);
  }
  // Turn lights from magenta to red from right to left
  for (int i = NUM_LEDS; i > 0; i--) {
    leds[i] = CRGB(255 - 4 * i, 0, 4 * i);
    FastLED.show();
    delay(40);
  }
}
[/code]

---> And lastly, i want a perfect rainbow divided across the strip of 540 LEDs (like approximate 90 LEDs containing each color of rainbow); And it should move at normal speed for sometime and then it should move at light speed for couple of seconds and then back to normal speed. And the cycle continues. This should mimic time travel of star trek (like stars coming at you in light speed!). I have tried AdaFruit code for "Moving Rainbow" as it is listed below.

[code]
#include <Adafruit_NeoPixel.h>

#define LED_PIN 12
#define LED_COUNT 540

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB);

void setup() {
  strip.begin();
  strip.show();
  strip.setBrightness(200);
}

void loop() {
  rainbow(10);
}

void rainbow(int wait) {
  for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
    for (int i = 0; i < strip.numPixels(); i++) {
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show();
    delay(wait);
  }
}
[/code]

But what i notice is, there is more green and blue LEDs compare to rest 4 color LEDs. I have a 30 led strip for test purpose. So i ran AdaFruit's "Moving Rainbow" code into that and i stopped the rainbow from moving across the strip and i got the result as i have listed below...

3 Red LEDs
4 Yellow LEDs
7 Green LEDs
4 Cyan LEDs
7 Blue LEDs
5 Magenta LEDs

Here is an image that shows the fact.

So it is not a perfect rainbow. It should be like 5 LEDs of each color. So if someone help me with a perfect "Moving Rainbow" code, please do that Sir! Same weird "Rainbow" issue can be found on "DemoReel100" as well. So any fix to that will be also very appreciating!

---> One last thing, in Adafruit's code above, i made a little change, and i accidentally got a new pattern (which i wanted actually). It basically turns all 540 LEDs from Red to Yellow, Yellow to Green, Green to Cyan, Cyan to Blue, Blue to Magenta and Magenta to Red. I have listed this new code below.

[code]
#include <Adafruit_NeoPixel.h>

#define LED_PIN 12
#define LED_COUNT 540

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB);

void setup() {
  strip.begin();
  strip.show();
  strip.setBrightness(200);
}

void loop() {
  rainbow(10);
}

void rainbow(int wait) {
  for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
    for (int i = 0; i < strip.numPixels(); i++) {
      int pixelHue = firstPixelHue + (i + 65536L / strip.numPixels());
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show();
    delay(wait);
  }
}
[/code]

But there is an issue with this code. Because i have set " rainbow (10) " to " rainbow (60) ", all 540 LEDs stutters during Magenta turns Red and Red turns Yellow. Is there any solution to avoid this unwanted effect?

Thank you very very very much for taking your time into helping others :slight_smile:

Hi,
Please read the post at the start of any forum , entitled "How to use this Forum".

This will help with advice on how to present your code and problems.

You need to post images into to post, please do not make us load it off forum.
If the image is too big, then reduce it using Win Paint for example.

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

Anyone with C++ background, please help! I am waiting for at least a week :frowning:

This is almost ALWAYS due to power issues. I have to say almost because invariably, someone will see it otherwise once, but every time I see any flickering of LEDs or unstable colors it's because I don't have enough power injections on the strips/strings.

We're here to help you understand your code. If you have tried something and can't get the results you expect, then ask in the programming forum. ONE issue per post, please. If you just drop a basket of unrelated questions, your chances of finding assistance drops quickly.

If you want someone to write the code for you (for a fee), then post your question in the "Gigs and collaborations" forum.

You mean, i need to ask for the patterns of imagination under this forum page...

And if any person is interested to write me a code, then he/she will tell me the price for it. Am i write Steve?