Photon and WS2812b Strip

Straight to the point, I’m having problems migrating my project from an Arduino Uno to a Photon. Initially, I thought it was a code error, but after trying samples from other users, I’m more akin to believing it’s a wiring issue, despite nothing having changed, aside from the Photon itself.

I’m driving an Alltove WS2812b addressable LED strip with the Photon, utilizing an external 5v 2.4a power supply. Even during tests using a single RGB LED, I’m lucky to see a quick flash of the LED and then nothing. The Photon seems to be doing its thing fine, registering as being connected to the IDE and slowly pulsing it’s cyan light, but I get no joy on any strip (I’ve tried 3) I plug it into.

Here’s my wiring diagram. Maybe someone will recognize where I’ve gone wrong, but effectively it’s the best practices found on Adafruit’s guide: resistor on LED data line, capacitor between poles on the power barrel. I’ve also thrown in a male and female JST connector to make removal easy if need be.

I won’t include the whole of my project’s code, but even simple apps like this don’t work:

> // This #include statement was automatically added by the Particle IDE.
> #include <neopixel.h>

> //#include "application.h"

> // IMPORTANT: Set pixel COUNT, PIN and TYPE
> #define PIXEL_COUNT 5
> #define PIXEL_PIN D4
> #define PIXEL_TYPE WS2812B

> Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

> void setup() {
>   strip.begin();
>   strip.show();
> }

> void loop() {
>     strip.setPixelColor(0, 50,50,50);
>     strip.show();
>     delay(500);
> }

It has been a while since I worked with neopixel lib, but don’t you have to call setBrightness() in setup?

 void setup() {
   strip.begin();
   strip.setBrightness(someValue);
   strip.show();
}

No, it’s an optional step that allows you to globally change the brightness of the whole strip. If I run this code on the same hookup using an Arduino Uno, the first LED in the chain lights up like it’s supposed to.

Off the top of my head it could be the mismatch of supply voltage and signal to the WS2812b and/or the resistor on D4-Din. I think normally Din accepts a digital signal and does not need a resistor. So you may be dropping the voltage even further to Din from the 3.3v signal.

You could try removing the resistor first to see if that works. Whatever best practice that had you add a resistor must have been for a normal LED to limit current. Double check that but I’ve not used resistors between signal out and Din for WS2812 digitally controlled LEDs.

You could also try running everything at 3.3v.

This link discusses issues driving the WS2812 from 3.3v devices.
http://www.electrobob.com/ws2812-level-translator/

2 Likes

You sir, you have saved my future Halloween and Christmas displays in a mere two paragraphs!

It never occurred to me that the voltage levels in the DIN would drop between the two devices, even though that makes perfect sense. The second I bypassed the resistor with a jumper, my string worked perfectly again. Thank you so very much!

Thank you for the kind words. Happy LED displays to you.

Just a quicky update. After removing the resistor from the data pin, everything worked until I put it on my 300 LED strip. Then I get nothing. My theory is that it’s still not quite enough power to get the signal down the line on the 300, even though my 88 LED test strip worked, so I’ve ordered a logic level shifter, hoping that should get me running again.

1 Like

I guess your power supply isn’t beefy enough for 300x 50mA (max. 65mA @ 100% white) - even for 88 2.4A is not enough to run them on full brightness white.
With that kind of LED count you’ll also need to power the strip at multiple points.

IIRC your control signal will not “travel” down the whole strip as it comes in from your device.
Your controller is only talking to the first LED in the strip and this will in turn “restore” the quality of the incoming signal and pass on that restored signal.

A logic level shifter is a nice to have but ScruffR is correct it is likely that there is not sufficient power to drive all of your LEDs. The largest LED “strip” that I have and used is an 8x8 matrix and I don’t have all lit at any given time so I can get away with limited supply power.

If you look at the link I included, there is mention of the signal being regenerated as ScruffR points out.

1 Like

I hear what you guys are saying and I’m not saying your wrong. I have been running the same system (with the same power supply) using an Arduino Uno. I AM setting the global brightness to 60%, so that might make a difference, but the only other reason I can think as to why my long strip doesn’t work with the Photon but my 88 count strip works great is because I fried my longer strip: a distinct possibility given my record with electronics :stuck_out_tongue:

Now I’m doubting how I ever got it originally working in the first place. I decided to try and put the Uno back on to help determine if it was the strip. Again, test strip works fine, roof strip was a no go. I noticed that the Uno wasn’t even really booting. The on-board LEDs were coming on, but dimly, and weren’t flashing to indicate it was loading the sketch.

Powering the strip from multiple points is, to say the least, difficult and something I only wanna do as a last resort since the strip is up on the roof and difficult to get at. So let me ask a few things. Am I correct in thinking that getting a beefier power supply probably won’t help either? Even if I drop 17 bucks on a 10a supply, https://www.amazon.com/100-240V-adapter-switching-display-power(US/dp/B01HYXAG04/ref=sr_1_5), will I still have a problem with the control signal?

And as far as that goes, I read the page ScruffR linked to but I only half understand the explanation. I have more ws2812b LEDs on hand I could use to do the hack. All then I would need is a 1N4004 diode in line ONLY to a throw away LED that resides first in the chain? Or am I reading that wrong? Is it better to assume better power supply and this signal regen tweak will get me back up and running again?

Is this way off base:

If you intend to light up all your LEDs at any given time, you will need to drive the current down the full length and even with only 60% you’ll be looking at 11.7A (mean avg.) down and back the thing copper traces of your LED strip - good luck for that and keep a fire extinquisher nearby :wink:

No need for a diode, since you are feeding the same voltage to each point and without voltage difference there will not be any current flowing back.
On the contrary, with the diode in place you’ll create a voltage difference as big as the forward voltage of the diode.

This is not a tweak this is the normal operation of these LEDs. Each LED receives a data signal, uses its own portion of it, polishes up the incoming signal to regenerate nice crisp signal edges and passes that on to the next LED which will do just the same again.

1 Like

I guess then I don’t understand why adding yet another LED to the string can help the situation, especially since it’s a further amperage draw on the circuit. Why is 301 better than 300 if the diode isn’t doing something specific (or at all)?

I guess I should also mention that there is a bit of length from the Photon to the first LED of the strip, in case it wasn’t clear when I said the strip was on the roof. I can sort of understand if adding an LED closer to the source could help if distance is a factor, but I can’t help but question that too, since it WAS working (albeit a year ago) with little difference in what I have now, least of all the power supply.

That link wasn’t posted by me - and I haven’t read it yet either.
But just from my understanding of the WS2812b I’d think adding a single WS2812b on the way from the controller to the first active WS2812b the dummy LED will do the level shifting for you.
It will boost the 3.3V controller signal to 5V since the LED runs on 5V and hence will just create a polished 5V signal from the incoming 3.3V signal.


Update:
Now I have read the linked page and this extra diode does make more sense now.
It just reduces the base voltage of the dummy LED just enough to get the HIGH threshold of it that bit lower to see the 3.3V as good enough HIGH siugnal and hence step up the 3.3V signal on Din to 4.3V (5V - 0.7V forward voltage of diode) on Dout (VDD in the frizzing). And hence the second LED will get a better HIGH signal in reference to the original 5V.

1 Like

Sorry, yes, that was exeng’s link.

So a diode IS necessary for this to work, regardless of the distance between the micro-controller and the first LED in the strip. Correct? If so, I’ll be stopping off at Fry’s tomorrow for a diode.

As the opening words of the linked page say

So it’s only “necessary” if you happen to have the rather picky sort of LEDs that don’t play well with 3.3V.

But to find that out, you just use one single LED and test that with 3.3V - if it works, your’s are not as picky. But for longer wires to the first LED, I’d at least use the extra “booster LED” (with or without the extra diode).

1 Like

@jedimasta, You went silent. Were you able to get your longer LED strip to work? Reporting actual/final solutions is helpful for others.

Yeah, unfortunately my work is such lately that by the time I get home, I’m too tired to fire up the soldering iron. I’ll have some free time this weekend to dive back into it. The level shifter arrived and I picked up a diode to try. I’ll report back with my findings.

Okay, so I spent a few hours today doing a bunch of back and forth troubleshooting based on the feedback I got here and my issues were three-fold.

First and foremost, I made a total rookie mistake and switched polarity on the strip. My homemade test-strip and my store-bought roof strip have opposing negative/positive leads. I ended up taking the whole strip down off my roof and discovered this pretty quickly. A quick swap of the wires and there were lights again! At least, mostly.

Second, I discovered about halfway down the strip, there was a bad LED. Not only was it not lighting, but it was really degrading the signal to everything after it, causing the back half to flash wildly in whatever color it felt like. Once I bypassed the data line on the bad LED, the strip looked great again. Sort of.

Finally, the patterns seemed to be getting to the strip, but not as I was expecting to. Colors weren’t being adhered to, speed was wrong, etc… I tried the level shifter, but I couldn’t quite figure out how it was meant to work, so instead I put a dummy LED in line with the strip, before it goes out to the length of cable that carries it up the roof and voila!

PRETTY LIGHTS!

I need to re-weather proof the length I had to cut into in order to bypass the bad LED, not to mention climb back up the ladder to reinstall the strip (something I’m not looking forward to), but otherwise I think I’m back in business. Now it’s a matter of getting my new FastLED sketch to work on the Photon, but that’s a topic for a different forum.

Thanks everyone!

1 Like

Thanks for the update. Glad to hear that it is working. Should be helpful to others.

We have all done the reverse polarity thing at one time or another.