Wi-Fi Acces Point + FastLED = Impossible ?

vivi32
Posts: 3
Joined: Sun Sep 20, 2020 8:34 pm

Wi-Fi Acces Point + FastLED = Impossible ?

Postby vivi32 » Sun Sep 20, 2020 9:10 pm

Hello, i`m new on ESP32 and i start to write project with esp32 + AP + WS2811 LED stripe
I`m do it many times, with esp8266, nano, mega, etc.... and all was ok
But with ESP32 when i`m add just one line with AP initialization - LEDS go to flickering.
Whole of day i tried several ways to fix it like some defines, multicore, different leds libraries and forks.... but no result
Please help me, i just dont know where to find answer for now.
Thank you & sorry for my english!

IDE: Arduino IDE
Board: WEMOS D1 ESP-WROOM-32
ESP32 Core: 1.0.4
FastLED: 3.3.3


Minimal code to get flickering:

Code: Select all

#include "WiFi.h"
#include "FastLED.h"


#define DATA_PIN 22
#define LEDS_COUNT 24
#define LEDS_BRIGHT 42
#define MODULE_SSID "TEST_SSID"
#define MODULE_PASS "testpassword"

struct CRGB OLED_1[LEDS_COUNT];


void setup() {
  Serial.begin(115200); 
  
  LEDS.addLeds<WS2811, DATA_PIN, GRB>(OLED_1, LEDS_COUNT).setCorrection(TypicalLEDStrip);
  LEDS.setBrightness(LEDS_BRIGHT);

  xTaskCreatePinnedToCore(LedsTask, "LedsTask", 10000, NULL, 1, NULL,  0);

  // ALL LEDS WORKS PERFECT WHEN LINE BELOW IS COMMENTED
  if(!WiFi.softAP(MODULE_SSID, MODULE_PASS)){Serial.println("INIT AP: FAILED");}
}


void loop() {
  Serial.print("Message from core #"); Serial.println(xPortGetCoreID());
  delay(4000);
}


void LedsTask( void * pvParameters ){
  static int color = 0;
  for(;;){
    Serial.print("Message from core #"); Serial.println(xPortGetCoreID());
    for (int i=0;i<LEDS_COUNT;i++){
      OLED_1[i].setHSV(color, 255, 255); 
      LEDS.show(); delay(50);
    }

    color = color + 32 >= 255 ? 0 : color + 32;
    delay(100);
  } 
}

BatsIhor
Posts: 1
Joined: Fri Oct 02, 2020 2:12 pm

Re: Wi-Fi Acces Point + FastLED = Impossible ?

Postby BatsIhor » Fri Oct 02, 2020 2:35 pm

Hey,

I have the same problem and it's not easy to fix if possible at all but as of today I used FastLED, NeoPixel, NeoPixelBus libraries and all of them flicker.
What I partially tried is running on separate core but have to work on it a bit more as it just partially removed flickering I still have it from time to time.

Also I found this projects on github that claim to be working on ESP32:
https://github.com/CalinRadoni/ESP32DLEDController
https://github.com/PerMalmberg/Smooth/b ... RGBLed.cpp
https://github.com/kitesurfer1404/WS281 ... _esp32.ino

So that is something I'm going to check next.

letmeout
Posts: 4
Joined: Tue Oct 13, 2020 1:10 am

Re: Wi-Fi Acces Point + FastLED = Impossible ?

Postby letmeout » Sun Nov 01, 2020 12:46 am

It is always helpful if you include error messages. Maybe you saw in the serial monitor something like
***ERROR*** A stack overflow in task another Task has been detected.
abort() was called at PC 0x4008c67c on core 0
Backtrace: 0x4008c434:0x3ffb81d0 0x4008c665:0x3ffb81f0 0x4008c67c:0x3ffb8210 0x40089748:0x3ffb8230 0x4008b3ac:0x3ffb8250 0x4008b362:0xffffffff
Rebooting...

With only "... with AP initialization - LEDS go to flickering."
I have to guess the flickering LEDs were due to repeating reboots.
Here's an example of the reset reason line, near the top of the boot message:
"rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)"

Looks like you have LedsTask() set to run on core 0.
Radio (used by Wifi & BLE) runs on core 0.
Radio gets a priority higher than user defined tasks on either core.

If the radio is being used, we have to move our tasks to core 1.
You can find xTaskCreatePinnedToCore and other task function definitions at https://docs.espressif.com/projects/esp ... l#task-api
If your esp32 chip is dual core, you have to edit the following line to run your task on core 1.

Code: Select all

xTaskCreatePinnedToCore(LedsTask, "LedsTask", 10000, NULL, 1, NULL,  0);
Also, inside your task, delay() blocks (nearly stops) the processor from doing other work.
Use vTaskDelay, a non-blocking method, to delay only the task, not the processor.

Code: Select all

vTaskDelay(my_global_delay_millis / portTICK_PERIOD_MS);
Caveat: Not tested; I don't have FastLED.
Related: viewtopic.php?t=3689

vivi32
Posts: 3
Joined: Sun Sep 20, 2020 8:34 pm

Re: Wi-Fi Acces Point + FastLED = Impossible ?

Postby vivi32 » Mon Nov 09, 2020 6:00 pm

It was no any errors at all.
All is work fine, no reboots, no any errors.
Only flickering when AP is initialized.

Flickering means for example: In animation process sometimes fired random leds with random color (not so many, in average: 2-3 at second)

vivi32
Posts: 3
Joined: Sun Sep 20, 2020 8:34 pm

Re: Wi-Fi Acces Point + FastLED = Impossible ?

Postby vivi32 » Mon Nov 09, 2020 6:07 pm

Also i`m tried many ways to do with that.
Incluides different cores & no delay.
Only after that i come here & make a topic.

zhelico
Posts: 1
Joined: Fri Apr 02, 2021 5:37 pm

Re: Wi-Fi Acces Point + FastLED = Impossible ?

Postby zhelico » Fri Apr 02, 2021 5:45 pm

Hi vivi32,

I'm facing same issue as yours ... I'm wondering if the problem is coming from the Wemos mini D1 board ...

Same config as yours, no error no rebooting but as soon as I uncomment WiFi.begin() with Fastled i get in trouble...

Did you found a solution ?

The same code is working perfectly with other ESP-WROOM-32 board !!

Who is online

Users browsing this forum: No registered users and 19 guests