Doubt on how to connect a chain of single neopixels

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bozzaglia
 
Posts: 131
Joined: Mon Aug 01, 2022 6:14 am

Doubt on how to connect a chain of single neopixels

Post by bozzaglia »

I am trying to design a circuit with 48 single 1515 neopixel leds.
The neopixel uberguide says the the output of the last neopixel can be left unconnected, however the neopixel datasheet (screenshot attached) says that "input and ouput MUST be connected in series to the protection resistor R1".
So I have two questions:
1) can I still leave the last output unconnected?
2) if not, I need help to understand the schematic and instructions on the datasheet: does it mean that the input of the first led and the output of the last led get connected together and then go into the same "R1" resistor and from there to the controller output pin?
Thanks in advance!!
Angelo
Attachments
Acquisisci schermata Web_6-4-2023_152330_cdn-shop.adafruit.com.jpeg
Acquisisci schermata Web_6-4-2023_152330_cdn-shop.adafruit.com.jpeg (80.67 KiB) Viewed 186 times

User avatar
blakebr
 
Posts: 956
Joined: Tue Apr 17, 2012 6:23 pm

Re: Doubt on how to connect a chain of single neopixels

Post by blakebr »

Hi,

The first input pin is the only resistor recommended. The output can be left to float. Some of the newer NeoPixel LEDs do not need the 400 to 1000 ohm input resistor. Unfortunately there is no way to tell which is which.

Bruce

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Doubt on how to connect a chain of single neopixels

Post by adafruit_support_mike »

The main purpose of an input resistor is to limit the chance for damage from voltage spikes when you have a long cable between the microcontroller and the NeoPixels.

The energy that makes electrical signals move through wire obeys the same math as waves in a liquid. When a wave moves through water, energy from the incoming wavefront pushes the water ahead of the wavefront higher. As the water moves higher, the wavefront advances. When the water reaches its highest vertical displacement, it's absorbed all the energy it can from the incoming wavefront.

At that point, gravity takes over and starts pulling the water down again. The energy pulling the water down creates pressure which transfers energy to the water on either side.

The falling water column reaches its highest speed (and highest momentum) when its height reaches the neutral level. The momentum keeps pushing the water down, losing energy to the water on either side. The momentum of the falling column will reach zero when the water has fallen as low as it can (as far below neutral level as it rose above neutral level while being pushed up).

Half the energy from the falling water column goes to the water ahead of the wavefront. That water starts at the neutral level and the incoming energy pushes it up to the maximum wave height.

The other half of the energy goes to the water behind the wavefront. That water starts at the lowest possible level, and the incoming energy pushes it back up to neutral height.

As long as the wave keeps moving through the same material, the energy will keep doing the same thing: the vertical motion of the column at the wavefront passes energy ahead and behind, pushing the water ahead of the wavefront up and bringing the water behind the wavefront back to neutral level.

If the wave suddenly hits something it can't move, like a rock, the wavefront can't transfer energy forward any more. The energy has to go somewhere though, so it pushes the water column at the wavefront twice as high as usual. Then as the column falls, all of the energy goes into the water behind the wavefront, creating a new wave that heads back toward the origin of the original wave.


Electrical signals behave the same way, with voltage taking the place of height, and electromagnetic fields taking the place of gravity and momentum. The energy that makes a signal propagate along a wire comes from magnetic fields collapsing and pushing energy into the electrons ahead of and behind the field.

A sudden change in resistance has the same effect on electrical signals as a rock has on waves in water. The collapsing magnetic field can't send energy forward into the higher resistance, but the energy has to go somewhere, so the result is a spike with twice the voltage of the main signal.

Long cables have lots of parasitic inductance, which makes them especially good at generating voltage spikes.

A NeoPixel's input pin has much higher resistance than the wire that carries the signal to the pin, so it's easy for a long wire to generate voltage spikes at the NeoPixel's DIN pin. And in many cases, those voltage spikes are high enough to kill the first pixel in a strip.

Adding 400 Ohms to 1k just ahead of the NeoPixel's DIN pin protects the NeoPixel in two ways:

First, the new resistance is much higher than the resistance of the wire, so the 'create a voltage spike' action happens at the end of the resistor connected to the wire instead of at the end of the wire connected to the NeoPixel.

