These are chat archives for Makuna/NeoPixelBus

1st
May 2017
Gabriel Klein
@gabrielklein
May 01 2017 09:37
Dear community, I'm having fun developing a project to control leds, relays and temperature modules using an ESP8266 ( https://github.com/gabrielklein/SensorNode ).
I have a SN74AHCT125N for the 3.3v to 5v conversion.
My issue is that the first 6-7 leds have intermittent problems. I can control the light of led1, 3, 5 but not 0,2,4,6. Leds >7 (up to 60 or 300) are working perfectly.
But when I start my module, the leds are correctly controlled.
Leds controlled in the "setup" or "loop" seams to work as expected (I show a status at the beginning).
But when I control legs using a server callback
ESP8266WebServer webServer->on("/led/set", HTTP_POST, [&] () {this->servLeds(); });
These first leds are not working correctly.
Any idea of an issue with code?
Do you know how to wire these strip correctly? (I have the +5v, GND and 2 signal. Where should I connect the second signal (first one is connected to D4))
Should I connect the last led to something?
I setup the objet with: this->neo = new NeoPixelBus<NeoGrbFeature, NeoEsp8266AsyncUart800KbpsMethod>(this->countLed, 2 /port/);
and then
this->neo->Begin();
this->neo->ClearTo(RgbColor(0, 0, 0));
this->neo->Show();
Michael Miller
@Makuna
May 01 2017 16:59
@gabrielklein The server callback is more than likely either inside an ISR. This means that many complex APIs can't be called within them. You need to store state and then within your loop look for the state change to them apply them to strip. Sometimes setting the color within the ISR is ok; just don't call Show() within it.
Michael Miller
@Makuna
May 01 2017 17:04
On the topic of connecting them, if your LEDs are modern versions (less than a year old) most will work without needing a signal level adjuster; so you can connect the signal directly to a pin. The output on the last LED doesn't needed to be terminated in any special way so leave it disconnected.
P.S. You can include code inside a block by placing ``` a the first line alone and the last line alone, makes it easier to read; like....
this->neo->Begin();
this->neo->ClearTo(RgbColor(0, 0, 0));
this->neo->Show();
Gabriel Klein
@gabrielklein
May 01 2017 22:16

@Makuna Thank you very much. I just call
'''this->neo->Show();
In the "loop()" and it seams to be way more stable.

I still have an issue with the first led... and after having flashed the module the leds are really inconsistent (I have to switch them off and on).
Do we have a way to send a reset programmatically?
WS2812B seams to not have this problem with the first led (but I only have 5 leds on it).

With the level adjuster I can use the first led, but without it no way to make it work :) Other leds are working perfectly!

I'll have a look tomorrow. I don't have the compensator as suggested in some places.

Thank you for your time!

```this->neo->Show();
Wrong ''' :)
this->neo->Show();
Got it I think
Michael Miller
@Makuna
May 01 2017 23:35
Ah, if the first pixel is a problem only, then YES, the issue you are hitting requires a level shifter. You see, the first pixel will "clean up" the signal for the next one; its a feature of the chip inside.
To clear them all to black, just call Show() the first time and it will clear them. Internally the data is initialized to black and marked dirty, so the first call to Show() will clear them. I have had some success in calling show as the last thing in Setup.