Newbie questions

Hi folks,

To start I appreciate any help you can offer me here. To make a long story short. I decided to give myself a year to make an amazing costume for Halloween next year, it will hopefully include LEDs. The main piece being a cloak that I want to have an LED matrix on that will flash animations. My questions are then:

  1. What is a realistic amount if LEDs I can put in a matrix, and still power it with batteries? (Doing some quick math I've come up with 35 columms x 60 rows of LEDs which would give me 2100 individual LEDs, and I don't have plans to ever have them all on at once.)

  2. Assuming its realistic to use so many LEDs, what's my best option for type of rgb individually addressable LED? (I ordered some ws2812b LEDs to build a small matrix and figure out some of the coding)

  3. Would it be better to wire it as one long strip (series?) or would it be best to do the columns and rows (parallel?)?

  4. I've been reading up on hex values to build an array of values along the rows so each led knows how and if to light up. With that said, is it possible to set color and brightness with a single hex value or does brightness have to be handled seperately?

I'm entirely new to electronics, coding, LEDs, etc so it'll be a learning process but I've spent the last few months working towards my vision. Hopeful that its feasible and thankful for any help. :wink:

Choose your Arduino with care. Many will be too large to sew into a costume, e.g. Uno, Mega. Most small Arduino, e.g. Nano, Pro Mini, won't be able to control 2100 LEDs. I think you should look at AdaFruit Trinket M0. This is tiny but has a more powerful chip than most Arduino, more memory and so on, so can control more LEDs.

As for the number of LEDs you are planning, 2100 is a very large number indeed. Each will need to be soldered, whichever way you decide to wire them, and that is a lot of soldering for a beginner, and each solder joint is a weak point which could fail as the costume moves.

Don't get too excited about using hex. Hex is not any kind of magic, is just another way of writing down numbers, like decimal or even Roman numerals for that matter. Yes, you can describe colour and brightness using hex, but you need more digits, just as you would if you were using decimal.

The Arduino language is C, and C is a compiled language. So whether you use binary, octal, decimal, hex or whatever, it makes no difference to the size of the uploaded sketch.

Thanks for your response :slight_smile:

PaulRB:
Choose your Arduino with care. Many will be too large to sew into a costume, e.g. Uno, Mega. Most small Arduino, e.g. Nano, Pro Mini, won't be able to control 2100 LEDs. I think you should look at AdaFruit Trinket M0. This is tiny but has a more powerful chip than most Arduino, more memory and so on, so can control more LEDs.

Thanks for this, I'll be grabbing one soon. I'm assuming i can still upload via arduino ide? I currently have an adrino uno rv3 and was going to hook up a few shift registers to it to help control all the rows and columns

PaulRB:
As for the number of LEDs you are planning, 2100 is a very large number indeed. Each will need to be soldered, whichever way you decide to wire them, and that is a lot of soldering for a beginner, and each solder joint is a weak point which could fail as the costume moves.

It's an pretty big number, but I dont plan on having more than 200 lit at once and that's assuming I go crazy on the animations. At most I'd be using around 50 to 75. As for the soldering, you got me there. But the only way to learn is do. :slight_smile: though I was thinking about using liquid black tape to help affix the LEDs to the wires and cloth after their soldered, though I'm not sure if this will negatively impact the LEDs yet.

PaulRB:
Don't get too excited about using hex. Hex is not any kind of magic, is just another way of writing down numbers, like decimal or even Roman numerals for that matter. Yes, you can describe colour and brightness using hex, but you need more digits, just as you would if you were using decimal.

The Arduino language is C, and C is a compiled language. So whether you use binary, octal, decimal, hex or whatever, it makes no difference to the size of the uploaded sketch.

Thanks for the heads up. I've been watching videos and understand it's just another way to write the same information. I say hex because its what I've seen in other posts on controlling brightness on addressable LEDs. As of yet, hex is the only way to control color in a pattern array that I've come across. Which I'd imagine could he replaced with hsv/rgb.

In looking at the pdf for the ws2812b on the website I can see it's a 24 bit data system, and I'm sure I could use that to control color and intensity but, I haven't figured it out yet.

According to the pdf it's: g7|g6|...|g0|r7|r6|...|r0|b7|b6|... |b0

Could I use those directly in the array to set it to what I want?

E.g. patternRowsStars[35] = {100000001000000010000000, 000000000000000000000000...etc}

was going to hook up a few shift registers to it to help control all the rows and columns

Shift registers? I thought your plans were to use ws2812 or similar.

According to the pdf it's: g7|g6|...|g0|r7|r6|...|r0|b7|b6|... |b0

Could I use those directly in the array to set it to what I want?

E.g. patternRowsStars[35] = {100000001000000010000000, 000000000000000000000000...etc}

