Skip to content

74 LED WS2812B strip is flickering when connected to ESP8266 with Wi-Fi enabled #306

Closed

Description

@krzychb

I have been testing Fire2012.ino sketch with latest FastLED library (saved directly from GitHub) using WS2812B strip with 74 and 144 LEDs together with ESP8266.

Fire2012.ino works as expected when Wi-Fi of ESP8266 is off.
If Wi-Fi is on, the strip is flickering 😞

Has anybody tested ESP8266 in similar scenario? Do I miss something in configuration?
ESP8266 is all about Wi-Fi and I would like to set Fire2012 parameters (brightness, cooling and sparking) wirelessly.

I do not observe flickering for Fire2012.ino sketch when implemented with Adafruit_NeoPixel and NeoPixelBus libraries.

Here are my test sketches:
• EspNeoPixelBus
• EspAdafruit_NeoPixel
• EspFastLED

I really appreciate mature, feature rich and well documented code of FastLED and looking how to use it directly with ESP8266 without patching it with additional code.

Krzysztof

Activity

  1. msurguy commented on May 17, 2016

    @msurguy

    Try adding FastLED.delay(1000 / FRAMES_PER_SECOND); under this line https://github.com/krzychb/EspFire2012/blob/master/EspFastLED/Fire.ino#L109 instead of doing manual delay via millis.

  2. focalintent commented on May 17, 2016

    @focalintent
    Contributor

    @msurguy the problem with that is it then blocks the handling of wifi responses in a timely fashion.

    @krzychb - what happens if you add #define FASTLED_ALLOW_INTERRUPTS 0 to the line immediately before you have #include <FastLED.h> - FastLED is different from the other libraries in that it allows interrupts to fire while processing WS2812 leds - however, if an interrupt takes too long to run, then it has to stop writing out the current flame.

    Out of curiosity - where are you seeing flickering - is it at the beginning of the strip, the end of the strip, or across the entire strip?

    (Note: I just ran an installation using esp8266's with 150 led tm1809 (similar timing issues as ws2812) with wifi on with no problems - and i was using wifi as both a heartbeat sync and to broadcast OSC data to nearly a dozen esp8266's).

  3. krzychb commented on May 18, 2016

    @krzychb
    Author

    Thanks, @focalintent!

    Sure enough, adding #define FASTLED_ALLOW_INTERRUPTS 0 resolved the issue 😄 👍
    Flickering occurred towards the end of the strip - plese see this video

    Thank you again for quick help 👍

    Krzysztof

  4. added a commit that references this issue on May 18, 2016
  5. Lightning303 commented on May 18, 2016

    @Lightning303

    Seems like same issue as i had. Just a heads up. Not allowing interrupts will result in watchdog resets. On my project, roughly 1 reset every 5-10 minutes.

  6. focalintent commented on May 18, 2016

    @focalintent
    Contributor

    Ok - yeah, what's happening here is the interrupts firing are cutting off the writing out of the frame data.

    If you're hitting watchdog resets, grab the latest version of the code and try re-allowing interrupts - I did some timing adjustments on the retries (and upped the number of retry attempts).

  7. krzychb commented on May 27, 2016

    @krzychb
    Author

    @Lightning303,

    I just run about 100 min testing of Fire2012 on ESP8266 with simple web server enabled (to set up fire simulation parameters) using latest FastLED code from GitHub - 1b546b3

    I am happy to confirm that I do not see any watchdog resets.

  8. TheAustrian commented on May 27, 2016

    @TheAustrian

    @krzychb You might want to let it run over night to be on the safe side, i had wdt resets after about 12 to 36 hours with bitbanging and wifi but haven't tried the latest version yet.

  9. Lightning303 commented on May 27, 2016

    @Lightning303

    I will definitely give the latest changes a try when i find some time. However you have to take into consideration that there might be a difference between having a webserver idling and a project where there is constant traffic. In mine i send 8 byte packages to my esp 24-60 times a second.

  10. krzychb commented on May 27, 2016

    @krzychb
    Author

    @TheAustrian
    This is very good point 😄
    I have just set up a channel on ThingSpeak to monitor EspFastLed up time
    Let's see if it will cut the mustard.

    @Lightning303
    My application is simple.
    The more code and traffic, the more effort is required for successful debugging and stress testing.
    I believe you will soon nail down the issue and identify the root cause!
    Good luck 👍

  11. pi-ratte commented on May 28, 2016

    @pi-ratte

    I just tested the latest github and it looks like the interupts are causing flickering for me.
    My setup is im sending artnet to the ESP8266 (huzzah).
    if i do a RGB walk over the leds:
    interupts enabled = the leds behind the one lighting up flicker. so as the RGB walk runs the flickers get less as the walk gets to the end.
    interupts disabled = no flicker, im yield()'ing right before and after FastLED.show() was running for an hour will test some more. And only calling show() when there is actually new LED info. (640 Leds configured)

  12. pi-ratte commented on May 28, 2016

    @pi-ratte

    Ohh forgot to wrote im using WS2812B leds.. also without interupts it reset on me :( .
    with interupts on i noticed if making fat white/black bars, it flickers white bars the same size down the line. nut zust random colors.
    if i set #define FASTLED_INTERRUPT_RETRY_COUNT 0
    the flicker is gone.

  13. 56 remaining items

  14. marmilicious commented on May 2, 2019

    @marmilicious
    Contributor

    @tonys0 Glad you kept messing with it and thank you for sharing what worked for you. Good stuff.

  15. tonys0 commented on May 2, 2019

    @tonys0

    Hi @marmilicious, "messing" is the right word for it. No documentation on ESP8266 circuit and firmware and no documentation on WS8212 real schematics and electrical specifications. And if exists, it does not make sense (except maybe for some Chinese of course). To this, I must add usual Murphys law (secretly broken jumpers, missing groundings, things suddenly starting/stopping to work just by connecting the osciloscope probe, the GND level shift with USB - serial device etc.) The most frustrating thing was, that when it sometimes worked with one sketch it did not with another. I could never rely on it.
    It is, of course, a little mess to have to add an extra custom routine with a few pre-requisites instead of FastLED.show, but it's worth it. Maybe some "nice guys" will eventually wrap it in a small Glediator library, because I am not that GIT-clever. After all, the pulse control of WS8212 is designed for short wires, while the serial (RS232) is for long wires (start, stop and parity bit if you want) which could be handy setting up a real control scenario for LED-matrix. Sooner or later you will need to connect your PC to it and run a real thing generated by a powerful CPU.

  16. tonys0 commented on May 2, 2019

    @tonys0

    By the way - has someone here tested the ESPixelStick ???

  17. Makuna commented on May 2, 2019

    @Makuna

    I am going to just clear up a general comment made here. Esp8266 is able to sustain a solid signal for ws2812 (compatible) but you must use hardware features to do so; just like on the esp32 (and a lot of ARM chips as well). The issue for esp8266 is that there are only two hardware methods, i2s and uart, and each is tied to specific pins (there is no pin muxer); giving you a total of only three channels (i2s, uart0 an uart1) possible if you give up on serial support completely. NeoPixelBus supports all these as asynchronous sends.

    The number of LEDs is a memory and time constraint (the comm protocol takes time to send thus long strips will have lower update frequency).

    The FastLEds use of RMT hardware on esp32 allows it to split the update across multiple bus and increase the update frequency.

    And yes, having long lead wires between the uC and the first LED can be a problem, especially on a 3.3v uC when the LED expects a 5v signal.

  18. tonys0 commented on May 2, 2019

    @tonys0

    Hi Michael @Makuna.
    You should only know, how much I tried to use the NeoPixelBus library of yours - a genious work. But I gave up upon that too - and so did many others - there are followers with other libraries. Why would so many people struggle with different approaches to solve such a simple issue, if it was reliable from the beginning? It should be implemented in the FastLED and Adafruit NeoPixel long time ago.

    But I am really happy to have the opportunity to get in touch with you, great man. Can you suggest to me, how do I solve the conversion from Glediator protocol (USB serial) to the WS8212B with an ESP-01 ? Where do I find the document saying that the DMA is not on ESP-01 ? Can I use the TX1 for UART1 output (IO2) method while using RXD for serial input? What do you mean by "asynchronous UART" method opposed to "normal UART" method? Isn't UART asynchronous by definition?
    When using ESP-32 two cores. Both cores use the same I/O HW right? How are the interrupts treated? Will one core take care of the interrupts, while the other works uninterrupted? Why do I have to make the core 0 busy with some dummy I/O to prevent reboot?
    Sorry for all these questions, that may not belong right here. I was just caught by the chance to ask you.

  19. tonys0 commented on May 2, 2019

    @tonys0

    Can anyone reopen this "Closed" thread, since it is obviously visited and the issue is not solved ?

  20. focalintent commented on May 2, 2019

    @focalintent
    Contributor

    For what it's worth I have done multiple installations with ESP8266's and ~150 WS2812 leds using wifi for communication/synchronization and no flickering issues (I almost always use level shifters, and power injection and such) -- including one that had ~32 esp8266's sharing a wifi network for synchronization/communication - and this is with using the stock FastLED software - so this isn't a constant issue - and I think it's an issue of wider hardware/software/wiring/power/etc... and beyond the scope of a FastLED issue to be fixed at just the library level.

  21. focalintent commented on May 2, 2019

    @focalintent
    Contributor

    That said - where I see people run into major problems is where they are effectively using FastLED as a frame buffer, where they are pushing full frames of LED data over wireless or serial (or less frequently, ethernet) - and this is decidedly a mode of use that is not a priority for FastLED development - my focus and interest has almost always been for on-device generation of animation and LED data (in my own installations, I use wifi for sync and command and control - I'm not slinging full frames around). For situations where folks just want a frame buffer that's driven by computer, there are dedicated solutions that are designed just for that (pixel pusher, fade candy), and I will admit that it is not a style of use I've ever prioritized for FastLED.

  22. tonys0 commented on May 2, 2019

    @tonys0

    Hi Daniel @focalintent and welcome to the closed thread.
    150 LEDs is hardly a decent matrix. If you don't send frames, then you probably have them recorded on SD card as notoriously repeating ads or some other dead content. I am using a 32 x 16 matrix and I want to build another one just for more space for complex graphics. My interest for LEDs started with watching LED-cubes, but I soon realized that no matter how big (read: expensive) cube I build, I would want bigger. So I built it in VR in Unity with the size (LED count) as a parameter. And yes, I can roll the cube in 3D space while running the light show in it.
    Later I was impressed by the people doing this: https://www.youtube.com/watch?v=E8Ecz_sntDo and I was curious, how could so many elements be individually controlled with almost no wires. The intelligent LED-stripes with one-wire control was the answer.
    Recently I am impressed by the Glediator and Jinx! software (Jinx! for the possibility to create images and effects with its simple script language). Unfortunately, both seem to be abandonware today. I really want to play with the light show effects and not spend long nights tweaking the hardware to work without flickering.
    You see, I don't know much, so I am trying to find my way experimenting by myself and listening to other peoples problems. And on this thread, you can see quite a few of them. When the uC is randomly rebooting, it is a disaster that I cannot accept. You don't want to have randomly rebooting webs, do you? I am not going to make statistics on reboots and be happy, when they are only twice a night. That would be probably acceptable in China. But I want things to work and rely on them, so I can sleep.
    With that said - I am going to use the Glediator protocol until the day someone tells me there is a reliable (and cheap enough) device programmable in Arduino IDE for WS8212 control.

  23. focalintent commented on May 3, 2019

    @focalintent
    Contributor

    If you don't send frames, then you probably have them recorded on SD card as notoriously repeating ads or some other dead content.

    Wrong, on so many accounts. Everything I build runs dynamically generated and responsive animations on MCU. If I'm using the wifi connection for anything, it's for synchronization/high level control across multiple devices.

    If what you want is to send frames from a computer for display on a cube or a matrix then FastLED is the wrong platform to be using. You should be using pixel pusher, fade candy, octows2811, or a setup similar what you've stumbled onto with gladiator. This is a use case that I have repeatedly made the conscious, explicit decision to not focus on supporting with FastLED.

    And on this thread, you can see quite a few of them. When the uC is randomly rebooting, it is a disaster that I cannot accept. You don't want to have randomly rebooting webs, do you?

    And the reboot cycling is setup/code/environment specific (and there have been fixes added in the two years since this was opened that mitigated the ones that can be at the FastLED level) - my esp8266 projects only reboot when I hit the reset button (or flash new code to them).

  24. tonys0 commented on May 3, 2019

    @tonys0

    I can reliably drive an 800 led strip with NeoPixelBus and output 30 frames per second.

    Hi, can you describe your situation in more detail? How do you feed the pixel-data to the ESP8266 or is the pixel-data generated from the ESP8266? Do you use WiFi or serial communication? Which method do you use for NeoPixelBus? How is the physical connection between the ESP8266 and WS8212 ?
    Thank you.

  25. Makuna commented on May 3, 2019

    @Makuna

    following on to what @focalintent stated I have focused NeoPixelBus to support updating even with WiFi, I have limitiation due to it, but it will work without crashing.

    I will link to my Wiki for esp8266 specifics and I will discontinue on the topic here.

    You can chat on the NeoPixelBus gitter channel if you have questions about it.

  26. tonys0 commented on May 4, 2019

    @tonys0

    Hi Daniel,
    I have to apologize to you. As a stupid newbie, I did not know, that you are the father of the ingenious FastLED, which is by many people preferred for driving LED-strips before NeoPixel library. So for what it's worth, you have my full respect and admiration.
    You see for a newbie it is difficult to see what a class can offer. He starts with some fancy examples and uses the properties and methods from the example. For me, it is still a mystery, where all the properties and methods are documented for a human (I am not capable to understand them reading the C-code). Next thing to expect would be a list of limitations and recommendations on how to use it, what to use it for and what not. I know, programmers hate to create documentation which is soon obsolete, when they change the program. But it would save millions of people (your supporters) time and disappointment.
    Or am I missing it, just because I don't know, where to find it?

    I can respect your conscious, explicit decision not to prioritize "slinging full frames around". Just tell me, how do you create an animation with 32 devices, that (I suppose) display one complete picture, without sending at least parts of the frame around? I can see, that the power of FastLED is in creating animation in the device. But there must be a way to send the displayed objects between the devices...(?)

    Your personal preference not to sling full frames around should not prevent you from using the hardware in devices, that are offering DMA. Believe me, there are many people, who would appreciate having a solution like NeoPixelBus integrated into FastLED. Even if you like "banging" there are certainly other useful tasks for the CPU that can be performed, while the hardware takes care of sending the pixels to the strip uninterrupted. Why don't you join your forces and experiences with Michael instead of trying to convince each other about the advantages and limitations of each other's work? Isn't that what Github is for?

    Another thing. ESP8266 is a risc processor, isn't it. What I do not see is how are the principles of risc processor applied in the code. You still write
    for (i = 0; i < n; i++) a[i] += 5;
    instead of
    apply a[i] += 5 to following amount of consecutive bytes, pixels etc.
    or does the C-compiler take care of it?

  27. CRCinAU commented on Apr 2, 2020

    @CRCinAU

    So yeah - this is still happening - now I'm only on 46 LEDs and get resets even when all LEDs are off...

    Has there been any progress / consensus on solving this as yet?

  28. joysfera commented on Nov 22, 2020

    @joysfera

    Release 3.3.3 - flickering with interrupts enabled, watchdog resets within minutes if interrupts disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions