20140208

Driving WS2812/NeoPixels RGB LEDS over CAT5 Ethernet Cable

I was recently working on a project using Adafruit NeoPixels (WS2812) RGB LED strips where a single controller was supposed to drive five strings of 30 pixels that were physically located several feet apart. I knew right away that there was going to be a couple of problems trying to drive the strings over more than 20 feet of cable. First off there is the voltage drop issue - these strings can draw several amps, and could easily drop around 1 volt or more, depending on the cabling and connectors. The other issue is the integrity of the data signal being sent to the string. The pixels are very timing sensitive, and noise or ringing caused by a long wire run could easily introduce errors, or even result in a completely non-functioning string. This last issue was made even worse by my choice of controller, the Teensy 3.0 which is a 3.3V part, while the pixels require a 5V input. (By the way, the Teensy 3.0/3.1 + the OctoWS2811 library is an awesome choice for driving dozen to hundreds of RGB pixels!)

While it seems that many people have successfully driven NeoPixel/WS2812 strings directly from the Teensy using a small resister to reduce ringing, I was pretty sure that wouldn't work over any appreciable distance. It also appears that the newer WS2812B pixels won't work at all with just a 3.3V signal. It didn't take me too long to come up with the solution for the data issue - RS-422/485 drivers and receivers! Since the pixel data is really just serial data, I figured using RS-485 balanced transmission lines to send the data would work perfectly. The data signal is well within the bandwidth these chips are capable of, and as a bonus, the SN75174 Quad Differential Line Driver IC inputs will easily accept the 3.3V outputs from the controller! On the receiving end, I went with SN75176 Differential Bus Transciever chips because I had several of those on hand in my parts bin. I just needed the receiver part of the chip, and it was quite easy to disable the transmitter portion.

Next up was the power-drop issue. Right about the same time I was dealing with this I discovered these LM2596 DC-DC Buck Converters on Amazon - they were perfect! Their low cost, small size, high efficiency and wide input voltage range made them a snap to integrate into my project. (Just make sure you check/adjust the output voltage on these before you use them!). Now I could feed 12V into my long cables feeding the remote strings, and use these power supplies on the receiving side to drop it down to the needed 5V. Since I was only driving about 30 pixels on each line, the 3A output was more than enough to drive each string.

With all the pieces in place, it was time to test out my ideas. First, I wanted to test out driving the data signal using the differential converts, so I wired up a transmitter and receiver on each end of 100 feet of CAT5 cable, connected up my controller to the transmitter and 5 meters (150 pixels) on the receiving end. For now, I just connected up a beefy 5V/10A power supply at the receiving end to power the string. After connecting everything up, it worked like a charm! Every pixel was responding as though it was sitting right next to the controller.

Next up, I cut the string up into 5 lengths of 30 pixels each, and wired them up as shown below, using the differential transmitters/receivers and the DC/DC converters (again making sure they were adjusted to provide 5V output!), powering everything with a large 12V power supply. Everything worked as expected, the pixels were changing colors as commanded, with no color shift or dimming caused by voltage drops.

Notice that I am calling out the color codes for the CAT5 wiring - it is important that at least the data wires are on twisted pair of conductors (blue/blue-white in this case). I also like to have the power wires paired as well, with all the +V connections on the solid wires and the -V connections on the white-striped wires, which helps with noise immunity on the power lines. In my project, I used 4 position connectors and just tied all the +V wires together on one terminal and all the -V wires on another (with the data on the remaining two terminals). Using all the extra wires in the cable for power helps reduce the resistance, and thus the power drop on the cables.

In the end, my project worked well, with the strips connected via 15 - 25 foot lengths of CAT5 cable all connecting back to my central controller. If you have a project where you need to have several remote RGB pixel strips all controlled from a single controller, hopefully by using this approach you can make your pixels work just like they were connected directly to the controller. As usual, your feedback is always appreciated, and if you have any questions please feel free to leave a comment.

UPDATE: I've just added a new post that goes into more detail about using the SN75176A chip in this design, for those of you who have asked about variations of the above circuit.

66 comments:

Unknown said...

Clever approach. I like it.

I have always wanted to connect a long row of 100 LED strings (12 - 15 LEDs a piece) spaced 3" apart and control them from a PC to make a pattern. The idea is to make them look like icycles, hanging from the gutter on my roof for Christmas.

The problem is that it would be pretty expensive and the power would be big. Your ideas is to control each LED with a separate CAT5 (I think). My idea is to make them serial and provide power to each LED string.

Any ideas?

teknynja said...

An interesting dilemma – I'm assuming the PC will be located some distance away from the strings, so using the RS-485/422 idea makes sense between the PC and the strings. Power might be more of an issue, as the DC/DC converters I mention in the article aren't big enough to drive more than 30-40 pixels at a time. You could do something similar to what I have done above, powering 2-3 strings of 12-15 pixels off a single converter, thus using 2-3 converters for the entire project. The DC/DC converters I mention are physically very small (and very inexpensive), so that is probably a viable solution. You could easily stuff a few of the converters along with a receiver circuit inside a small project box mounted behind the gutter. Otherwise, you could put a 5 volt, >7 amp power supply near the strings, and then simply run the power wires from each string back to the power supply (that would require running AC up to the strings though).