I don't think I exactly get what you're suggesting there. But if you plan to lay out your patterns and animations as frame-by-frame detail of the colour & brightness of every led, to me that sounds like a monumentally long and tedious task, and a very large amount of data. This is 2018, and we have computers to relieve us humans of such monotonous tasks. We have the ability to describe the essence of an idea in the form of algorithms and mathematical equations. Computers can run those algorithms and perform the detailed calculations so much faster and more accurately than we can. So why get a dog and bark yourself?

PaulRB:
Shift registers? I thought your plans were to use ws2812 or similar.

I am, but like I said I'm about a week into this project and learning as I go. I'm sure at this point I dont fully understand the capabilities of a ws2812 or similar.

PaulRB:
I don't think I exactly get what you're suggesting there. But if you plan to lay out your patterns and animations as frame-by-frame detail of the colour & brightness of every led, to me that sounds like a monumentally long and tedious task, and a very large amount of data.

That was my plan, yes :slight_smile:

PaulRB:
This is 2018, and we have computers to relieve us humans of such monotonous tasks. We have the ability to describe the essence of an idea in the form of algorithms and mathematical equations. Computers can run those algorithms and perform the detailed calculations so much faster and more accurately than we can. So why get a dog and bark yourself?

I'd be eternally grateful if you could direct me in the right direction with that, or tell me a program I can get that can handle 2100 ws2812's :slight_smile: I've been reading up on arduino code for a week now, which I'm sure is helpful and not a bad thing, but if there is something that could save me days/weeks/months of coding trial and error I'd be thankful.

I will try to help and lots of others on the forum will help too, as long as you show that you are willing to learn and work hard.

Don't imagine that there is some code or program out there that is tailor made for your requirements. Your ideas will be unique and original to you, so your code must also be. But you will find code to give you inspiration and useful examples.

Your Uno will not be able to deal with 2100 LEDs, but you can use it with a small matrix of ws2812 LEDs to help you practice. The Trinket M0, or some similar Arduino with a more advanced chip will be able to control 2100 LEDs.

First thing to try will be to make a small matrix of ws2812 LEDs and get your Uno to control them. You can use an example sketch from the AdaFruit NeoPixel library or the FastLED library to begin. But make sure to use a PSU or battery with enough current capacity. Even the example sketches with a small matrix of LEDs can draw a substantial current, up to 60mA per LED @ 5V.

Post here again when your parts arrive and let us know your progress.

A WS2812 or similar individually addressable LED is controlled without shift registers. Each LED has power, ground, data in, and data out, and contains a controller chip that interprets the data stream and drives the red, green and blue LEDs. You use FastLED or Adafruit Neopixel library to send the data down the data line, each LED forwards all but the most recent 24 bits (or 32 bits on the RGBW ones) received to the next led down the string. Some individually addressable LEDs use two lines, data and clock in a similar manner - these don't have the tight timing dependence that WS2812-like LEDs do, and can often be updated much faster.

This is totally different from how an LED matrix is wired up with shift registers and the like with "dumb" LEDs.

You need to put a bit of thought into the sort of scale you're thinking of.

2100 LEDs requires 6300 bytes of ram on the microcontroller just for the frame buffer (not counting memory for other functionality). An arduino uno has 2048. I control 200 LEDs per atmega328p, since the animation code ends up needing about as much ram as the frame buffer, at least in my case, plus overhead for a user interface and stuff like that - besides, 200 LEDs was about the limit I was able to get an acceptable frame rate out of for the animations I wanted to do with a 16MHz AVR controlling it.

200 LEDs on full white at once will draw 12 amps at 5v - 60W. I power 200 LEDs at a time from 19v@3.4A laptop power supplies, and have the software prevent it from turning them all on to full brightness (90% works, though). I've powered strings of 50 from the larger power banks - with average brightness of maybe 25%, they barely last the duration of a party.

2100 LEDs at full power would need 126 amps, 630 watts - you'd need to drag a wagon behind you with a gasoline generator to power them and the fans to keep the LEDs from overheating and/or cooking you alive; your spectators would need sunglasses.

DrAzzy:
A WS2812 or similar individually addressable LED is controlled without shift registers. Each LED has power, ground, data in, and data out, and contains a controller chip that interprets the data stream and drives the red, green and blue LEDs. You use FastLED or Adafruit Neopixel library to send the data down the data line, each LED forwards all but the most recent 24 bits (or 32 bits on the RGBW ones) received to the next led down the string. Some individually addressable LEDs use two lines, data and clock in a similar manner - these don't have the tight timing dependence that WS2812-like LEDs do, and can often be updated much faster.

This is totally different from how an LED matrix is wired up with shift registers and the like with "dumb" LEDs.

Thanks for this, it was super helpful and appreciate you taking the time to explain it to me. Been reading so much over the code and working on programming my small strand different way that i havn't even been online to respond.