Second, resistors convert energy flowing through them to heat, removing that energy from the electrical system. Therefore any current driven by a voltage spike at the wire end of the resistor loses most of the energy that could damage a NeoPixel's DIN pin as the energy passes through the resistor.

User avatar
blakebr
 
Posts: 956
Joined: Tue Apr 17, 2012 6:23 pm

Re: Doubt on how to connect a chain of single neopixels

Post by blakebr »

Mike,

What is the definition of long cable?
Is there any way for the average amateur to determine long?
Would clamping diodes be a viable solution?

Bruce

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Doubt on how to connect a chain of single neopixels

Post by adafruit_support_mike »

blakebr wrote: Mon Apr 10, 2023 11:14 am What is the definition of long cable?
Anything longer than six inches (150cm).

The speed of light is 300e6m/s, which converts to 30cm per nanosecond. Electrical signals propagate through copper at about 70% the speed of light, so we generally assume it takes 5ns for a signal to move through 1m of wire, and the round-trip time for a pulse and its reflection is 10ns.

Even a couple nanoseconds of isolation from the nearest alternative current path is enough time to generate a serious voltage spike, and is more than enough time to destroy a component.

In wiring with less than a 1ns round-trip time, the parasitic resistance and capacitance of the wire are enough to keep a large voltage spike from forming before the energy has time to go somewhere else.
blakebr wrote: Mon Apr 10, 2023 11:14 am Would clamping diodes be a viable solution?
They can help, but you need to check the specs to make sure they can start conducting in less than a nanosecond. Fast devices do exist (gas discharge tubes, for instance), but they cost a lot more than a 1c series resistor.

User avatar
blakebr
 
Posts: 956
Joined: Tue Apr 17, 2012 6:23 pm

Re: Doubt on how to connect a chain of single neopixels

Post by blakebr »

Mike,

What about ferrite beads?

The joke where I worked was that the radar engineers wanted to make Maxwell's birthday a holiday.

Bruce

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Doubt on how to connect a chain of single neopixels

Post by adafruit_support_mike »

Ferrite beads are basically frequency-sensitive resistors.

Any inductor with a ferromagnetic core is prone to energy losses from current being induced within the core. If you use a ring of plain iron, the induced current would travel through the iron and lose energy to the metal's resistance.

Inductors made to store or transfer energy use cores that don't support eddy currents easily.. ferrite is made from magnetic powder suspended in an insulating ceramic matrix. None of the magnetic grains touch each other, so it's impossible to get current through the bulk material. The only eddy currents that can exist live inside the magnetic grains, which are so small that the current loop is negligible.

Ferrite beads do the reverse. They're made from relatively large magnetic particles with relatively high resistance, and allow some bulk current flow. Energy absorbed from current moving through the core tends to be dissipated by eddy currents circulating in the core, rather than staying in the magnetic field where it can be dumped back into the current when the magnetic field collapses.

Ferrite beads are good at damping out high-frequency signals, but they don't see any difference between a voltage spike and the rising edge of a square wave.

That's a problem because Fourier analysis tells us that a square wave is the weighted sum of the odd harmonics of the wave's main frequency. To get a reasonably clean-looking square wave you need at least five frequency components, which means the highest frequency of interest is 10x faster than the square wave itself.

NeoPixel data signals are even more complicated because they use self-clocking data: every bit is represented by a pulse that goes high and then goes low again. The pulse for a 0 needs to go low 400ns after the rising edge, and the pulse for a 1 needs to go low 800ns after the rising edge.

Functionally, the NeoPixel's input circuit reads the DATA-IN line about 600ns after the rising edge. A 0 pulse will already have gone low by then, while a 1 pulse will still be high.

Making a square pulse narrower requires even more high-frequency components.

So a ferrite's tendency to damp out higher frequencies would distort the rising and falling edges of the data signals, possibly enough to interfere with the signal timing.


Ferrite beads are normally used to block thermal noise and resonances. Ferrites on a cable absorb enough energy to keep signals from reflecting back and forth from one end of the wire to the other (usually showing up as 20MHz to 40MHz ringing in 1m of cable). Ferrites on the input of an amplifier allow the amp to have high gain without becoming a feedback monster. Those are mostly steady-state applications.. you want to block high frequencies all the time, or to attenuate them enough that they don't cause problems in a feedback loop. I don't recall seeing ferrites used for transient applications like individual voltage spikes.

User avatar
blakebr
 
