Forum Rule: Always post complete source code & details to reproduce any issue!
Newbie findings re:WS281X signal quality(wire length, resistors, and grounds. Oh my!)
Having gone down so very many rabbit holes over the course of my project, I thought I would throw my findings on the heap of "Stuff to try" for those having trouble, especially since my findings vary from Paul's suggestions in a few areas. This information probably wont be helpful with people who have short power and data cabling and low teensy/strip counts. It should be fairly helpful, however, for n00bs like me attempting complex setups.
Disclaimer: I am a self-taught n00b and am still very much in the learning stage. Paul et al: please chime in if I'm making a terrible rookie mistake or otherwise spouting misinformation w/ any of this advice!
1. Supplying power when multiple power supplies and teensies are involved:
- Paul states that "It's best to power the 74HCT245 chip from the same 5V power supply used for the LED strips" here, but I have found that this is only true if:
- you have 1 psu per teensy/strip combination
- you are not powering the teensy via usb
- If you have PSU/teensy asymmetry (e.g. PSU A powers strips 1-5 on first teensy, PSU B power strips 6-8 on first teensy and 1-3 on second teensy, etc), I found that powering the teensy AND the 74HCT245 off of VUSB cleared up a number of grounding-related headaches. This setup also works well for the smaller and symmetrical setups, so I see no downside
Update: it turns out that the real reason that this was working better for me is that the external power supplies are all set to 5.3V. Over the 15 feet from my Teensys to the farthest strip, the data voltage doesn't drop much, but the strip voltage certainly does! By powering the 74HCT245 separately off of VUSB, I'd inadvertently gotten a better match of VDD and power at the strip. More added farther down (see "VDD vs VIN" heading)[/edit]
- As stated on the main OctoWS2811 documentation: "The LED power and Teensy 3.0 must have their grounds connected together."
- connecting DOUT back to GND (advice that I found somewhere on the interwebs, though I can't seem to track down where) created a number of problems for me:
- ground loops
- glitching and/or death of the last LED in a strip
As I said, I dont know where I got the advice to do this, but there are references to doing this elsewhere on the forums. the point is: dont! At best, it does nothing, and in the worst case, you'll have an LED to replace!
2. cleaning up the signal (esp. with long data lines)
- 74HCT245 or similar is only needed if your data lines are long. Here's a screen cap of the data from the middle of a strip - note the voltage. Always a nice 5V! This relates to the "reshaping" that's done by the WS2812b module
so long as your timing is right @ the first LED and your strips get enough power, then you're OK to go for the rest of the strip.
- the "reshaping" is both good and bad. The WS2812b appears to handle timing for downstream modules, so the longer the strip, the more critical it is that the timing of the first LED be spot-on. On the other hand, no matter what I fed the first LED (3.3v, 5v, any resistor value), the waveform for downstream modules always looked like the above image, with the signal matching the Vcc of the module at that position in the string. After testing a variety of configurations at the DIN for the first LED as well as at the 82nd (middle) LED, I couldn't even tell the captured bmp files of the mid-strip tests apart!
- resistors The precise value matters. just throwing on whichever value you have in excess is not the way to go! I had a ton of 200 ohm resistors and they fell in the 47-220 ohm recommended range - assuming that 200 ohm was better than none at all, it put them on there... much later I sorted out that this was the cause of a great deal of glitching and what appeared to be timing issues. Turns out that for 18ft of CAT6, anything over 150 ohm caused the low->high transitions to register late.
Here are some examples of signal quality of ONE connected strip after 18ft of CAT6 w/ various resistor values:
- no resistor (just 18ft of CAT6). Note: despite the overshoot, this actually works perfectly for one strip (I'll get to where this ~fails~ in just a bit)
- 47 ohm
- 68 ohm
- 100 ohm
Sadly, I forgot to snag a capture of what this looked like w/ a 200 ohm resistor, but you can see how the leading edge of the square wave is just barely starting to round off w/ the 100 ohm resistors. At 200 ohm, it was drastically rounded off, kind of like this but a bit worse:
From the above caps, one might conclude that 68 ohm looks like the way to go. Minimal overshoot, and bang-on timing, but there's a slight change in the lineup once you're driving multiple strips. I'm not sure if this is caused by cross-talk or some other factor, but as you drive more strips, the lower resistor values are impacted by the number of strips driven, while higher values are not.
With no resistors, here's the signal quality at 1 strip driven vs 4 strips driven:
1 strip vs 4 strips w/ 47 ohm
(sorry I didn't to a better job contrasting these.. it should illustrate that there was a lot more variance w/ 4 connected than 1 w/ lower resistor values)
1 strip vs 4 strips w/ 100 ohm
VDD vs VIN voltage is VERY important (added 01/01/2014)
In some situations, you'll find that power voltage and data voltage differ more than they should (such as cases where longer cable lengths are involved, you'll see much more voltage drop for power [higher current] vs data). The spec sheets dont appear to reflect the actual behavior of the LEDs:
- It's better for VIN to be a bit lower than to be higher (this is seen in action by how many people are able to skip the 74HCT245 completely and run at 3.3v data). Specs indicate that VIN should be VDD +/i- 0.5V, but I have found that it's closer to VDD +0.25/-1.25V (e.g. if the strip is powered at 4.5V, data still works just fine @ ~3.3V).
- A wide range of VIN:VDD will work, but VDD*0.9 seems to be the most tolerant of input noise. If VIN is >= to VDD then any ringing or similar noise in the signal can cause the occasional 0 bit to show up as a 1
- the voltage at the strip is LESS IMPORTANT than the voltage difference between DIN and the strip power. For example, at my furthest strips where conductor gauge and load really become a big issue, voltage drops to 4.6V under full load but is 5.2V-5.3V otherwise. I found that if I lowered the Vcc of the 74HCT245 to 4.6V, I eliminated flickering in those strips. I can get flicker-free operation from long strips even at 4.0 volts with data at 3.9V.
- you can potentially alter the voltage of each 74HCT245 individually, though I've found that 4.6V VIN works well enough for entire range of 4.4V-5.3V volts that I see @ the VDD of my strips
3. other random musings of a n00b
Do not exceed 5.5V for strip power or data! I experimented w/ this and found that voltage as high as 5.7V will work initially, but the first LED in the strip will eventually fail w/o warning. I ran a 10-hour "burn-in" test at 5.5v without incident and settled on 5.3V to leave headroom and to keep minimum voltage above 4.5V.
Get a scope! I still dont even know how to operate the damn thing, but I feel that it has eliminated a tremendous amount of guesswork. Rigol scopes can be purchased directly from them or from amazon resellers w/ Prime shipping. I got (or rather my wife got me) the DS1102E for $390 shipped. Yes, that's a lot of money for a casual electronics hobbiest, but find somewhere else to skimp! getting such a capable scope for under $400 (or even under $800) would have been unheard of just a few years ago.
Dont be afraid to revisit things you think you've already tested! A number of times, I isolate one variable and work toward an answer. A few changes down the road, you may have inadvertently changed the criteria for a question you thought you'd already answered, or exposed a different symptom of a preexisting problem.
Anyway - I hope someone finds some useful information in there
Last edited by tetsuo; 01-03-2014 at 09:56 PM.
Reason: correction based on Paul's comments, fixed typos, etc
Wow, awesome writeup Ryan. I've added a link to this thread from the OctoWS2811 page.
Where is the text that says to connect DOUT of the last LED to ground? That doesn't sound right at all.
Well, you've got me scratching my head regarding running the end of the data line back to ground. It's in my notes and I'm sure I got it from pjrc (either the forums or the library doc), but I can't find that explicit instruction at the moment. You CAN find reference to it in some posts though:
"I didn't need to put the end of the data line to ground"
"I've: connected the end 5V/GND back to the power supply, connected the end of the data line to GND, and put a 100ohm resister in series with the data line."
And I think once I had this in my head, I started misinterpreting advice like what you gave here:
where you state "Every group of 3 needs a ground wire connected to the Teensy". Now, of course, I realize that you just mean to tie the GND from the strip back to the GND of the teensy.
I will revise my post to state that "you may have read that you should connect the DOUT of the last LED in a strip back to GND of the teensy. Don't!" as I clearly didn't get that direction from the main documentation.
Last edited by tetsuo; 12-13-2013 at 11:37 PM.
Reason: Added more examples of posters referencing DOUT to GND
@tetsuo, I have been working with these switches for quite some time now but since I never had to use them for excessive switching or high power applications, I didn’t bother with all the specs of limitations of this IC. However, if I do need to use these ICs excessively from now on, I’ll definitely take up this thread for a reference. You’ve made it really nice and easy read and with categorical descriptions and graphs, it’s great.
electronic assembly services
Last edited by pilav; 07-25-2014 at 06:48 PM.