The data would also be a bit tricky, as you probably don't want to run a separate data line for each string from the PC to each string (that would take 12-16 wires, and 6-8 receivers). You mention the strings would be only about 3 inches apart, so I suspect that you could “daisy-chain” the strings, by running a wire from the data output at the bottom end of each string up the back of the strip (to keep it hidden) and then feed that to the next string in the chain. Running the data lines using just a couple of feet of wire between strings should work fine, although you might need to put a small resistor inline with the data at the receiving end of each chained string to help control ringing, but that way you would only need a single RS-485/422 receiver connected to the input of the first string.

All this should be easy enough to test “on-the-bench”, so you can work out the best approach for your project. Hopefully you find these ideas helpful in bringing your icicles to life!

WIGIV said...

Thank you for this writeup! I am working with artists to implement WS2812's in various interactive projects, and have endured a constant struggle with power and data over long lines.

Many installations require the controls cabinets to be 20 or more feet away from the LED strips, and I think your approach will help immensely.

One difference is that we'll be using LM317 linear regulators instead of the units you mentioned, due to the number required, and the cost.

Will be modifying an existing (problematic) system next week to test.

teknynja said...

@WIGIV - I too was originally thinking about using linear regulators (LM7805) for this project, but with the superior performance and low price ($3), for me the DC/DC converters were the way-to-go.

Even when driving just a few pixels, you have to be careful about power dissipation and the voltage differential with the linear regulators.

The DC/DC converters are so efficient that you don't have to worry about using heatsinks, even when driving them from as much as 24V and pulling 2 amps from them! It also means since less energy is being converted to heat, your main power supply can be smaller and cheaper.

Since they are so small, I actually ended up just soldering leads onto the converters and mounting them directly onto the circuit boards with the receiver circuit.

I am glad to hear my little hack is helping you out. Thanks for taking the time to let me know about your work!

Reverend Dave said...

If you use RJ-45 connectors (more to the point, sockets) for connections, you may want to put +power on one solid/stripe pair, and -power (ground) on a different solid/stripe pair.
Ethernet magnetics are little signal transformers, with each solid/stripe pair going to one winding.
If someone decides to plug their laptop in via ethernet cable, having a power supply with a non-trivial voltage difference across a signal winding will probably fry the laptop's ethernet magnetics. (This is a Known Issue(tm) with equipment that uses passive power-over-ethernet.)

teknynja said...

Reverend Dave makes a good point - if you are planning on using RJ-45 connectors, consider yourselves warned!

I actually connected mine using four position terminal blocks so no worries about accidentally plugging anything into network ports, but I can see the temptation to use network connectors with network cables!

Anonymous said...

I wanted to thank you for sharing your approach to controlling a LED strip over a distance. I want to control two strips of 4 meter at a distance of about 6 meter and was struggling with the power and the data signal. I tried your solution and it worked! You saved me allot of time :)
I power each meter with a separate DC/DC converter, and I see no dimmed LED's at the end.
The only thing I did different was that I used the SN75176 for both the transmitting and receiving of the data signal.

chad said...

Do you think this system could be modified to control 7 sets of 8 pixels 20ft apart? The big problem is that I need to daisy chain the wiring as the conduit isnt large enough to fit all the cables in.

teknynja said...

I haven't tested a daisy-chained configuration, but it seems like it should work just fine. You would simply "bus" the 12 volt power to all of the strip's voltage regulators, and then use the data output from each strip to drive a RS-485 driver feeding the next strip's receiver. Since you are only using a single data line to drive all the segments, you could also use just a single SN75176 at the controller end instead of the quad SN75174.

If you do build this, be sure to post back to let us know how things worked out!

Unknown said...

I will do that.. I plan to order some of the SN75176 chips this week

Unknown said...

I was able to make this work over lengths of 4wire RGB cable no less. I posted a link in your thread on the AdaFruit Forums.

http://forums.adafruit.com/viewtopic.php?f=47&t=49543&p=326405#p326405

teknynja said...

Very cool! I think you have open the door to many new applications with your twist on this idea. Thanks!

Unknown said...

Thanks. Another twist I tried out which was kinda neat was to connect them in a bus setup. Basically all the strips did the same thing at the same time. I could see lot's of uses for a setup like that. Next step is to see how many of these I can chain together.

Unknown said...

I'm working on lighting for an interactive art project, and this is perfect for the way we're going to need to distribute small clusters of 2812s around the space. We were thinking along the same lines (serial + power over CAT5), so it's good to see someone else's implementation. Thank you!

Greg Woods said...

Thanks for sharing this. I've already ordered the parts for my NeoPixel setup, and due to the position of my 2x 4m strips, I have no data cable over 1.5m using a star topology.
I had to go with 8AWG cable and a 30A PSU though, so the buck convertor idea is great. I may consider this and/or the cat5+RS485 solution if I ever do another project.

john said...

How would I hook up the 75176 on the controller end

teknynja said...

