Best practices for DIN and generally hooking up a WS2813 LED Strip [solved] - Page 1
Forum section: electronics / beginners

author: bob21
author_rank: Regular Contributor
timestamp: May 13, 2020, 08:45:25 am
content: I am trying to apply what I have learned about LEDs from my previous thread here:https://www.eevblog.com/forum/beginners/hooking-up-several-3v-led-string-lights-to-a-psu/and use it to calculate what resistance I will need to place before this strip.I have re-read the thread, but I am getting stuck because of the forward voltage value. I may just be over complicating things though.Details:PSU: 5V 30A PWMLED Strip: 5 meters of W2813's @ 60/m = 300 LEDs total (5V 0.05A version if the eBay listing can be believed)Printed on packet is also: 90WAdafruits general recommendation is 100-500 ohms, or so I have read. Not really sure what that is supposed to mean. Seems useless to just recommend such values without knowing anything about the setup?!Now the incredibly unhelpful (to my eye) datasheet is here:http://www.led-color.com/upload/201609/WS2813%20LED.pdfI am uncertain which brightness version they are because the eBay listing did not say It's probably safe to assume they are the WS2813D's because the WS2813C's are brighter and they would have been listed as a selling point. Both are listed as 5V and 0.05A, however.I cannot see anything in that datasheet that mentioned forward voltage (maybe someone else can spot it?). I thought I'd try and be clever and put my meter to diode setting and put the probes on pins 2 and 5 and it gave a reading of 0.8V. This seems incorrect, if most LEDs are 1.7V to 3V forward voltage.. probably being skewed by the IC in it?So from the other thread I learned about: Input voltage - Forward voltage = Current x ResistanceHow can I reliably calculate what the forward voltage is of one of these LEDs so I can calculate the entire strip?Edit: added total LEDs

author: Ian.M
author_rank: Super Contributor
timestamp: May 13, 2020, 10:43:40 am
content: The IC in each LED controls the current through each individual LED colour die. Therefore for any of the various types of 'Neopixel' (and other smart LEDs), no series resistor is required. Also you cannot connect them in series, nor should you limit the supply current to them, they always go in parallel across a 'stiff' nominal 5V supply.Its common to daisy-chain them with DOUT of one direct to DIN of the next, which is how strips of them are connected. Where a resistor comes into it is to protect DIN of the first LED in the strip as the high supply current pulses if you flash a lot of the LEDs simultaneously, can cause Vcc and Ground at the LED strip to bounce around a lot, possibly causing the logic levels from the controlling MCU as seen by DIN of the first LED to go outside the LED's supply rails, and if not limited by a resistor the input will then draw enough current to destroy it. 470R is generally the best choice, and only in the MCU to DIN wire, although if you have very long cable runs to the LED strips, 220R at each end may be preferable and additionally, for long cables, if you want it to be 'bulletproof' a BAT54S dual series Schottky diode can be added right at at the first LED (it wont do any good at the MCU end of the wire) to clamp DIN to keep it between the rails. Fit it across the rails cathode positive, common to DIN.N.B. there are various quality problems with cheap suppliers of 'Neopixel' type LEDs and LED assemblies. I strongly recommend soak-testing your strip for several hours, alternating between all LEDs full on most of the time, and periodically a rippling RGB pattern to confirm they are still properly controlled, before assembling it into any artwork or other project where it would be difficult to easily replace.

author: bob21
author_rank: Regular Contributor
timestamp: May 13, 2020, 11:45:12 am
content: Hi Ian,Thank you very much for taking the time to answer this.This makes more sense now.Cheers for the heads up on LED soak testing. I will get something setup over the next couple of days and do as you suggest before putting them in situ. I haven't hooked anything up yet because I wasn't sure if something would have gone pop. Looks like that was a good decision.I have just ordered some BAT54S diodes.The W2813's have a BI line as well as there DI line, I think this is meant to be tied together. So place the resistor along the single wire that is soldered to both pads as close to the start of the strip as possible? When you say one at the opposite end, do you mean literally just soldered to the DO at the end of the strip? This might be a daft question, but does this not have to then be connected somewhere else?

