NeoPixel strip and resistor
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 28
- Joined: Fri Mar 14, 2014 12:22 pm
NeoPixel strip and resistor
Hey guys,
I am currently working on a project which uses about 700 leds of NeoPixels (7 or 8meters). I am having a LOT of trouble with it, even though I'm used to working with electronics. There is a common ground line, the supply is a 26 amp for every 300 somewhat leds, no worries for these things. So here's the whole thing:
-The 300 to 500 ohm resistor that is suggested by adafruit does NOT appear on the datasheet of the WS2812, which is surprising. The fact that we are writing on a data IN means we should be facing a high resistance, so why are we adding a resistor? The site says "it's due to a voltage spike", but I'm surprised with such an explanation. When you'll read the 2nd part you'll understand.
-There is a strange thing though. The 1m strips came with an integrated resistor on the wire, the 2m didn't. When I check the schematics, that makes no sense at all. The 1m strips didn't work when I'd just plug my data line (without any resistor), none of them (I have 2), so I thought "oh well, I just messed things up, as usual", and plugged my pin directly BEHIND the resistor... TADAM! it worked. So I went on without the resistors. On the 2m strips, there was no resistor, these would work with my data line without resistor.
-After screwing around for a while, the first pixel of about all the strips is gone (may he rest in peace). So i've made my own "resistive cable", with 388 ohm as total resistance (that's what my multimeter says), the resistor is soldered on the data pin that is plugged in the NeoPixel. But then nothing would work.
So, here's the big deal:
It works for a while without the resistor, then I can say farewell to the first pixel. If the resistor is on the line, nothing would work. So how do I deal with this? I've got enough resistors to try different values, but that still won't explain what's going on in this mess.
I have to have the project working for 2 to 3 days, 8 to 10 hours a day. Leds would be between red and blue, so not that much power to use. Could anyone help me out? Thanks!
I'm currently wondering if I should go for like 100 ohms resistors, but I'm kind of lazy and don't want to try all the resistors I have... None of my friends understands what's going on in these leds. After I've cut out the first pixel on one of my 1m strips, it works with the resistor... Something magic is going here...
I'm working with an atmeg32u4 (same as leonardo), with the adafruit library.
Edit: One of the 1meters strip never worked, which is why I then tried all the other strips, with and without resistor.
I am currently working on a project which uses about 700 leds of NeoPixels (7 or 8meters). I am having a LOT of trouble with it, even though I'm used to working with electronics. There is a common ground line, the supply is a 26 amp for every 300 somewhat leds, no worries for these things. So here's the whole thing:
-The 300 to 500 ohm resistor that is suggested by adafruit does NOT appear on the datasheet of the WS2812, which is surprising. The fact that we are writing on a data IN means we should be facing a high resistance, so why are we adding a resistor? The site says "it's due to a voltage spike", but I'm surprised with such an explanation. When you'll read the 2nd part you'll understand.
-There is a strange thing though. The 1m strips came with an integrated resistor on the wire, the 2m didn't. When I check the schematics, that makes no sense at all. The 1m strips didn't work when I'd just plug my data line (without any resistor), none of them (I have 2), so I thought "oh well, I just messed things up, as usual", and plugged my pin directly BEHIND the resistor... TADAM! it worked. So I went on without the resistors. On the 2m strips, there was no resistor, these would work with my data line without resistor.
-After screwing around for a while, the first pixel of about all the strips is gone (may he rest in peace). So i've made my own "resistive cable", with 388 ohm as total resistance (that's what my multimeter says), the resistor is soldered on the data pin that is plugged in the NeoPixel. But then nothing would work.
So, here's the big deal:
It works for a while without the resistor, then I can say farewell to the first pixel. If the resistor is on the line, nothing would work. So how do I deal with this? I've got enough resistors to try different values, but that still won't explain what's going on in this mess.
I have to have the project working for 2 to 3 days, 8 to 10 hours a day. Leds would be between red and blue, so not that much power to use. Could anyone help me out? Thanks!
I'm currently wondering if I should go for like 100 ohms resistors, but I'm kind of lazy and don't want to try all the resistors I have... None of my friends understands what's going on in these leds. After I've cut out the first pixel on one of my 1m strips, it works with the resistor... Something magic is going here...
I'm working with an atmeg32u4 (same as leonardo), with the adafruit library.
Edit: One of the 1meters strip never worked, which is why I then tried all the other strips, with and without resistor.
- adafruit_support_bill
- Posts: 89346
- Joined: Sat Feb 07, 2009 10:11 am
Re: NeoPixel strip and resistor
That impedence mismatch is exactly the reason for adding a termination resistor.The fact that we are writing on a data IN means we should be facing a high resistance, so why are we adding a resistor?
http://en.wikipedia.org/wiki/Electrical_termination
Note that to be effective, it needs to be at the strip end of the signal wire. Please post a photo showing how you have it all connected.
-
- Posts: 28
- Joined: Fri Mar 14, 2014 12:22 pm
Re: NeoPixel strip and resistor
http://image.noelshack.com/fichiers/201 ... 14-002.jpg
There you go for a pic. I'm not sure what you're expecting though.
It's simply putting the ground on common, the controller is powered through my computer's usb. On the cable that has an "integrated" resistor, the resistor is in the heat shrink at the side of the strip.
With less that 40cm of wires that are connected and always put to a known state, I still don't understand what you call impedance mismatch. If we were working at very high frequencies, it could happen, but the signal is very, very clear when checked on oscilloscope, and the only thing the resistor does is actually making it noisy and less clear. Then again, my oscilloscope may be bad.
Edit: Sorry about the huge pic, i'll just put the link...
There you go for a pic. I'm not sure what you're expecting though.
It's simply putting the ground on common, the controller is powered through my computer's usb. On the cable that has an "integrated" resistor, the resistor is in the heat shrink at the side of the strip.
With less that 40cm of wires that are connected and always put to a known state, I still don't understand what you call impedance mismatch. If we were working at very high frequencies, it could happen, but the signal is very, very clear when checked on oscilloscope, and the only thing the resistor does is actually making it noisy and less clear. Then again, my oscilloscope may be bad.
Edit: Sorry about the huge pic, i'll just put the link...
-
- Posts: 564
- Joined: Wed Jun 19, 2013 3:35 am
Re: NeoPixel strip and resistor
It looks like you're connecting the ground wire to V- ("-5V") instead of GND ("0V").
- adafruit_support_mike
- Posts: 68160
- Joined: Thu Feb 11, 2010 2:51 pm
Re: NeoPixel strip and resistor
An Arduino GPIO pin can deliver up to 40mA @ 5v. Its effective output impedance is about 125 ohms.
A WS2812's data-in pin is probably a mosfet, and most input mosfets have a gate capacitance of about 30pF. At 800kHz, that works out to an impedance of about 42 kilohms.
125 ohms != 42 kilohms, which is called an impedance mismatch. Power will not transfer optimally between the Arduino and the mosfet. That wouldn't be a problem if they were connected directly, but we have a wire between them.
Electrical pulses travel through good-quality coax at about 0.7C, so that's a decent first-order approximation for the propagation rate in short regular wires. At that rate, the transit time through a 30cm wire will be about 1.5 nanoseconds.
Regardless of the wire's inductance, the Arduino's 125 ohm output impedance will pump some energy into it, the WS2812's input impedance will pull some energy out of it, and the amount the Arduino pumps in will be about 300 times as large as the amount the WS2812 pulls out. Inductors and capacitors are both reactive, meaning they don't convert voltage or current to heat, so for about 3ns, 99.7% of the energy at the point where the wire connects to the WS2812 will only have one place to go: into the mosfet's gate capacitance.
The voltage at the WS2812's gate has no particular reason to stop rising when it reaches 5v. As it rises above 5v, some of the current will start to flow back through the wire because the voltage is lower in that direction. That curent will flow back to the Arduino and be swallowed by the 125 ohm impedance there.
That's another 1.5ns trip though, so for 3ns, the WS2812 has to push back against the incoming pulse hard enough to make 99%+ of the energy in the wire turn back around. That will appear as a voltage spike on the rising edge of the pulse as measured from the point where the wire meets the WS2812. If the peak voltage rises significantly above 5v, it can blow a hole through the insulation between the mosfet's gate and channel, pretty much killing the chip.
A 3ns peak is half of a 6ns sine wave, for a frequency of about 166MHz. You'd need about a 1GHz scope and high-impedance probes to see that cleanly. A 100MHz scope would attenuate the peak voltage by about 50%. Any passive probe's compensation capacitor will be on the same order of magnitude as the WS2812's gate capacitance, causing more attenuation, and its resistive leg will give the energy in the wire another, shorter path to ground.
Putting a series resistor at the WS2812 end of the wire changes things significantly.
First, it reduces the impedance mismatch between the opposite ends of the wire, reducing the amount of energy that has to be turned around. It also moves any peaking away from the gate of the mosfet, out to the point where the wire meets the resistor. The resistor limits the rate at which current can enter the mosfet's gate capacitance, and while it still allows for a crisp rising edge, the slew rate will be much slower than what you'd get from a direct wire connection.
Finally, the resistor burns off excess energy between its terminals as heat. That energy leaves the circuit in terms of its ability to produce electrical effects, again protecting the mosfet.
A WS2812's data-in pin is probably a mosfet, and most input mosfets have a gate capacitance of about 30pF. At 800kHz, that works out to an impedance of about 42 kilohms.
125 ohms != 42 kilohms, which is called an impedance mismatch. Power will not transfer optimally between the Arduino and the mosfet. That wouldn't be a problem if they were connected directly, but we have a wire between them.
Electrical pulses travel through good-quality coax at about 0.7C, so that's a decent first-order approximation for the propagation rate in short regular wires. At that rate, the transit time through a 30cm wire will be about 1.5 nanoseconds.
Regardless of the wire's inductance, the Arduino's 125 ohm output impedance will pump some energy into it, the WS2812's input impedance will pull some energy out of it, and the amount the Arduino pumps in will be about 300 times as large as the amount the WS2812 pulls out. Inductors and capacitors are both reactive, meaning they don't convert voltage or current to heat, so for about 3ns, 99.7% of the energy at the point where the wire connects to the WS2812 will only have one place to go: into the mosfet's gate capacitance.
The voltage at the WS2812's gate has no particular reason to stop rising when it reaches 5v. As it rises above 5v, some of the current will start to flow back through the wire because the voltage is lower in that direction. That curent will flow back to the Arduino and be swallowed by the 125 ohm impedance there.
That's another 1.5ns trip though, so for 3ns, the WS2812 has to push back against the incoming pulse hard enough to make 99%+ of the energy in the wire turn back around. That will appear as a voltage spike on the rising edge of the pulse as measured from the point where the wire meets the WS2812. If the peak voltage rises significantly above 5v, it can blow a hole through the insulation between the mosfet's gate and channel, pretty much killing the chip.
A 3ns peak is half of a 6ns sine wave, for a frequency of about 166MHz. You'd need about a 1GHz scope and high-impedance probes to see that cleanly. A 100MHz scope would attenuate the peak voltage by about 50%. Any passive probe's compensation capacitor will be on the same order of magnitude as the WS2812's gate capacitance, causing more attenuation, and its resistive leg will give the energy in the wire another, shorter path to ground.
Putting a series resistor at the WS2812 end of the wire changes things significantly.
First, it reduces the impedance mismatch between the opposite ends of the wire, reducing the amount of energy that has to be turned around. It also moves any peaking away from the gate of the mosfet, out to the point where the wire meets the resistor. The resistor limits the rate at which current can enter the mosfet's gate capacitance, and while it still allows for a crisp rising edge, the slew rate will be much slower than what you'd get from a direct wire connection.
Finally, the resistor burns off excess energy between its terminals as heat. That energy leaves the circuit in terms of its ability to produce electrical effects, again protecting the mosfet.
-
- Posts: 28
- Joined: Fri Mar 14, 2014 12:22 pm
Re: NeoPixel strip and resistor
Nope, you should never send current to the ground, except if you like living in the dark, because that will blow the fuses. What you call ground in most common electronics should be called "common return" (or "common source" actually, but that wouldn't be very clear). The ground symbole you can see is the ground to put the case to the ground. See pic attached, between -V and +V there's 5V, between +V and gnd there's about 0, between -V and gnd there's also 0. Reason for this is the source keeps 5V between +V and -V, but when you plug a multimeter between 5V and ground, you put them both at same potential even though the multi shouldn't be doing that, and therefore -V goes to -5V. However if you try and measure both between +V and GND, -V and GND at the same time, it's basically a short and the fuses blow.
At least, that is what my experience taught me. I only took a pic of the 5V, because the rest is quite pointless and you'll have to trust me on these measures.
http://image.noelshack.com/fichiers/201 ... 15-001.jpg,
I'll just add a detail, I am from Switzerland, you may have different practices in the US or somewhere else in the world.
Thanks Mike, I'm not totally sure I've understood it exactly, but I'll try to learn a bit more about that. However, that doesn't solve my problem. Actually worsens it, it works (for a while) without the resistor (now I've understood a bit more as to why, though I've never done anything like this and everything always worked), but with a resistor there's nothing to do about it. I got one of the 1m strips working with a resistor once, after having cut off the first pixel. There already was a resistor soldered in the package, so I've no idea how the thing can possibly have died.
So if you have an idea as to why it usually doesn't work when I use my "resistor wire" (388 ohm total as I said), I'd be glad to hear it.
At least, that is what my experience taught me. I only took a pic of the 5V, because the rest is quite pointless and you'll have to trust me on these measures.
http://image.noelshack.com/fichiers/201 ... 15-001.jpg,
I'll just add a detail, I am from Switzerland, you may have different practices in the US or somewhere else in the world.
Thanks Mike, I'm not totally sure I've understood it exactly, but I'll try to learn a bit more about that. However, that doesn't solve my problem. Actually worsens it, it works (for a while) without the resistor (now I've understood a bit more as to why, though I've never done anything like this and everything always worked), but with a resistor there's nothing to do about it. I got one of the 1m strips working with a resistor once, after having cut off the first pixel. There already was a resistor soldered in the package, so I've no idea how the thing can possibly have died.
So if you have an idea as to why it usually doesn't work when I use my "resistor wire" (388 ohm total as I said), I'd be glad to hear it.
-
- Posts: 18
- Joined: Sat May 21, 2011 12:31 pm
Re: NeoPixel strip and resistor
Uauu!!!!
I got those neopixel, and I will start coding today. Already placed a series resistor of 200's range.
Support Mike, that is one hell of an answer! I will print it out for sure.
For many years, I have never seen such a precise support answer on a single (seemed to be) question.
And totally agree with that.
That is seen quite frequent on data bus with some speed or length. The reason why it doesn't look as a termination is because you still have the strip led, but those led's are already buffers for the next one. The real transmission is between the driver (MPU) and the led.
I am going to use a BS170 level converter from 3.3V to 5V. As anyone implemented this converter and will that need also the resistor? It is a fet...
I won't use the Arduino or such similar device, but an Arm running at 100MHz, so I will trigger dataout based on timer. Will try use Adafruit Lib except timing sequence.
Thx
I got those neopixel, and I will start coding today. Already placed a series resistor of 200's range.
Support Mike, that is one hell of an answer! I will print it out for sure.
For many years, I have never seen such a precise support answer on a single (seemed to be) question.
And totally agree with that.
That is seen quite frequent on data bus with some speed or length. The reason why it doesn't look as a termination is because you still have the strip led, but those led's are already buffers for the next one. The real transmission is between the driver (MPU) and the led.
I am going to use a BS170 level converter from 3.3V to 5V. As anyone implemented this converter and will that need also the resistor? It is a fet...
I won't use the Arduino or such similar device, but an Arm running at 100MHz, so I will trigger dataout based on timer. Will try use Adafruit Lib except timing sequence.
Thx
- adafruit_support_mike
- Posts: 68160
- Joined: Thu Feb 11, 2010 2:51 pm
Re: NeoPixel strip and resistor
@Pat01: I'm not seeing any NeoPixels in the photos you posted. The power connection to the Arduino is more or less irrelevant, the stuff we're talking about involves the connection between the Arduino and the NeoPixel strip.
@19657: You don't need termination on a level-shifter of that design for a couple of reasons: first, the data signal never touches the mosfet's gate. Second, you already have 10k resistors to swallow line noise. That should be fine.
@19657: You don't need termination on a level-shifter of that design for a couple of reasons: first, the data signal never touches the mosfet's gate. Second, you already have 10k resistors to swallow line noise. That should be fine.
-
- Posts: 28
- Joined: Fri Mar 14, 2014 12:22 pm
Re: NeoPixel strip and resistor
The connector you can see is the one that is sold already soldered to the strip. So i assumed the part where you wanted to see the connections was between the controller and the strip. What were you asking for then? There's 10cm of wire after the connector going to the neopixel.
If these 10cm of wire are too much, why are they even sold this way?
I've now cut it off and resoldered to the next pixel, 3 out of 4 strips seem to be working, the last one is garbage i guess, tried almost every pixel of it and wont light up.
If these 10cm of wire are too much, why are they even sold this way?
I've now cut it off and resoldered to the next pixel, 3 out of 4 strips seem to be working, the last one is garbage i guess, tried almost every pixel of it and wont light up.
-
- Posts: 28
- Joined: Fri Mar 14, 2014 12:22 pm
Re: NeoPixel strip and resistor
Some news now that i've worked some more on it.
It worked for about an hour with the resistor, and then the first pixel died.
This is working on my nerves, it makes no sense at all. How can I get it to work for something like 8 to 10 hours straight? Has anyone done this yet ? I don't care if I have to snap a pixel after 10hours, but it has to work for at least 10 hours since it will be used as a demo.
Does anyone have an idea?
It worked for about an hour with the resistor, and then the first pixel died.
This is working on my nerves, it makes no sense at all. How can I get it to work for something like 8 to 10 hours straight? Has anyone done this yet ? I don't care if I have to snap a pixel after 10hours, but it has to work for at least 10 hours since it will be used as a demo.
Does anyone have an idea?
-
- Posts: 13
- Joined: Sat Mar 15, 2014 3:10 pm
Re: NeoPixel strip and resistor
Hello,
I seem to have a strange problem. I am making sure absolutely that I have power no more than 5v but i seem to burn the strips away frequently. I thought I am building static or something else to mess up the setup and I bought the neopixel shield. When I soldered the and powered them they worked well for a few weeks and then this happened.
I am not sure If I will be able to save this. To explain the small chip just beside the power (+) is burnt. Could anyone tell me if I messed up something or what might be the reason. I don't want to burn other shields.
I can post other pictures of my setup. It is basically pinned to an arduino uno.
I seem to have a strange problem. I am making sure absolutely that I have power no more than 5v but i seem to burn the strips away frequently. I thought I am building static or something else to mess up the setup and I bought the neopixel shield. When I soldered the and powered them they worked well for a few weeks and then this happened.
I am not sure If I will be able to save this. To explain the small chip just beside the power (+) is burnt. Could anyone tell me if I messed up something or what might be the reason. I don't want to burn other shields.
I can post other pictures of my setup. It is basically pinned to an arduino uno.
-
- Posts: 28
- Joined: Fri Mar 14, 2014 12:22 pm
Re: NeoPixel strip and resistor
Not to be mean or anything, but looks like some people never heard of netiquette.
Anyway, since it looks like I won't get any "good advice" (please don't be hurt, it's just that it seems nobody has an explanation about these strips), i'm trying a few things.
I read someone say to put a 10k resistor from DIN to GND. Not sure that worked. So here's what I'm trying:
I put 2.2kOhm on data line (same idea as the 300 ohm, except it's 2k), and a 19.8kOhm from DIN to GND.
This way:
-There is even less current than with the 300 ohm. The mismatch is bigger between the mcu and the end of the line, but it's less between end of line and DIN. However, I don't know how the mismatch affects things, what mathematical law does it follow? exponential, linear, square ? any idea?
-There is a voltage divider so that I drive DIN at 4.5V
I'll keep this thread updated if I get any good result.
P.S: It seems the leds are "driving themselves" at 4.5V. By this I mean that the signal on Dout is 4.5V. Could anyone confirm this?
Anyway, since it looks like I won't get any "good advice" (please don't be hurt, it's just that it seems nobody has an explanation about these strips), i'm trying a few things.
I read someone say to put a 10k resistor from DIN to GND. Not sure that worked. So here's what I'm trying:
I put 2.2kOhm on data line (same idea as the 300 ohm, except it's 2k), and a 19.8kOhm from DIN to GND.
This way:
-There is even less current than with the 300 ohm. The mismatch is bigger between the mcu and the end of the line, but it's less between end of line and DIN. However, I don't know how the mismatch affects things, what mathematical law does it follow? exponential, linear, square ? any idea?
-There is a voltage divider so that I drive DIN at 4.5V
I'll keep this thread updated if I get any good result.
P.S: It seems the leds are "driving themselves" at 4.5V. By this I mean that the signal on Dout is 4.5V. Could anyone confirm this?
- adafruit_support_mike
- Posts: 68160
- Joined: Thu Feb 11, 2010 2:51 pm
Re: NeoPixel strip and resistor
Putting a 10k resistor to GND was probably my suggestion in some other thread, and it solves a different problem than signal reflection.
Data signals carry very little current, and practically none of it should be DC. Mostly you're moving a few nanocoulombs of charge in and out of the gate capacitance of the mosfet at the input circuit. That tiny charge does move back and forth though, so it counts as an AC current in the microamp range.
Reflections in the wiring can cause voltage spikes, and so can induced current from nearby AC sources like mains wiring and flourescent lights. Every wire has inductance, and acts like an antenna when exposed to changing magnetic fields. Based on my experience working with high-impedance circuits, the induced current is on the order of 100 nanoamps, which is still enough to cause 1v to 2v voltage spikes when it hits a 10M to 20M input impedance.
Putting a 10k resistor between DIN and GND gives that induced current a lower resistance path to ground, which will hopefully keep it from blowing a hole through the 3-4 atom thick layer of glass between a mosfet's gate and its channel.
Data signals carry very little current, and practically none of it should be DC. Mostly you're moving a few nanocoulombs of charge in and out of the gate capacitance of the mosfet at the input circuit. That tiny charge does move back and forth though, so it counts as an AC current in the microamp range.
Reflections in the wiring can cause voltage spikes, and so can induced current from nearby AC sources like mains wiring and flourescent lights. Every wire has inductance, and acts like an antenna when exposed to changing magnetic fields. Based on my experience working with high-impedance circuits, the induced current is on the order of 100 nanoamps, which is still enough to cause 1v to 2v voltage spikes when it hits a 10M to 20M input impedance.
Putting a 10k resistor between DIN and GND gives that induced current a lower resistance path to ground, which will hopefully keep it from blowing a hole through the 3-4 atom thick layer of glass between a mosfet's gate and its channel.
-
- Posts: 28
- Joined: Fri Mar 14, 2014 12:22 pm
Re: NeoPixel strip and resistor
I can't really see any difference between the other posts of "I blew my first pixel" and mine. Except that my strips started off not working with the resistor, but now they do.
The leds have been lit for 5-6hours straight yesterday, 2 hours the day before and already 2 hours today, still no problem. This idea might be something to look into, it seems a better explanation to me than looking for some magic inductance that would, or would not, be there.
Could anyone confirme for the DOUT pin being at 4.5V ?
By the way, to me you don't induce a current, you induce a voltage (u = d(phi)/dt with phi the magnetic flux), phi = L*i (this i here is the source of the magnetic field, it is NOT in the data cable). And then we have i_data = u/r, so i'd put a bigger resistor than 300 ohm. And the one to the ground has to be something like 10k< R < 25k, in order to be fairly low compared to the DIN line.
The leds have been lit for 5-6hours straight yesterday, 2 hours the day before and already 2 hours today, still no problem. This idea might be something to look into, it seems a better explanation to me than looking for some magic inductance that would, or would not, be there.
Could anyone confirme for the DOUT pin being at 4.5V ?
By the way, to me you don't induce a current, you induce a voltage (u = d(phi)/dt with phi the magnetic flux), phi = L*i (this i here is the source of the magnetic field, it is NOT in the data cable). And then we have i_data = u/r, so i'd put a bigger resistor than 300 ohm. And the one to the ground has to be something like 10k< R < 25k, in order to be fairly low compared to the DIN line.
-
- Posts: 28
- Joined: Fri Mar 14, 2014 12:22 pm
Re: NeoPixel strip and resistor
By the way, has anyone reported an issue with the first pixel of a strip diing when it is connected behind another strip? That would kind of confirm my theory.
Please be positive and constructive with your questions and comments.