DrAzzy:
200 LEDs on full white at once will draw 12 amps at 5v - 60W. I power 200 LEDs at a time from 19v@3.4A laptop power supplies, and have the software prevent it from turning them all on to full brightness (90% works, though). I've powered strings of 50 from the larger power banks - with average brightness of maybe 25%, they barely last the duration of a party.

2100 LEDs at full power would need 126 amps, 630 watts - you'd need to drag a wagon behind you with a gasoline generator to power them and the fans to keep the LEDs from overheating and/or cooking you alive; your spectators would need sunglasses.

haha, yeah, that could be a bit much. I don't think that'd be easy to work into a decent Halloween outfit. :smiley: The thing is I don't intend to ever have them all lit up at once. What I'm going for is a cloak that has the ability to do small animations throughout it's entire surface. Something I'm envisioning is for example, brief "twinkles or shimmers* generated randomly across its surface, or small images. Nothing that will use more than 200 or so leds at a time at max. As it stands, i'm 90% sure the leds will be covered by a light diffusing cloth, since it's more a subdued light pattern i'm after and not the exact pinpoint of light, though i'm not sure if i could do the same thing with dimmer leds. Being honest, i'm not sure all the leds will even be used in the animation, but that's the best way i can imagine doing what i'm after. I hope that offers some insight into what i'm trying to accomplish.

DrAzzy:
You need to put a bit of thought into the sort of scale you're thinking of.

2100 LEDs requires 6300 bytes of ram on the microcontroller just for the frame buffer (not counting memory for other functionality). An arduino uno has 2048. I control 200 LEDs per atmega328p, since the animation code ends up needing about as much ram as the frame buffer, at least in my case, plus overhead for a user interface and stuff like that - besides, 200 LEDs was about the limit I was able to get an acceptable frame rate out of for the animations I wanted to do with a 16MHz AVR controlling it.

I'm thinking of using the uno to light leds in my headpiece that i'm making, but regarding the cloak, PaulRB suggested a AdaFruit Trinket M0. Once I get my head around coding a bit more I'll try giving that one a go.

While I'm here, i've managed to write code to generate random colors and either turn them all on, or do a chase pattern down the strand. Nothing fancy, but for my first sketch it's decent, and it's helping me understand the code more:

#include <FastLED.h>
#define NUM_LEDS 3

CRGBArray<NUM_LEDS> leds;

void setup() { 
  Serial.begin(9600);
  FastLED.addLeds<WS2812B,3, GRB>(leds, NUM_LEDS); 
  }


void loop() {
int colorsRandom[] = {random(0, 255), random(0, 255), random(0, 255)};


for(int ledTotal = 0; ledTotal <= NUM_LEDS; ledTotal ++) {
  leds[ledTotal] = CRGB(colorsRandom[0], colorsRandom[1], colorsRandom[2]);
  FastLED.show();
  delay(5000);
  leds[ledTotal] = CRGB(0, 0, 0);
  FastLED.show();
  delay(0);
}

Serial.print("New Red Value: ");
Serial.println(colorsRandom[0]);
Serial.print("New Green Value: ");
Serial.println(colorsRandom[1]);
Serial.print("New Blue Value: ");
Serial.println(colorsRandom[2]);
Serial.println("**************************");
}

Something i'm noticing however, and not sure entirely how normal this is but I notice my led's "pulse" or flicker with light while they're set on a static color.

Do you see this same flickering when running the FastLED example sketches?

I just remembered something I noticed while working with ws2812b LEDs in a battery powered circuit. My measurements indicated that every led used something around 1mA when they are off! So your 2100 LEDs could draw over 2A even when not a single led is lit...

PaulRB:
Do you see this same flickering when running the FastLED example sketches?

Yes, I do. Only on certain colors though, which is similar to how it works with the code I wrote.

PaulRB:
I just remembered something I noticed while working with ws2812b LEDs in a battery powered circuit. My measurements indicated that every led used something around 1mA when they are off! So your 2100 LEDs could draw over 2A even when not a single led is lit...

I was going for a 35 columns by 60 rows, with the columns being spread out across the cloak and the rows being 1" apart. If i increase that from 1" to 1.5" distance per row it would drop down to 1400 LEDs. I was also thinking of supplying power to every few sets of columns with individual battery packs (4 packs with each covering @ 350 LEDs assuming i go with the 1.5" layout). Weight isn't a big issue, i'm a tall beefy guy so a few battery packs wouldn't bother me.

In your opinion is there a better option out there that would work with what I'm after, and be a better than the WS2812B?

Thanks again for all the info :slight_smile:

If you get the flickering with the example sketches, it could be a hardware problem. Post a schematic showing how you wired everything, and give details of how many LEDs and how you are powering the circuit.

Maybe other types of adressable LEDs have lower "quiescent current" per led. You would have to look at their data sheets. There are several models around, including apa102, sk... something. I was looking at "DotStar" LEDs recently, but they also seem to consume around 1mA.