author: Ian.M
author_rank: Super Contributor
timestamp: May 13, 2020, 01:14:25 pm
content: On the strip's silksceen DIN may be abbreviated as DI, BIN as BI and DOUT as DO. For clarity I'll use the full names from the datasheet.If you are using *LONG* wires, resistors each end of thewire(i.e at the MCU and first LED) are advisable. Don't do *ANYTHING* with DOUT at the other end of the strip except possibly daisychain to DIN another strip. For long strips, feed power at both ends. If daisychaining, feed power at the first LED of the first strip and ideally all intermediate connections between strips. Anywhere you use DIN or DOUT, the power and ground at the same end of the strip(s) must also be connected. Long daisychain interconnect wires should probably have a series protection resistor in the DIN line, same as from the MCU to the first LED.N.B. The BAT54S is a SMD part. Unless you are very lucky with the strip's pad layout, you'll *either* have to make a little board to carry the BAT54S and DIN protection resistor (and any connector you want for the power and data cables) with pads to match the strip at its edge you can bridge to the strip with short bare wirelinks, *or* 'dead-bug' it. i.e. glue the BAT54S upside-down to the strip and hook it up with magnet wire (or if really short connections bare wire).I found a readable copy of the WS2813 (its WS... not just W...) datasheet, as your link wasn't loading here this morning:https://www.elecrow.com/download/WS2813_LED_Datasheet.pdfQuote from: Dataheet Pg2Quote from: WikepediaSo BIN is meant to be connected to DIN of the previous LED, receives data, and strips (literally 'eats' ) the 24 bits used by the previous LED, before comparison with the data on DIN from DOUT of the previous LED, the idea being that if a single LED fails to pass data, it will be auto-bypassed so the rest of the string stays alive, I believe without changing 'slot positions' in the data packet.Obviously that doesn't apply at the first LED of the string. The datasheet doesn't say what to do but the consensus (Stackexchange and elsewhere) says ground BIN at the first LED and use DIN. If that doesn't work, try a 10K pullup on first LED BIN. *DO* *NOT* connect DIN and BIN together as the first LED will detect a mismatch between DIN and the internally 24 bit shifted BIN and fall back to BIN discarding one LED's worth of data. If you are unlucky enough to blow DIN of the first LED you can rewire to BIN (in the hope it isn't totally blown) but will have to send an initial extra 'dummy' LED'worth (24 bit) of data which BIN will 'eat' before passing on the rest of the packet.

author: bob21
author_rank: Regular Contributor
timestamp: May 13, 2020, 02:04:38 pm
content: Wow, thanks Ian. I have a much better idea of what I am doing now.I was about ready to hook up DIN and BIN together before I posted this, so I am pleased I didn't!The wire going from the MCU (an Arduino Uno R3) will have to be about 2 meters long, so I think it would be a wiser choice to use 2 x 220Rs.Do you think the 2M length between Arduino and start of strip being this long would justify the use of a level shifter? I am unsure if I should use one.I can throw a small board together for the BAT54S do you mean something like this (please excuse my awful diagram)Edit: I've edited the thread title to be more appropriate, as this is more of a best practice rather than resistance calc.

author: Ian.M
author_rank: Super Contributor
timestamp: May 13, 2020, 02:28:35 pm
content: Nope. The BAT54S is two diodes in series in a single package, with an extra lead brought out from the joint between them. Consult its datasheet for the pinout of the specific package you have bought. Wire it Anode to ground, Cathode to +5V and Common to DIN. That's one diode reverse biassed between Ground and DIN and the other also reverse biassed between DIN and +5V. You might as well tie BIN to ground on the same board.

author: bob21
author_rank: Regular Contributor
timestamp: May 13, 2020, 03:17:36 pm
content: Right got it. So looking at this:I would need to do this:Is this looking a bit better?

author: Ian.M
author_rank: Super Contributor
timestamp: May 13, 2020, 03:35:43 pm
content: Nope, not quite. Cathode (2) must go to V+ and Anode (1) to ground so both diodes in it are reverse biassed in normal operation. *IF* V+ was at the top and ground at the bottom your proposed board would be OK (apart from then tying BIN high), but of course its also got to match the strip pinout.

author: bob21
author_rank: Regular Contributor
timestamp: May 13, 2020, 04:34:10 pm
content: I must need more coffee. Thanks for persevering with meWhat do you mean by tie BIN high? Do you mean it should be on the other side of the diode? Would this be better:

author: Ian.M
author_rank: Super Contributor
timestamp: May 13, 2020, 07:10:15 pm
content: That looks fine. My comment about BIN was about what would happen if you swapped red and black in your previous version.N.B. Tying BIN of the first LED low makes sense as that would hold the bit receiving state machine in reset, butthat's not in the datasheet, so make that connection easy to change in case the few topics I checked for that connection got it wrong.

