0

I’m trying to make a string of 300 Christmas tree lights where the colour of each of the lights is entirely controllable by my own code. I am a programmer so that side of things is the easy part as far as I’m concerned.

My researches so far have led me (no pun intended) to WS2811s driven by an Arduino. I prefer the look of these to the flat Adafruit-type ones. I don’t own an Arduino yet but have been dipping my toe into this site for quite a while now so am beginning to understand the basics.

I’ve established that I will need to have a fairly hefty 5volt power supply for the LEDs but that the Arduino itself can then run happily on its own USB supply.

Some of the things I’ve read seem to imply that the Arduino will struggle to process my program and supply the data to 300 LEDs at the same time, but it’s not clear what the problem will be. I assume each LED will continue to glow with the same colour until it receives the data for its next colour and the code for “Fire!” which then prompts all of them to switch to their next colour. Is this wrong?

I realise that 3 bytes per LED for 300 LEDs is a fair amount of data to keep having to send up the wire. I will also be having an array in the program to keep track of all 300 colour values.

Will this work? Can you offer any advice that might mean I don’t hit a brick wall somewhere when putting all this together?

  • You don't need a full Arduino. You can use either a bare AVR chip or breakout or a small Arduino-like for this. – Ignacio Vazquez-Abrams Dec 1 '15 at 13:00
  • @IgnacioVazquez-Abrams AVR is a new term I've never heard of, can you link to somewhere I can read-up please? What would be the advantage over Arduino, just cost and physical size? – Lefty Dec 1 '15 at 14:11
  • Make sure to provide power to the string at multiple locations. With the amount of current 300 leds use, the small resistance in the wires can create a big enough voltage drop for the leds at the end to be dimmer or malfunction. – Gerben Dec 1 '15 at 14:46
  • @IgnacioVazquez-Abrams Thanks, I think the native AVR may be a bit out of my comfort-zone. I'll get the thing working with an Arduino and move on to the big-boy stuff if I get bitten by the bug! I don't get a lot of time to play with things like this - I really just want some Christmas lights that are better than can buy in the shops! I know I can code a better version and just need the hardware to work. – Lefty Dec 1 '15 at 15:14
1

I don't think you'll have any problems. The LED's have a data rate of 800kbps, so you can theoretically push out 110 frames per second if your Arduino does nothing but transmit data. If you keep the routine that updates the colors fairly efficient then you'll have nothing to worry about.

Note that the array storing the colors would take up 900 bytes of memory, leaving you with only 1100 bytes for everything else your program would need to store (which should be fine).

  • Thanks Tom. I didn't realise that there is only 2K of memory on board, I'm sure I will be able to work with that though. I saw a video where this guy says something like "The Arduino will struggle to provide data fast enough", so I was a bit concerned about the speed. – Lefty Dec 1 '15 at 10:08
  • @Lefty of course speed is a concern, but... Since the application requires low resources (you will not make really complex animations, will you?) you won't have issues. Just don't waste too much time in useless things, don't use delays and try to use 8-bit variables.. And avoid mallocs or variable size buffers – frarugi87 Dec 1 '15 at 10:35
  • No complex animations - just colour fades of individual LEDs which will be fairly sedate. In a way, what I want is to be able to just send data for ONE LED at a time but I realise that there is no actual address for each LED, just this clever bit-shifting thing where each one steals the first 3 bytes and passes the rest on. I take it Delay uses an internal loop to waste cycles? What about the LEDs? Will they maintain the same colour until the next refresh signal? – Lefty Dec 1 '15 at 11:06
  • Yes, they maintain their states. – Tom van der Zanden Dec 1 '15 at 11:07
  • Excellent, thank you. Unless anyone else gives an answer that concerns me, I think I will invest in the equipment and hopefully get this all working. Is it worth me buying a particular type of Arduino that may be faster just to be sure? – Lefty Dec 1 '15 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.