Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: Profwombat on Dec 29, 2016, 12:53 pm

Title: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 29, 2016, 12:53 pm
I recently bought a Genuino Uno, and the following LED strip:
http://www.ebay.co.uk/itm/322206934135 (http://www.ebay.co.uk/itm/322206934135)
I should start by saying that I have no prior experience in electronics/using an Arduino - I am a programmer, and was hoping to easily set this up so I could program them as I want.

How do I connect this strip to the board? I have tried a few ways and nothing has worked. When connecting the 12v and ground wires to an external power supply, all of the LEDs flickered briefly, but beyond that they have not lit up at all.
Also, once connected, which library should I use to program them/how should I begin? I have been trying the Adafruit NeoPixel library, but not sure if this works with non-adafruit products?

Again, I have very little experience or understanding of any of this (and no desire to understand in detail), so please explain simply how to correctly connect them. Any help is appreciated.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 29, 2016, 04:18 pm
Quote
I am a programmer... no desire to understand in detail
Those two statement seem to be at odds with each other! How do you manage to do one if you don't do the other?

Yes, you should be able to use this strip with Arduino. You have the choice of the Adafruit or the FastLed library. Some tips: don't route the current for the strip through the Arduino board, but they must have a common ground.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 29, 2016, 05:42 pm
I have connected everything as shown in the images (sorry, they failed to upload).
The green "Data in" wire goes to digital port 6 on the arduino
The red "12V" wire goes to the + port on the external power supply (an AC-DC converter set to 12V)
The white "Ground" wire goes to the - port on the external power supply
There is also a paper clip (as a makeshift wire) connecting the ground port on the arduino to the - port on the external power supply

The lights never show any response to the arduino. As mentioned before, when they are plugged into the power supply, they briefly flash as shown in the image "led_flash.jpg"

What am I doing wrong? Why isn't it working? How do I fix it?

The code I am using (the demo provided on the FastLED github page):
#include "FastLED.h"
#define NUM_LEDS 60
CRGB leds[NUM_LEDS];
void setup() { FastLED.addLeds<NEOPIXEL, 6>(leds, NUM_LEDS); }
void loop() {
   leds[0] = CRGB::White; FastLED.show(); delay(30);
   leds[0] = CRGB::Black; FastLED.show(); delay(30);
}
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Reburg99 on Dec 29, 2016, 06:09 pm
Try changing your set to:
void setup() { FastLED.addLeds<WS2811 6>(leds, NUM_LEDS); }

They might not be recognized due to selecting NEOPIXEL.
   
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 29, 2016, 06:21 pm
Try changing your set to:
void setup() { FastLED.addLeds<WS2811 6>(leds, NUM_LEDS); }

They might not be recognized due to selecting NEOPIXEL.
   
Just tried that, hasn't changed anything, they still don't respond at all. Thanks anyway.