Posts: 956
Joined: Tue Apr 17, 2012 6:23 pm

Re: Doubt on how to connect a chain of single neopixels

Post by blakebr »

Mike,

Very good explanation. You must have done, or are doing some technical instructing.

Bruce

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Doubt on how to connect a chain of single neopixels

Post by adafruit_support_mike »

That's basically my job here. ;-)

Both my parents were teachers, and I learned early that there's no denser source of fuzzy thinking papered over with five-syllable words than academic memos. Then I was exposed to good writers like Feynman explaining truly difficult subjects, Orwell's essay _Politics and the English Language_, and Einstein's quote:
If you can't explain it to a six year old, you don't understand it yourself.
The combined effect was a highly tuned sense of when my own explanations don't quite hang together properly. It's a mental itch that escapes being called an obsession by virtue of being useful.

Working here at Adafruit gives me a steady supply of interesting questions from people who don't have a deep background in electronics or programming, and time to practice coming up with a decent answer.

User avatar
blakebr
 
Posts: 956
Joined: Tue Apr 17, 2012 6:23 pm

Re: Doubt on how to connect a chain of single neopixels

Post by blakebr »

Mike,

One of my many flaws is i check quotes.

I swear I remember Feynman saying something like "If you can't teach something to a 6-year-old, that means you don't really understand it" in 'Surely You're Joking, Mr. Feynman' –
BlueRaja - Danny Pflughoeft
Dec 20, 2013 at 17:18

Still one of your hero's.

Bruce

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Doubt on how to connect a chain of single neopixels

Post by adafruit_support_mike »

Feynman said it as well, but he knew Einstein. That idea was the basis of Feynman's "Six Easy Pieces" lectures, and the following "Six Not So Easy Pieces".

In _Surely You're Joking_, Feynman tells the story of his first presentation to experts, including Von Neumann, Pauli, and Einstein.. he was scared to death, but once he got up and started talking the presentation flowed naturally:
But then the end of the seminar came, and it was time for questions. First off, Pauli, who was sitting next to Einstein, gets up and says, "I do not sink dis teory can be right, because of dis, and dis, and dis," and he turns to Einstein and says, "Don't you agree, Professor Einstein?"

Einstein says, "Nooooooooooooo," a nice, German-sounding "No, "--very polite. "I find only that it would be very difficult to make a corresponding theory for gravitational interaction." He meant for the general theory of relativity, which was his baby. He continued: "Since we have at this time not a great deal of experimental evidence, I am not absolutely sure of the correct gravitational theory." Einstein appreciated that things might he different from what his theory stated; he was very tolerant of other ideas.

I wish I had remembered what Pauli said, because I discovered years later that the theory was not satisfactory when it came to making the quantum theory. It's possible that that great man noticed the difficulty immediately and explained it to me in the question, but I was so relieved at not having to answer the questions that I didn't really listen to them carefully.

User avatar
squeege
 
Posts: 5
Joined: Wed Dec 26, 2012 3:06 pm

Re: Doubt on how to connect a chain of single neopixels

Post by squeege »

The Uberguide says 2 meters is a rough limit for signal length implying the need for a repeater pixel in the middle.
I am currently running 14 strips of 33 WS2812B and 5 strips of 33 WS2813 pixels from a single signal feed stretching 25 feet. It is 18 gauge shielded. So essentially pin 3 is connected to the first pixel on 19 strips spread out on 25 feet of wire without a repeater. The strips play the same pattern.

I am not sure where the problem is with long runs, but suspect that part of the problem is that long wires pick up Radio Frequency Noise (RF) from all over the place and that this could screw up the signal. I am using a cap 1000uf across the feeds for groups of roughly 5 strips. My current belief is that the Uberguide overstates the problem with distance. It could be that the shielded cable comes closer to matching the impedance at both ends, or it could be that it just avoids noise. Its beyond my current ability to know or find out. I could also just be wrong.

I had been considering trying to sync numerous ATTiny's with a single 8mhz clock instead of the internal clock or individual crystal. This posed more RF issues, so instead I tried feeding my whole mess with one signal from an Uno even though the guide made this seem like it would not work. But, this is working well. The DC power is also inside the shield.

Tomorrow I am going to try the second wire to run a different signal down to a few strips at the end of the board and see if I develop cross talk issues between the wires. I think that I will.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”