The 75176 is actually a transceiver device, so you can also use it to drive a single RS485 channel by tying the DE & ~RE signals high (either directly to VCC or through a pull-up) and then applying the controller data to the D input. This will then give you a RS485 output on the A & B pins that you can use to drive another 75176 (configured as a receiver as shown) on the remote receiver end.

Unknown said...

Hello,

Following our emails coming back to you through your blog.

I made the schematic ( http://img4.hostingpics.net/pics/967756MainboardEmmitReceiv.jpg ) for the transmission part and the reception part. Based on the SN75176 (the one used in your schematic. It better and more features than the MAX485). I just have some doubt about the connections with D/DE and R/RE.
I added a resistor (R3) and a pullup resistor (R2) Pulldown is this good?

Thank you for you precious help

teknynja said...

Vadim -

Referring to your diagram, you are close, but for the emitter/transmitter circuit you would tie DE & /RE high (VCC) to configure the IC as a transmitter, and leave R (pin 1) disconnected, since it is an output, you do not want to connect it to power or ground.

Also, since the length of the transmission line is only a few meters, you can skip one or both of the termination resistors (R1). R2 & R3 are typically only used if you expect the bus will be disconnected during normal operation, in which case they pull the inputs into a known state. If the wires will be normally be connected all the time, you can eliminate those as well. Basically, for the purposes of driving WS2812 style LEDs for less than 10 meters you eliminate all but the one termination resistor at the receiving side, as shown on my schematic above.

Let us know how your project turns out, it sounds like it could be quite interesting!

Unknown said...

Thank you for your help Teknynja,
So I changed my schematic for DE & / RE as well as A. I have a small question. Why D is connected to GND in Receiver mode? I guess you can also leave D disconnected Receiver mode? ( http://img4.hostingpics.net/pics/897867MainboardEmmitReceivEdit.jpg )

I preferred them in case I want to use these modules in other projects (with longer cables). So I can leave R2 & R3 without problem and leave R1 on Receiver side?
Last question which will be appearing stupid. One line A B for DI and one line for DO? Basically it is a new line between two modules.

And it is with pleasure that I would give news of my project, schematic and photos ^^
It's really kind to take time to answer me, thank you again!

teknynja said...

It is usually a good idea to force unused inputs (such as the D input) to a known state even if they aren't being used. This is because if you leave an input floating, the input voltage may switch between states, causing unpredictable behavior or glitches.

As for the A & B signals, they are "differential" signals, meaning when one goes high the other goes low. This is the reason the signal can be driven much further, as instead of having to compare a single signal line to a fixed threshold voltage, you compare one signal line to the other. If A is more positive than B you treat it as a "one", and if B is more positive than A you treat it as a "zero". See this Wikipedia article for a more detailed explanation of differential signals.

Unknown said...

Thank you for your explanations about the pin D.

I understood functioning of A and B, but what I mean is that I have to use the same line A B sends data to the line A B that returns DOUT.
Basically sent and received on a single wire pair? Is is fast enough for the round trip latency-free? Because it takes that sent finishes for the return. I would have more tended to think that using a pair (blue and blue / white) for sending and another pair (orange and orange / white) for return.
( Here is a small drawing ( http://img15.hostingpics.net/pics/173808Explain.jpg )

Sorry if I have difficulty to understand: /

Thank you Teknynja

teknynja said...

The only way you could share the A/B pair would be to control the DE pins to enable only one transmitter at a time - without controlling the DE pin the transmitter is always driving A and B and having another transmitter on the same pair will cause a conflict. It is much simpler to just use 2 pairs (in the same CAT5 cable) as you have shown in schematic #2.

The RS-485 specification does allow for multiple transmitters in a bus configuration, but it requires some kind of control scheme to ensure that only one transmitter is enabled at a time. The WS2811 don't provide any way to control the transmit enable.

Oliver said...

Hey Teknynja!
Thanks for this awesome tutorial! Its been a great help wrapping my head around this whole LED/distance problem. I am planning on building a modular LED tube setup (10x 1m WS2812b). I want to use the SN75176 as drivers and receivers.

In your second picture where you show the wiring you put a 4.7K resistor between 5V and (I believe) pin 4 of the quad driver (SN75174). Is this also recommended when using the SN57176 as a driver? What kind of resistor would I need, what pin would I need to connect it to and why is this even necessary?
Also in the Adafruit NeoPixel Überguid they are recommending putting a 1000uF capacitor between 5V and ground of the power supply to prevent power spikes. They also suggest using a 470ohm resistor between the signal line of the Arduino and the LED strip. Do you also recommend this in your setup? If so where would they go? On every „receiver module“? Is this dependent on the board you are using (Arduino/ Teensy)?

Lots of questions. Hope they arent to much. I am trying to plan ahead the best I can before putting in this big order.
Have a nice day!

teknynja said...

Thank Oliver!

Let's take these questions one by one. Pins 4 and 12 on the SN75174 is the output enable pins, which when driven high allow the devices to drive the bus (CAT5 in this case). I am using the 4.7K resistors to pull them high thus constantly enabling the outputs. Using the resistor is not completely necessary and you could simply tie the enable inputs directly to the 5v line to save costs if desired. The resistor is there just to limit the amount of current flowing into the pin. Its value is not that important, and since there isn't much current flowing through it, a small 1/8 watt resistor is fine. You'll note that on the SN75176 side of the circuit I'm simply connecting the various enable pins to 5v or ground needed without using resistors. For this application it would be fine to skip the resistors and just connect the inputs to 5v or ground as needed.

As for the 1000uF capacitor, I chose not to use them since the power supply on the receiver is so close to the strips, there isn't a huge amount of voltage drop/inductance in the power wires (And also to save space, as I put the receivers in a very small enclosure). I am also relying on the DC/DC converter to have a built-in smoothing capacitor on its output. If you find that your pixels are exhibiting "flaky" behavior, then you may need to add this capacitor, but in this configuration it wasn't needed.

Finally, the 470Ω resistor between the receiver output and the strip input is there to match the impedance of the driver to the LED strip. If there is a bit of distance between the driver and the LED strip, this resistor would help prevent "ringing" in the signal which could distort the data signal. Again, since the wire between the receiver chip and the LED strip is so short, it is not really required.

In summary, the components you have inquired about make for a slightly more robust design at the expense of size and cost, and because the connection between the driver circuit and the LED strip is so short, their inclusion is not really needed.

Good luck with your design, and feel free to post a link to your project here so we can see the results!

Unknown said...

Hello Teknynja,

I order my pcbs at OSHPark few weeks ago, I would put some pictures when I have received and tested (hopefully everything works ^^)

Thanks ^^

Oliver said...

Thanks you for your fast and detailed replay. Im really looking forward in building this project. :)

Oliver said...

I stumbled upon another problem... what do you think, how much amp can a CAT6 cable handle? I am really worried about cable fire.
I want to drive 5x 2m LED strips about 10-15m away from a beefy 12v 40a power supply. Following your guide I figure this should be possible without worrying. I also wanted to be able to daisy chain them together (applying power every meter), but I am really worried that a CAT6 cable cant handle 30amp and eventually everything will go up in flames. Any ideas or suggestions?

teknynja said...

Based on a quick check of standard wire gauge for CAT5/6 and a chart on the web, solid core CAT5/6 cable can carry about 2A (less if it's stranded core wire). Even with paralleling the 3 "extra" pairs in the cable, you would only be able to push about 6A through it. Based on the tables I saw, you would need to use 10 gauge wire to carry 30A.

Keep in mind that the 12V current requirements of the DC/DC converters will be less (roughly half, depending on their efficiency) of the current draw of the 5V output, so you may need less power than you think.

You may also be able to get away with using non-CAT (without twisted pairs) for a 10-15 meter run, which means you could use a beefier 4 or more conductor cable between the transmitter and receiver. Twisted pair is always nicer, but at the low speed of the data signal you can probably do without them.

Finally, if all else fails you could run 2 cables (one for data, and a higher gauge pair for power), although that seems like the ugliest of the approaches.

If you could introduce power nearer to the receivers at multiple points, that could be your solution as well. You could still daisy-chain the data between each segment, but I would start a new power run at each segment (not connect the power between segments). That would let you distribute the load between different chunks of CAT5/6 to keep the current below the limit.

Hope this helps!

Oliver said...

Thanks for your input! I wasnt aware that the current is cut in half when voltage is doubled. Basic physics hello again! :D
By paralleling the extra pins you mean 2 pins for data signal, 3 pins for 12v and 3 pins for ground. Like I show in your diagram (thats what I was planing on doing) or am I mistaking?
I am now planing it like this: every CAT5/6 cable that comes out of my controller box (Teensy + 12V / 30A power supply) can power 2x 1m LED strip "out of the box". If I want to daisy chain them all together, I would either run cables from a free slots of the controller box (if there are any at the time) or I would apply power near the LED strips from a different source.
That should be save, should it not? That would mean every cable coming from the controller would need to carry 3A at 12V. Would that work if I run the cable lines like shown in your diagram? If it turns out that it can carry more than 3A an I could hook up another 1m strip, than yeah for me. :)

Have a nice day! And thanks again for taking the time, helping me!

teknynja said...

Yes you are correct when I referred to paralleling the extra pins (which distributes the current across the wires).

Your plan to have multiple short segments driven by several outputs of the Teensy and all powered by the same 12V/30A power supply should work fine - in fact that is exactly what I did on the project that inspired this post. I even used a Teensy controller!

Sounds like you are definitely on the right track!

Oliver said...

Hey teknynja, its Oliver, back from the workshop again. :) But I am having problems getting it running. I have tried to test it with the "BasicTest.ino" from the OctoWS2811 lib. I verified that my Teensy is working correctly with a Blink sketch.
Could you take a look at my wiering and tell me if I made an error there? -> http://i.imgur.com/XEPLN5h.png

teknynja said...

Oliver -

I'm not sure if it's just missing on your diagram, but you must connect pins 15 & 16 on the Teensy together in order for the OctoWS2811 library to work. (See the diagram under the "Hardware Requirements" section of the library's documentation at https://www.pjrc.com/teensy/td_libs_OctoWS2811.html). Other than that, it looks like things should be working based on your diagram.

Oliver said...

It works! :D But it wasnt the pins 15 & 16 (I had those connected) but it was the wrong wiring on the receiver. I mistakenly soldered the VCC (8) and R/DataOut (1) lines the wrong way to my PCB board. This also resulted in damaging the SN75176 driver on the receiver. So I soldered the lines together the right way and switched out the driver and voila it works!
Here is a picture of my test setup, maybe others con benefit from it: http://i.imgur.com/0JynUnM.jpg

Have a nice day!

teknynja said...

Due to several inquiries both in the comments and in emails, I have added a new post that goes into more detail on how the SN75176A is used in this design, and it should provide enough information for you to use the chip in other projects as well. Have fun, and thanks for all the great feedback!

allanGEE said...

RE: "After connecting everything up, it worked like a charm! Every pixel was responding as though it was sitting right next to the controller."

Did you test it without the driver/receiver setup? I'd be interested in how the results compare with each other.

teknynja said...

@allanGEE - Glad it worked for you. I did try driving the NeoPixels directly, but even playing with various termination resistors I wasn't able to get any kind of consistent behavior, the pixels seemed to only respond in random patterns. Some people in other forums claim to have been able to drive them over significant distances just using matching resistors, but it didn't work for me. I'm not sure if they tried running them at 100 feet like I did!

Unknown said...

Hello Everyone, sorry for the time to reply my result :/

Some pics of my project :
The first project is WS2811 with SN75176, one for emitter and one for receiver. 3 modules for driving 10W RGB Led based on PT4115

The other projet is also based on WS2811. One version with SN75176 and one without.

https://drive.google.com/open?id=0B2iTOfCf_w5HNFg5MEVWMWFJVGRGcmlyR3gxY056ZnlZZ2tV
https://drive.google.com/open?id=0B2iTOfCf_w5HMW9PVFQ5elBBY1BzRlJBLXdYdG45dU01QUZN
https://drive.google.com/open?id=0B2iTOfCf_w5HR1dDQV9qNktHQnRpaXJVdVN1dWl3VGt3TzlJ
https://drive.google.com/open?id=0B2iTOfCf_w5HNXVodUhzdEJxMHNzZTdNTXNFb2x5b0kyUjFN

So thank you Teknynja for help to understand the SN75176!

Bob said...

I'm wondering what are the drawbacks or problems with pushing all of this with a 5v power supply instead or the 12v? Forgive my noob-ness :)
I'm building a series of 1 meter strips that will be separated from the control board by up to 20 feet (wire-wise). Can I get away with 5v?

teknynja said...

@Bob Smith - You could drive remote receiver and strips directly with 5 volts, but the biggest problem you will be dealing with is voltage drop caused by the resistance in the wiring and the amount of current being drawn by the LED strip. In other words, the wire between the controller and the receiver/LED strips acts like a resistor and the longer the wire, the larger the resistance becomes. This causes the voltage at the far end to become lower, possibly too low for the receiver IC or the LEDs to function normally.

I would guess that even if you were only getting 4 volts on the far end, things would still work for the most part even though that is far below the specified voltages for the devices. Also note that the voltage would fluctuate as you turn the LEDs on and off – with all the LEDs off you would not be drawing much current and the voltage would not drop much at all, vs having all the LEDs on which would cause the maximum voltage drop. These voltage fluctuations could possibly cause erratic operation of the receiver and/or LEDs.

There are things you can do to help minimize the voltage drop on the cable, like using lower gauge (thicker) wires, using multiple pairs of wires (as I do even in the 12 volt diagram above), and keeping the number of total LEDs that are turned on at the same time to a minimum. You could also adjust the power supply a little bit above 5 volts (no more than about 5.25 volts so you don’t over-volt the local controller and transmitters).

Taking all the above into account, you can probably get away with using just 5 volts to drive 20-30 LEDs over 20 feet, but you will likely be pushing things a bit. I say it can’t hurt to try, but note that you may encounter inconsistent results between devices due to production variations in the various components (In other words, some parts may handle the voltage drop better than others, even if they are from the same manufacturer).

Hopefully this helps, and good luck with your project! Come back and share with us how things worked out for you when you are done.

Bob said...

Helps a TON, Thanks teknynja!

I planned on using your SN75174 concept for dealing with the control/data signal, so using the other 6 wires on the Cat5 is definitely going to be the path I take. Just trying to reduce number of components per unit, in using single voltage at the base station and drive that out to all the remote units. I'll let you all know how it goes.

Bob said...

Can you connect a single 75174 channel to multiple 75176's? As in having several 30 LED strips on a signal bus, so they all receive the differential signals from the same transmit side line? (have all of them doing the same thing, in essence. Or do you have to do 1 to 1 transmit to receive?

teknynja said...

@Bob Smith - Yes you can drive several receivers with the same transmitter. I believe you can connect up to 32 receivers, according to the specification. You'll want to make sure that only the last (farthest) receiver has the 120 ohm termination resistor across the differential inputs in that case though. If you only have one channel total in your project, you can even replace the quad 75174 transmitters with a single 75176 configured in transmit mode (see my post detailing the 75176).

Bob said...

Thanks!

4 separate channels, but 2 of them with have a pair of receivers rather than just one.
In the case where those doubled up nodes are equidistant? Just add 2 feet of cable to one and call it the most distant? :)

teknynja said...

Well really, these chips were intended to be used in a "bus" configuration where each device would tap off the two lines of the bus and the termination resistors would be at each end. In this case, since the wires are so short (and the signal speed isn't that high) it isn't that critical so you can probably get away with just picking one node or the other and putting the resistor on there, no need to adjust the length of the cables. Also note you shouldn't put a resistor on each branch, that would just put extra load on the transmitter signal.

The termination resistors act kind of like "shock absorbers" when the signal hits the end of the wires, keeping the signal from bouncing back and interfering with itself. They become more important for long runs and high speed, but it's always a good idea to include them.

Bob said...

AnoA few additional questions for you today. My build is going pretty well. Have 4 receiver boards put together, two to go and then the transmit board. My question is, do I need to put a resistor in front of the WS2028 strip, like I would for a single LED, to prevent melt down? The control voltage will be coming from the Arduino, and the power for the strip will be coming off of an ATX computer power supply. Control board and Arduino will be powered from this same supply, so there is a common ground for everything.

I've seen advice about placing a cap near the power connection to the LED strip, so I've got that in place on the board, just before JST connections to power and ground.

Is the resistor needed too?

In your diagram, what is the function of the 4.7 resistor in from of the enable pins for the SN75174?

And finally, you have D on the SN75176 connected to ground. I understand why DE and RE are to ground, but why D as well?

Thanks so much for all of your help. You'll have contributed to an awesome gaming experience that brings some money to Boston Children's Hospital.

-Bob

teknynja said...

@Bob Smith – Good to hear your project is moving ahead! As for your questions, let's dive right in.

Regarding the resistor inline with the WS2812 strip's data line, yes it is a good idea to include that, and I probably should have put that in my design too. It turns out some variations of the WS2812 chips are very delicate devices, and having that resistor there can limit the current flowing into the first chip's data line. It can help protect from not only having different power supplies in a project but also differences in voltage caused by voltage drop even when a single power supply is used. That being said, I have used WS2812 strips in plenty of projects without the inline resistor and not had any problems, so it’s not critical but is still worth putting in there in my opinion.

As for the capacitor across the power supply lines of the WS2812 chip, again that is another good idea that I should have probably included in my design as well! This capacitor should be a large value electrolytic capacitor (400uF or larger and at least 10v rating). It serves a couple of purposes when placed close to the LED strip on the power leads – first it helps smooth out and protect the strip from large voltage spikes when power is first applied, and second it helps keep the voltage stable when the current draw changes dramatically as a large number of LEDs on the strip are turned on or off. Once again I've used WS2812 strips in many applications without that capacitor, but all my recent designs tend to include one.

Finally, the 4.7K resistor is called a "pull-up" resistor and is used to set those enable input pins to the high state. The use of the resistor limits the current flowing into the input and isn’t strictly necessary (you could just tie the inputs straight to the +5V line) but it is usually good design practice not to tie digital inputs directly to the positive voltage supply. Along the same lines, the D input of the SN75176 should be driven either high or low (I chose to force it low by connecting it to the 0V/common). If a digital input pin on a device is left disconnected, the voltage can "float" between the low and high states, causing oscillations or other noise. Also in some devices, having an input voltage between the high and low states can cause excessive current to flow inside the chip causing other problems. So for most digital devices it's always a good idea to make sure that any unused inputs are connected to either a high or low level as appropriate, and the use of a resistor inline with forced inputs (especially for high levels) to limit the current flowing into that input is good practice as well.

I'm honored that my post has in a small way helped out a good cause, and thank you for taking this design and turning it into a worthwhile project. Keep up the good work!

Tom P said...

Hi,

This looks like exactly what I need, one question though. I was under the impression that the ground of the neopixels had to be connected to the ground of the controller, in your diagram that doesnt look like its the case? Can you clarify whats happening?

Thanks,

Tom

teknynja said...

Tom -

You're right, it's not clear from the schematic, but the -VIN and -VOUT pins on the DC/DC Converter are tied together, so there is a ground connection (which is required!) between the controller and the NeoPixels. So although it isn't directly shown, there is a ground connection running all the way from the transmitter on wires 1, 3, & 7 to the DC/DC Converter and ultimately to the NeoPixels themselves.

Sorry for the confusion and thanks for pointing it out!

Tom P said...

Ah ok. Thanks for the clarification! Looks like it's a 6 wire cable for my system then. One other question that's on my mind that you might be able to clear up. I'm using a lot of local psus for my system and running both power to each psu including earth (240v), the two channels needed for this solution and a ground return to the controller all through a 6 core 0.75mm (per core) cable. Would you think that's going to be ok? I know it's generally not recommended to run power and control cables next to each other in propper structured networks transmitting large amounts of data but as this is pretty basic stuff I hope its OK. Any thoughts?

teknynja said...

Tom P -

I strongly suggest not running AC power in the same cable as low voltage DC and signals. It is very easy for a large spike (even from a distant external source) to be coupled to the DC power or signal lines causing damage to the low voltage devices. Think of the cable as a long, unwound transformer and you get the idea. Even running two cables in parallel (one for the high voltage AC, one for the low voltage signals) can be problematic, but is still better than having those wires running together in the same jacket. One or two centimeters of spacing between the cables for the entire run should provide reasonable isolation, if you can arrange for that.

Tom P said...

Hmmm ok. To be clear no low voltage power is going to be sent up the cables. The PSUs are located at the leds. However the data lines will be running in parallel for the whole distance. I guess I'm going to need to switch to a shielded cat 5 or similar and a power line bundled together with zip ties or similar as I cant really get sufficient space in my structure to acommodate 2cm of gap. more bloody complexity! Thanks for the info.

Tom P said...

Though thinking about it I may be able to isolate the data line and the power line for the majority of the run and have them recombined at the connector to the units though surely this is going to result in the same risk at each connector? :/

Bob said...

On the project I've discussed above, I've made some layout changes on the PCB and am finding myself a little short on components. Definitely not skilled enough in EE to know the answers to these questions, so I was wondering if you could help out?
For the two resistors, is the specific value important? I ran out of 120s for the data in, and am out of, as well as the 4.7's could I get away with using values that are close? like 100ohm for the data in, and 4 or so for the data out?

teknynja said...

Neither of those component values are too critical, but for the 120Ω resistor you'll want to stay fairly close to that value as it will affect the distance you can run the signal. The 4.7KΩ resistors can really be anything from 1KΩ to 10kΩ, the tradeoff being using more current with lower values and less noise tolerance with higher values. Hope this helps!

Bob said...

would 100ohm drop the distance much? I think my longest cable is 15', so not too bad.

teknynja said...

You shouldn't have any problems with that short of a distance.

Bob said...

As always, you're so incredibly helpful, thanks!
On the capacitor side of things, the size of ~400uF capacitors that I've found generally seems to be much larger than I would like to have form factor wise. Strictly speaking, the cap isn't required - is it a waste or a safety issue to use a much smaller capacitor?

teknynja said...

Those large capacitors are there to help smooth out the voltage when you go from all LEDs off to all LEDs on full brightness - the jump can cause a momentary drop in voltage and the capacitor helps to provide a local source of energy. That being said, if you aren't driving a lot of LEDs or your patterns don't involve a lot of big changes in energy requirements, you can get away with smaller capacitors (or none at all). You'll probably be fine with a smaller value, say around 33uF. Just make sure the voltage rating of whatever capacitor you use is about double the nominal voltage of your circuit (10v or greater for 5v power, 25v or greater for 12v, etc).

Anonymous said...

So lets say I've got a strip that abruptly comes on all 60 LEDs max red - If the other strips are all driven from the same power supply, could this sudden rush cause a voltage drop for them? Reason I ask is I think this is what's happening. I get the system running ok, lets say 4 out of 6 effects are running, either an animation, or some form of moderate brightness, then strip 5 pops on, and the animation on strip 2 or 1 locks up, and I get some flicker - the flicker seems like what I'll get if I'm pulling too many LEDs on sole power from the Arduino solely on USB power and drawing the LED power direct from the Arduino. (I came across that in small scale testing. Note that I don't use Arduino power at all for the LEDs now. )

Some thoughts I have - am I thinking in the right direction here?
1 - the sudden rush is draining the system too quickly, and the caps on the other receivers are not big enough to survive the temporary loss.?

Here's a picture - some background - there are actually 6 of these not 2, but you should be able to get the picture. t

https://imgur.com/a/CTfYBHv

data source is an Arduino.
TX is SN75174
RX is SN75176
LED is a 60 LED strip of WS2812B

All of these are powered from the same power supply, an old ATX power supply, 5v line

teknynja said...

@Unknown - Sorry about the late response, for some reason I didn't get a notification for your comment! Anyways, it is possible that a power dropout or sag is causing your erratic behavior, but it could also be a grounding issue. You'll want to make sure that grounds for each receiver and the strip they drive are connected together at the same point on the ground "bus" and that the length of the runs between the receiver/strip and the ground bus connection are as short as possible. Look up "star grounding" for some background on how your power supply wiring can be an issue.

ElectroBugger said...

Hi I found this post very interesting. Based on this approach, is it possible to create beautiful pattern/effects in a pixel led matrix?
I have been looking for a way to create DIY pixel control which I can use to do large building decorations.
eg: https://i.ytimg.com/vi/P4EQWO33LNs/maxresdefault.jpg
Could you share your views on this?
I am pretty new to the electronics stuff

teknynja said...

@ElectroBugger - This could certainly be part of the solution for creating a large-scale installations like you describe... The bigger challenges will be power distribution (to avoid voltage drop) and the physical design (all those pixels/wiring are going to get heavy).

As to the electronics side, you likely won't be able to push enough power through the CAT5 cable for that many pixels, so you could use the RS485 part of my solution to get the data to the pixels but you'll have to come up with some way to get a lot of power distributed not only to the ends of the strings of lights, but probably also need to inject power along the runs as well... This becomes problematic as you will have to pay close attention to grounding issues and differences between power supply voltages - not for the faint-of-heart!

I would definitely do some research into how other people are dealing with powering large-scale NeoPixel displays to get an idea of what's involved.

Anonymous said...

Thanks a lot

Bob said...

More questions from the meganoob :)
I'm trying to run this thing off of an ATX motherboard's power supply, or if another device like a wall wart could cover the amperage. So I need to decide how to do it.
The overall effect I'm going for will require 60 WS2812's per strip. If I understand it correctly, at full color/brightness this will work out to be approximately 3.6 AMPs getting pulled for each one.
My idiot understanding is that parallel current is additive, so running each of these off the supply, in parallel would be a total of 21.6 amps needing to be supplied from the power supply, so it and the traces need to be able to support 21.6 Amps?
Plus whatever is needed for the transceiver chips, and Arduino, right?
If I'm only using 5v for these, then a 300w power supply should be able to give me 60 amps, right? and that should be sufficient?
With all of this said, that supply should be able to handle it, correct?
If this is correct, then I'm wondering how thick the traces should be on the board from the supply to the power/ground lines of the RJ-45's I am using to send data/power/ground out to the light strips?

I had been doing this using spark fun's ATX breakout board, going from there to the Arduino, the RJ45's, and the mini board with the transceivers on it that I made. Seemed to be good, but I think one of the wires from the breakout board to the rj 45's may have been getting too hot, hence wondering about the traces, and I want to do all of this on a single board, rather than a Frankenstein of components inside a mini ATX case.

Or is all of this just a heinous idea?

My general design requirements are, in order of importance:
1. SAFETY
2. Get power to 6 strips over rj-45
3. Run it from a single board with an Arduino mega attached like a mezzanine card (I don't want to deal with building a mega into the board itself.
4. Simplify power source if possible. (Use ATX as default, but if a wall wart or straight in C13 would do, thats even better.

Any guidance at all is hugely appreciated. If its too big an ask, that's OK. Seems like a lot.

teknynja said...

Hi again @Bob! I see you’re finding out that powering a lot of NeoPixels can be a challenge.

First up regarding ATX power supplies, the rated wattage is distributed across all the voltages it supplies (not just the 5 volts), so a 300 watt supply will likely not give you the full 300W / 60A on the 5 volt outputs. You can check the specs on the supply you will be using; usually you’ll find them printed right on the power supply with max current ratings for each of the different output voltages. Also, your math is correct, a NeoPixel with all three LEDs turned on at 100% draws 60mA, so a string of 60 NeoPixels will require a maximum of 3.6A; and 6 strings of 60 NeoPixels will require 21.6A.

How you wire the power for these strips makes a big difference; if you run the power for each strip on a separate cable directly to the power supply (in a “spoke & hub” configuration with the power supply as the hub), then each cable will only need to carry a reasonable 3.6A. You will probably find that there are enough individual +5V and ground wires coming out of the power supply that you can use a separate pair for each strip and not have to worry about any single wire carrying too much current.

If you are planning to run a single power cable as a “bus” with each strip connected along the way, things will get more complicated. The wiring between the power supply and the first NeoPixel strip will carry the full 21.6A, with each segment between strips after that carrying 3.6A less. The voltage drop caused by such a large current will almost certainly cause problems with the display, especially the strings furthest away from the power supply. You would have to connect several (or all) of the +5V wires from the power supply together, and then use very thick power wiring to minimize the resistance, which would also help reduce the voltage drop (and heating).

Also I should note that pushing 3.6A through three pairs on a RJ45 connector (with one pair left over for data) is right at the rated limit for the connectors, and the resistance of the connectors plus the internal wire crimps plus the wire itself may cause some voltage drop and heating issues as well. You would definitely not want to try and run 20+ amps through it!

And as for laying out a PCB, I wouldn’t suggest trying to push 21.6A through a circuit trace! If you go with the spoke & hub wiring, bring several (at least 6 each) of the individual +5V and ground wires from the power supply to the board (all the incoming +5v lines should be physically close together and well connected to each other on the PCB, and the same goes for all the grounds coming from the power supply as well). You could get by with 80mil/2mm trace widths (although I’d go even bigger than that) for each run from a power supply input group to a single LED strip. Also, if you are planning on using more than a 2 layer PCB, make sure you run the power traces on the outside layers; the copper on the inside layers is typically half as thick as the outer layers, and so have less current carrying capability.

One final note regarding layouts with the large capacitors and data line resistors discussed earlier: The capacitors should be located as close each NeoPixel strip as possible, and though not as critical, the resistors on the data wire should be located closer to the driving circuit (for example, the receiving SN75176 in the diagram at the top of this post). All this means that both components should be included on the receiver boards for each strip.

Hope this helps, and good luck with your design!

 
Template design by Amanda @ Blogger Buster