Problem controlling led strip with Photon

Hi Guys, I’ve been tinkering for a while now with Arduinos and Photons, mostly controlling leds, motion sensors and other small devices. I’ve been running into a very frustrating issue and I don’t know how to solve it.
I am controlling a WS2812B strip of led pixels. Very straightforward to control and I am using the Neopixel library. I am plugging the Photon into a powered USB hub for power and the strip is connected to the VIN and GND headers plus D1 for controlling it. Here is the thing: if I am powering the photon from the Hub and also add a second strip on D2 everything works fine. If I unplug or simply leave off the second strip, the first one starts acting up, flickering, wrong colors, etc. I noticed the exact same behavior when I powered the photon from an iPad usb wall wart (2.1A). Its simply behaves strangely with lights either flickering while fades are done or having wrong colors.
I need to mention that the second strip on D2 is about 30 leds long and the first one is only 4 leds long.

I later tried to port the same code that works on an arduino with the same kind of strip, and the photon exhibited the same wird behavior: flickering while fading and many leds having completely wrong colors.

Please let me know if this is something obvious that I am missing or if not, I can come back with more details including code.

Thanks!

1 Like

Hello,

Let me ping two of the Elites that are both knowledgeable with libraries and Neopixles. @wgbartley @peekay123 are you able to help out with this?

Kyle

Thanks @KyleG! @kataleen, I need to understand a bit more. First, what is your USB hub rated in terms of current per port? Typically, that will be only 500ma to 1000ma. When you “add” the second string, do you turn off the power before connecting it? Did you know that 30 WS2812b LEDs can draw up to 1.8A when fully lit? The max current recommended to be drawn from Vin is 1.0Amps.

I suspect that your USB cable is a) not very good quality and can’t handle the current or b) is too long and creating inductance and resistance problems. Flickering is typically a symptom of improper or “unclean” power.

You may want to try a different USB cable or even better, power your LED strips from a separate 5v supply (sharing a common GND with the Photon). You could also add a large electrolytic capacitor (470uF) as near to where you connect the power for the strips as possible.

3 Likes

You may want to try adding a 1k resistor on your data pin. Basically, data pin -> 1k resistor -> NeoPixel data in. If that doesn’t work, try a logic level converter to convert the Photon’s 3.3v output to 5v for the NeoPixels. I’ve noticed that some strands/strips perform better than others. When buying from places like eBay, quality and compatibility can vary wildly, even from the same vendor.

3 Likes

Thanks for the helpful reply. The hub I am using is this one: https://www.amazon.ca/Insignia-7-Port-USB-3-0-NS-PCH6732-C/dp/B01F2HEC4A which seems to be able to provide 2.1A per port.
Just to clarify a bit, the flickering and strange behavior is experienced when the large strip is NOT on. That’s what it seemed weird to me. When the large strip (30+ leds) is on, the first one (4 leds) works perfectly. As soon as i turn off all leds on the large strip, the small one starts acting up.

I will try to connect the small strip to a separate 5V power wart and bridge the ground with the Photon.
Also, for the capacitor, should I bridge the two power wires with it, close to the power supply? (sorry, not a lot of electronics background here)

Unfortunately this IS an ebay product. I will try adding the resistor and report back. If nothing works, I will come back with more details and a short video of what it looks like.

I tried moving the strip to a dedicated 5V power supply but that only made things worse. The 1k resistor made the strip unreachable by the signal for color change.
The thing that ultimately worked was to power the strip from the 3V3 pin of the Photon. Once I did that everything started working flawlessly. I only remembered seeing this suggestion in my research before posting here, but kind of dismissed it thinking that the leds would not like being powered by the lower voltage. I guess I was wrong.
Thanks everybody for pitching in. I appreciate it!

@kataleen, you can only draw 100ma from that 3V3 pin! Can you provide a link to the strip on eBay?