Neopixel BFF question (resistor and capacitor)

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
michaelmeissner
 
Posts: 1819
Joined: Wed Aug 29, 2012 12:40 am

Neopixel BFF question (resistor and capacitor)

Post by michaelmeissner »

The tutorial and schematics for the Adafruit NeoPixel Driver BFF Add-On for QT Py and Xiao does not seem to be published at the moment, so I had a question. Perhaps when they are published, the answer will be there:

There are essentially 3 things in the Neopixel uberguide for running neopixels on 3.3v systems using USB/VIN power:
  • Have a fast enough level shifter on the data line to bring the data pin up to the VIN used for the neopixels. The new BFF has this;
  • Have a 300 - 500 ohm resistor before data pin connects to the neopixel to prevent ringing. I don't know if the BFF provides this.
  • Have a 500–1000 µF capacitor at 6.3V or higher to buffer the power supply against power spikes. The BFF doesn't seem to have this.
My question is there a resistor between the level shifter and the data pin output in the JST plug (or between the data pin and level shifter input)? If there isn't, I could imagine several different reasons:
  • The level shifter eliminates the need for the resistor. I know the PJRC OctoWs2811 board has 100 ohm resistors between the level shifter outputs and the RJ45 connectors, and it looks like the NeoPXL8 board may also have resistors, but I can't really tell. So I suspect the level shifter does not eliminate the need for the resistor.
  • Given that the BFF is likely to only be used for small number of neopixels (< 100 or so), perhaps the issue with ringing doesn't typically show up in smaller installations.
  • Given the QT PY form factor, perhaps it is expected that the BFF only be used with power banks instead of more complex power setups, and perhaps ringing isn't an issue with that system.
Likewise given the size, there does not appear to be a large capacitor in the board. Perhaps there are the smaller 0.1 µF ceramic capacitors used but I suspect there isn't a 500–1000 µF capacitor present. Is this the case? Is there a reason for this? One can add the capacitor, either by attaching it to the VIN and - pads on the QT PY, or on the neopixel strand itself. But it would be helpful to know if I need to add it.

I can imagine that if the expectation is that the BFF would typically be used with power bank batteries, that you really don't need the capacitor. Or perhaps, users are just used to inserting capacitors manually.

I must admit, I really don't know what ringing is and when it shows up. Over the years, I've had my share of quirky neopixels, but they seem to be heisenbugs -- if you look at them, they disappear. I built a test setup, where I could vary lots of things (using 1 of 2 level shifters or none, using capacitors, using resistors, using alternate power supplies, etc.) and I haven't seen any quirky behavior such that I could use the board to narrow down what the issue is. Now, I never build the really big neopixel displays.

I will say, when Adafruit switched from Ws2812b's to Sk6812's in their neopixels, the quirky things have gone down.

I sometimes 'forget' to do the resistor, level shift, and capacitor and usually it seems to work.

I am curious about why A3 was the pin chosen for the default pin. Granted there are few enough pins on the QT PY that no matter what you pick, it has alternate uses. I would think that perhaps MOSI might have been a better choice, since that is the pin on the QT PY M0 boards that can be used with the Neopixel_ZeroDMA library (at the cost of not being able to drive SPI screens -- but SPI typically uses enough pins that you might be better going to larger form factors like ItsyBitsy or Feather).

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

Re: Neopixel BFF question (resistor and capacitor)

Post by adafruit_support_mike »

Ringing is a wiring issue, not one related to the number of pixels being driven.

Electrical signals travel through wire at about 5ns per meter, and they obey the same math as sound waves, waves in water, etc. Specifically, the wavefront of electrons moving through the wire carries the energy that makes the electrons move.

The non-moving electrons ahead of the signal wavefront act as a barrier that tries to stop the moving electrons from going any farther. As the moving electrons slow down, the magnetic field collapses and dumps energy into the electrons in a way that looks like a voltage pushing them forward. Some of that energy goes into the electrons just ahead of the wavefront, making them move. The total energy in the field is enough to create a new wavefront a little farther along the wire and completely stop the previously-moving electrons behind the new wavefront.

When the wavefront hits something that can't transfer energy the same way, like the input impedance of a NeoPixel, it's equivalent to a wave in water meeting a rock. The wave can't transfer much energy to the rock, but the energy has to go somewhere. The the un-transferred energy makes the water rise twice as high (or doubles the pulse voltage) and creates a reflected wavefront going back the opposite way.

In practical terms, people trying to run NeoPixels through several meters of wire were (quite reliably) popping the DATA-IN circuit on the first pixel because of the inductive voltage spike.

Putting a resistor just ahead of the first pixel protects the DATA-IN circuit in a couple of ways: first, it moves the point where the signal wavefront suddenly meets a much higher resistance to the line end of the resistor, so any signal reflected back originates there. Second, the resistor burns off energy as heat.

For a capacitor charging through a resistor (a mosfet's gate being a small capacitor), exactly 50% of the energy is lost to the resistor. That neatly cancels any inductive voltage spike that may occur.

Putting the protection resistor at the input end of the wire (or on a driver board) wouldn't do much good because the signal would still have the parasitic inductance of all the wire between the driver and the pixel to build up energy for a voltage spike.
michaelmeissner wrote: Fri Nov 18, 2022 6:51 pm Likewise given the size, there does not appear to be a large capacitor in the board. Perhaps there are the smaller 0.1 µF ceramic capacitors used but I suspect there isn't a 500–1000 µF capacitor present. Is this the case? Is there a reason for this?
This also relates to signal propagation, but on the power lines this time.

If you short the ends of a 1m cable connected to a power supply, it's physically impossible for the supply to notice the change in less than the 5ns it takes for the signal to travel through the wire. That applies to all sudden changes in current, like PWM control of an LED.

Ohm's Law doesn't stop working though, so the voltage at the shorted end of the wire will be determined by the available current in the wire and the resistance through the short (or the I-V curve of an LED) during the 10ns gap between 'the load has changed' making its way to the power supply and the power supply's response making its way to the new load. The result is a sudden drop in voltage.

(and at the nanosecond level, a wire acts like a conveyor belt feeding constant current at a constant voltage)

CMOS devices like NeoPixels define their high and low input thresholds as fractions of their supply voltage (typically 30% and 70%), so changing the supply voltage changes the way the circuit reads input.

Again, as a practical matter, people using long runs of cable were seeing signal glitches due to noise on the supply lines.

A large capacitor at the point where power enters the NeoPixel strip acts like a rechargeable battery to damp out those voltage spikes. It doesn't hold much energy compared to a real power supply, but it only has to keep the voltage from crashing for a microsecond or so.

And again, putting the capacitor at the input end of the cable would move it to the far end of a 10ns/meter round-trip and it wouldn't do any good.


We assume the BFF will be used in close proximity to the NeoPixels it drives, which reduces the inductance and propagation issues enough that they can be ignored safely. On the off chance that someone does want to hook a few meters of cable to the BFF, they'll need to follow the best practices and put a resistor and large capacitor at the NeoPixel end of the line like always.

User avatar
michaelmeissner
 
Posts: 1819
Joined: Wed Aug 29, 2012 12:40 am

Re: Neopixel BFF question (resistor and capacitor)

Post by michaelmeissner »

Thanks for the explanation.

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

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