Showing posts with label electronics. Show all posts
Showing posts with label electronics. Show all posts

20160609

Using the SN75176A in NeoPixel & Other Applications

I have received many great comments and emails regarding my post on Driving WS2812/NeoPixels RGB LEDS over CAT5 Ethernet Cable, and it is in fact one of my most popular posts. A few people have requested that I go into a bit more detail on how the SN75176A chip is used in this application, so in this post I will explain a bit more detail about using this device.

The SN75176A is a Differential Bus Transceiver, which means that it is used to convert back and forth between a normal "single-ended" signal on one side and a "differential signal" on the other. There is a good Wikipedia article that goes into great detail on the benefits of differential signaling, but the quick overview is that it provides lower signal degradation and better noise immunity than single-ended signaling, allowing us to send our NeoPixel data over much longer distances.

There seems to be a bit of confusion with some readers regarding the SN75176A's ability to be used for both to sending and receiving differential signals, so let's see if we can clear things up a bit. This device contains both a single-ended to differential "transmitter" and a differential to single-ended "receiver". Depending on how a couple of control lines on the device are set, we can enable one or both components as needed. The following diagram shows how things are hooked up inside the chip:



The "A" and "B" pins are the differential signal lines which are connected to the long run of cable between devices. The "D" pin is used to send data on the differential pins and the "R" pin has the received data from the differential lines. Finally, the "RE" and "DE" pins are inputs to the device that enable the receiver and/or transmitter, respectively. Notice the "bar" over the RE, indicating that it is "active-low", meaning the a low input enables the receiver and a high input disables it.

If you want to configure the device as a transmitter, you would connect both the RE and DE pins to VCC – this disables the receiver and enables the transmitter so that any data applied to the D line is sent to the differential outputs on A and B. Now if you want to configure the device as a receiver, you would connect the RE and DE pins to ground, disabling the transmitter and enabling the receiver so that data received on the A and B pins is converted to a single-ended signal on the R pin.

You may be wondering what happens if the RE and DE signals are not tied to the same high/low levels. If you connect the RE low and the DE high, both the transmitter and receiver are enabled, and any data sent out using the D pin is "looped-back" or echoed on the "R" pin. This can be useful in some configurations to confirm data being sent or to detect collisions with other transmitters on the differential lines. The other configuration is when the RE pin is high and the DE pin is low. In this configuration, both the transmitter and receiver are disabled, effectively preventing data from being sent or received on the differential pins.

Now it's not needed in my NeoPixel application because data is always flowing in the same direction, but if you needed to both send and receive data over the differential pins, you could connect the RE and DE lines to your microcontroller, allowing it to select the data direction, either transmitting or receiving as needed. Notice that even though you can enable both the transmitter and receiver at the same time, you are not able to send and receive data between two such devices at the same time, as only one device at a time can be in transmit mode, otherwise the data gets corrupted (just like two or more people talking at the same time makes it difficult to understand what anyone is saying).

Hopefully this explanation will help out some of you that have been looking to tweak or modify the circuit in my long-distance NeoPixel post, or just give you a better understanding of how the design works, and maybe inspire you to try applying this idea in your own design. Also, thanks to Leo B. for prompting me to finally get around to writing this post!

Read More......

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.

Read More......
 
Template design by Amanda @ Blogger Buster