Also see this photo:
http://zsmith.ddns.net/photos/led_connection.jpg (http://zsmith.ddns.net/photos/led_connection.jpg)
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 29, 2016, 06:37 pm
(http://forum.arduino.cc/index.php?action=dlattach;topic=444778.0;attach=192575)
(http://zsmith.ddns.net/photos/led_connection.jpg)
A photo where we could see all the important connections in focus would be nice.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 29, 2016, 07:03 pm
Sorry, here is a better one, with annotations:
(http://zsmith.ddns.net/photos/led_connection_annotated.jpg)

Thanks for any help you can give.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 29, 2016, 07:50 pm
That's better. So there are two red (12V) and two white (ground) wires from the strip. You could dispense with that embarrassing paperclip and connect the second white wire to Arduino's ground. (Was that the Microsoft paperclip by the way? If so, well done catching him. Deserved what he got).

The usual recommendation is to have a low value resistor, eg. 220R or 330R, in series with the data line. Worth a go given the situation. The other recommendation is a large cap, eg. 1000uF, across the power lines to the strip.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Reburg99 on Dec 29, 2016, 07:57 pm
is there an arrow with the direction of data flow on the strip?  If so, make sure you're connected to the input side and not the output side.  It's irreverent for power, but data will only flow in one direction.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 29, 2016, 08:03 pm
The usual recommendation is to have a low value resistor, eg. 220R or 330R, in series with the data line. Worth a go given the situation. The other recommendation is a large cap, eg. 1000uF, across the power lines to the strip.
https://www.amazon.co.uk/dp/B0091GPLNA (https://www.amazon.co.uk/dp/B0091GPLNA)
Would this be the correct capacitor? And so do I Just place it so that each terminal (idk if that's the proper term) touches one of the wires? Or both terminals touching both wires?

https://www.amazon.co.uk/dp/B01I7S2TPU/ (https://www.amazon.co.uk/dp/B01I7S2TPU/)
And this one for the resistor?

Will these likely allow me to use the LEDs? Or are they just a step closer to a solution?

is there an arrow with the direction of data flow on the strip?  If so, make sure you're connected to the input side and not the output side.  It's irreverent for power, but data will only flow in one direction.
Yes, the arrows flow away from the side into which I have put the wires, I assume this is correct.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 29, 2016, 08:13 pm
Both of those components are fine. Just don't get ripped off, like paying 25p each for resistors or £1.99 postage on something the size of a peanut.

We don't know for sure they will fix the problem, but they are recommended, and we have to try something.

Quote
And so do I Just place it so that each terminal (idk if that's the proper term) touches one of the wires? Or both terminals touching both wires?
Connect the positive to red and negative (indicated on electro caps by a black band with "-" symbols) to white. Don't short 12V to ground unless you want your house to burn down.

What is the spec of the PSU? Does it have the current capability for your 5m strip?
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 29, 2016, 08:47 pm
OK, I have ordered that but will take about a week to arrive. Then we'll see if it works.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Reburg99 on Dec 29, 2016, 09:09 pm
Do you have a meter?  Have you tested the output of the power supply to verify it's outputing 12v and to make sure you have + to + and - to -?  After closer inspection of your pictures, are you sure you're getting a solid connection to the power supply? 
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 29, 2016, 09:15 pm
I don't have a meter, no, but I would hope I think the power supply should be trustworthy.

The connections may indeed not be very solid. How should I fix this? What is the proper way to connect those wires to that kind of plug?
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Reburg99 on Dec 29, 2016, 10:09 pm
Not really sure if there's an adapter for that specific connector or not.  You can cut the connector off and splice the bare wires together, just be sure to tape (electrical tape preferred....) or heat shrink the connections to prevent a short.  you could try folding the wire back on itself, this way your putting the jacketed portion and the bare portion into the plug at the same time.  This will at least fill more of the gap.



If you don't have a meter, how are you sure you have the positive and negative hooked up properly? 
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 29, 2016, 11:42 pm
Not really sure if there's an adapter for that specific connector or not.  You can cut the connector off and splice the bare wires together, just be sure to tape (electrical tape preferred....) or heat shrink the connections to prevent a short.  you could try folding the wire back on itself, this way your putting the jacketed portion and the bare portion into the plug at the same time.  This will at least fill more of the gap.
OK, thanks for the advice. I will try something once the other parts arrive.

If you don't have a meter, how are you sure you have the positive and negative hooked up properly? 
The power supply has logos on it showing which is positive and which is negative.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 30, 2016, 12:09 am
the power supply should be trustworthy.
Yes but what is its spec? What is its max current output. It can be the best make in the world but it still won't be able to maintain 12V if you try to pull double the max current it is rated for.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: vwy5 on Dec 30, 2016, 08:26 am
Hi all,

I'm looking for a library for controlling WS2811 led strip. I tried with FastLED but it seems to be too complex. My purpose is just change of color and making some effects. Anyone knows other library which is suitable for my purpose. Thanks in advance.

Regards,
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 30, 2016, 09:08 am
Hi vwy5. Start your own topic for your question. Thanks
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 30, 2016, 09:45 am
Yes but what is its spec? What is its max current output. It can be the best make in the world but it still won't be able to maintain 12V if you try to pull double the max current it is rated for.
https://www.amazon.co.uk/dp/B003Z6ZUJ2/

It says max 500mA. Is that good enough?
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 30, 2016, 10:03 am
I suspect that will be woefully inadequate. It may be the cause of your failure to get the strip working. 500mA @ 12V is enough for around 25 rgb leds.

But referring back to your original post, I realise there are two pieces of information you didn't tell us. How many leds per metre (30, 48 or 60)? How many metres long is the strip? (That eBay page does not seem to tell you how long the strip is that you are buying. That would have rung alarm bells for me and I would not have purchased from that seller).

For a 5m strip with 60 leds per metre, you would need a 12V PSU with at least 6A capacity, ideally 7.5A for safety.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 30, 2016, 10:10 am
How many leds per metre (30, 48 or 60)? How many metres long is the strip?
There are 60 LEDs on the strip, and the strip is one metre long, so 60 LEDs per meter.

(That eBay page does not seem to tell you how long the strip is that you are buying.
It lets you select which version you want, although I can't remember exactly which one I selected.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 30, 2016, 11:23 am
That seller is being dishonest. The picture shows a 5m of strip on a reel. Nowhere on the page does it say you will receive only 1m!

OK, so your strip has 60 leds. On 12V strips the leds are grouped in threes (you should be able to see one ws2811 chip after every third led). So that's 20 groups. Each group will need up to 20mA each for red, green & blue. So that's 1.2A in total. So get a 1.5A PSU.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 30, 2016, 11:32 am
https://www.amazon.co.uk/dp/B00KMRKQA0/ (https://www.amazon.co.uk/dp/B00KMRKQA0/)
I also have this one. 2A would be good right? But is there any way to connect the loose wires to this type of DC connector?
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 30, 2016, 11:46 am
You could cut off the connector, strip the wire and use 3A screw terminal strips (the sort normally used for lighting etc). Or you could buy a matching in-line socket and solder that to the strip wires like this (http://www.ebay.co.uk/itm/2-1mm-x-5-5mm-DC-POWER-SOCKET-IN-LINE-CONNECTOR-WITH-STRAIN-RELIEF-CCTV-PSU-/280774373393?hash=item415f74f011:m:mSW1m9j7v6z4oTEWZ-KaXFQ).

(http://forum.arduino.cc/index.php?action=dlattach;topic=444778.0;attach=192664)
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Reburg99 on Dec 30, 2016, 04:19 pm
Quote
The code I am using (the demo provided on the FastLED github page):
#include "FastLED.h"
#define NUM_LEDS 60
CRGB leds[NUM_LEDS];
void setup() { FastLED.addLeds<NEOPIXEL, 6>(leds, NUM_LEDS); }
void loop() {
   leds[0] = CRGB::White; FastLED.show(); delay(30);
   leds[0] = CRGB::Black; FastLED.show(); delay(30);
}
Please correct me if I'm wrong here.... but currently he's only trying to light the 1st 3 LEDs (leds[0]) in the strip. The current supply should be adequate for that, which leads me to believe there's another issue.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 31, 2016, 09:46 am
Please correct me if I'm wrong here....
I am no longer confident that we have solved the problem either.

The OP's sketch does not set the colour of the remaining leds, so there is no guarantee they will be off, they could be defaulting to random colours. And I was under the impression that the strip was 5m long, as shown in the eBay seller's picture. So that could have been a lot of leds showing random colours, or trying to, and overloading an inadequate PSU.

Now we know the strip is only 1m long. The 0.5A psu is still inadequate because even a 1m strip could draw 1.2A of all 60 leds were set to full brightness white. But it no longer seems likely that this would prevent any leds from lighting at all.

I am hoping that a resistor in series with the data line will clean up the signal and it will start working. But I can't be sure.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Dec 31, 2016, 10:56 am
I have ordered some resistors, which I believe should arrive in 3-5 days, so I will update when they are here.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Reburg99 on Dec 31, 2016, 03:49 pm
@PualRB good point about the other LEDs not being set. He could try adding FastLED.clear(); before setting the led the other led color.  Have you tried setting any color other then white?
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: vwy5 on Jan 09, 2017, 08:54 am
Hi vwy5. Start your own topic for your question. Thanks

Yep. There is no help here. Probably do as your suggestion.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: pepefest on Feb 17, 2017, 10:47 am
Profwombat - did you ever manage to get this to work ?
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: Profwombat on Feb 22, 2017, 06:11 pm
Profwombat - did you ever manage to get this to work ?
No, sorry, I gave up.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: KEVINJUDE on Sep 13, 2017, 01:54 pm
Hi all, i am new here, can i know what is the full programming codes to control WS2811 12V RGB LED Strip for running light 3 by 3 ?
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: cartwrig on Mar 02, 2018, 09:41 pm
No one mentioned this; but, since you're discussing WS2811.  That strip is 12VDC.  The Arduino's Digital Outputs are only +5VDC.  I'm thinking you would need to up convert the DIO's voltage to 12VDC, by using the 5VDC to drive an optocoupler, such as this:

https://electronics.stackexchange.com/questions/159694/n-channel-mosfet-as-12-vdc-switch
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Mar 03, 2018, 09:03 am
That strip is 12VDC.  The Arduino's Digital Outputs are only +5VDC.  I'm thinking you would need to up convert the DIO's voltage to 12VDC, by using the 5VDC to drive an optocoupler,
No, the strip is powered by 12V but it's data line requires a 5V or 3.3V signal.

If you apply 12V to the data line, you may damage it.
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: megabri on Aug 09, 2018, 10:15 pm
Hi, I had same problem at beginning... and finally I notice that I had connected the DATA from Arduino to the Dout pin of the Led Strip, instead to Din pin.
That solve my problem.

Have a nice day
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: moJoeRedRog on Aug 14, 2018, 05:50 pm
I have connected everything as shown in the images (sorry, they failed to upload).

use photobucket.com there host photos for free and they are so easy to put into messages
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: frankvnz on Dec 12, 2018, 12:58 am
No, the strip is powered by 12V but it's data line requires a 5V or 3.3V signal.
I know it's been a while, but... how sure are you of this? I'm struggling with this same problem. I don't think that 3.3V is enough. But maybe 5V?
Title: Re: How to connect WS2811 5050 RGB LED Strip to Arduino/Genuino Uno?
Post by: PaulRB on Dec 12, 2018, 08:12 am
I don't think that 3.3V is enough. But maybe 5V?
During a recent project, I also found that 3.3V data signal was not reliable with ws2811. There was considerable loss of data.

I tried using 1 channel of a 4 channel logic level convertor module to increase the 3.3V signal to 5V. This was much better, but still there was occasional data loss, and the circuit was not stable, for example touching the logic convertor module resulted in more data loss.

grumpy_mike suggested using a 74hc14. This chip contains 6 inverter gates with Schmitt trigger inputs. Two gates should be connected in series, and the chip powered by 5V. With this, there is no data loss or instability.