author: bob21
author_rank: Regular Contributor
timestamp: May 13, 2020, 07:32:11 pm
content: Great, thank you. The BAT54S should get here over the next couple of days, post permitting. I'll let you know how I get on

author: bob21
author_rank: Regular Contributor
timestamp: May 22, 2020, 09:22:16 am
content: Well, I have made some progress.. kind of. I have the LEDs up and running using 2M of wire and the 220Rs. BIN was connected to ground and I can control the LEDs just fine.. no pull up was neededYay.But: I have had to leave out the Schottky for now... my soldering skills have failed me. I didn't expect them to be so small! I've gone through 3 of them and I just engulf them in solder, or create adjacent blobs of solder on the matrix boardI am still interested in using diodes to protect the DIN wire, could you suggest some singular  diodes that I can lay across the connections on the matrix board?If I had something that was this form factor:It might be a bit more doable for me.

author: Ian.M
author_rank: Super Contributor
timestamp: May 22, 2020, 09:51:38 am
content: 2x any thru-hole small signal Schottky diode will do - I generally use the 200mA 30VBAT43. You don't want 1A or higher rated diodes as the leads are too thick for convenient soldering direct to the pads on the LED strip.

author: bob21
author_rank: Regular Contributor
timestamp: May 22, 2020, 04:55:19 pm
content: Perfect, thanksthat's exactly what I'm after.I noticed whilst testing today that I have experienced some intermittent flickering I think it's related to the 2 x 220Rs, because I removed one, and the issue went away (so far).Do you think it's ok to use one? What are the reasons for using ~440R-470R?

author: Ian.M
author_rank: Super Contributor
timestamp: May 23, 2020, 12:39:02 am
content: I've explained above that as the strip's total LED current varies, if its at the end of a significant cable length, the voltage level of Ground and Vcc at the LED strip can bounce around a lot relative to the same rails at the MCU end. The MCU end voltage levels are carried by the data wire (as its logic '1' and '0' levels) to the LED strip where they then transiently fall outside the supply rails due to the rails bouncing around, resulting in the ESD diodes conducting.The input ESD protection diodes of the various types of Neopixel aren't particularly robust, therefore a series resistor is required to limit the peak current. The Adafruit notes on the series resistor say "300 to 500 Ohm", with 470R being the suggested value. Its not an exact engineering calculation but Adafruit have obviously determined that a resistor in the range stated reduces peak ESD diode current sufficiently that they don't have an excessive number of warranty returns or a poor reputation for reliability. If you've added external Schottky clamping diodes you can use lower series resistor values as the external diodes divert current from the internal ones.There is also some argument that transmission line effects may be coming into play, with most multi-wire cables that are likely to be used for Neopixel interconnects having an effective characteristic impedance as a transmission line of the order of 100 ohms, and the Neopixel Din pin effectively 'looking' like an open circuit, so transiently doubling the amplitude of any transition due to the reflection at the 'open' end. However a matched termination would be a potential divider between Vcc and ground at the strip, presenting a Thevenin equivalent resistance equal to the cable's characteristic impedance, or if DC termination isn't required, AC termination with a series RC combo (probably 120R, 100pF) between Din and ground, would be suggested to suppress the edge spikes. Such termination wouldn't help with transient ESD diode currents due to ground and Vcc bounce. However Adafruit haven't made any matched termination recommendations, so transmission line effects can't be a major consideration.N.B. if only a single resistor is used it should be at the Neopixel input end of the cable, as the cable after the resistor is more sensitive to noise pickup. This may be the cause of your flickering issues.

author: bob21
author_rank: Regular Contributor
timestamp: May 23, 2020, 09:37:20 am
content: Hi Ian,I re-added the 220R at the start of the cable length and the problem persisted, which got me to recheck everything else. It looks like the issue was with the ground connection.. one of them didn't look as shiny as it could have done (MCU end of LED cable), so I have touched up with flux and the problem has disappearedThanks again for taking the time to go through things with me, and for taking the time to write up all you have. It's been very helpful and informativeI now don't feel totally at a loss with these strips, and have a much better idea of what I need to do.I think this can be marked as solved now. Thank you very much for all your help

author: bob21
author_rank: Regular Contributor
timestamp: May 29, 2020, 11:23:06 am
content: @Ian.M just to let you know that the BAT43s arrived this morning and I had no problems adding them and everything is working really well!I know this isn't a 'proper' diagram [and my scale sucks] but I draw things like this so I don't forget. There's more than enough room to put the 2 Schottky's before the first LED on a 60/m strip. Hopefully it will help someone else