Hey guys I have a quick question. I recently bought a ws2812b strip.

(João Valente) #1

Hey guys I have a quick question. I recently bought a ws2812b strip. I firstly tested it with an Arduino and everything worked fine but I really want to control it with an ESP32. The problems appeared when I tried the ESP32.
My strip has 300 leds but I want to control only 90. But when I define the NUM_LEDS 90 somehow more than 90 LEDs turn on. Can’t understand why.
Thanks! And a great year everyone!

(Marc MERLIN) #2

You need to share your code, no way we can help without that.
Please put it on github, or at least https://gist.github.com or pastebin if needed.

(João Valente) #3

@Marc_MERLIN the code I used was the DemoReelESP32. The only thing I changed was the value of NUM_LEDS to 90.

(Marc MERLIN) #4

@Joao_Valente you still need to post links. Where did you get it from? Which ESP32 FastLED library are you using? (there at least 3) . For further reading, see http://www.catb.org/esr/faqs/smart-questions.html

(Patrick Aversenq) #5

Hi, did you have an external power supply?

(Marc MERLIN) #6

@Joao_Valente now I just see again “somehow more than 90 less turn on.” Did fewer than 90 light up? Please restate the sentence.

(João Valente) #7

@Patrick_Aversenq Yes. I tried with a 5V-1A power supply and without it (powered by the ESP). Same results in both scenarios.

(João Valente) #8

@Marc_MERLIN Sorry, didn’t notice the mistake. Just fixed it. “Somehow more than 90 LEDs turn on”.
I experimented some more things and I realised that what is happening is that the ESP is considering that the strip has two start LEDs because If I change a bit the code just to light up the first LED, it turns on the first LED and the LED number 91 at the same time. Don’t know if I’m explaining myself clearly.

(João Valente) #9

@Marc_MERLIN and I’m sorry if I am not posting all the info, it is my first time posting something like this, because it is the first time I don’t anything that can help me on the Internet…

(Marc MERLIN) #10

@Joao_Valente I’ve never seen this and I use ESP32. Again, please post the exact code what you’re compiling as well as the arduino compile output that shows which ESP32 FastLED library you are using. There are 3 drivers they don’t work the same and they have different bugs.

(João Valente) #11

@Marc_MERLIN So this is the code I made to understand what was going on.

#include “FastLED.h”

#define DATA_PIN 12
#define LED_TYPE WS2812B
#define NUM_LEDS 90
#define BRIGHTNESS 60


static TaskHandle_t FastLEDshowTaskHandle = 0;
static TaskHandle_t userTaskHandle = 0;

uint8_t gHue = 0;

////// Setup //////
void setup() {
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds,NUM_LEDS).setCorrection(TypicalLEDStrip);

xTaskCreatePinnedToCore(FastLEDshowTask, “FastLEDshowTask”, 2048, NULL, 2, &FastLEDshowTaskHandle, FASTLED_SHOW_CORE);

void loop() {
for (int i = 0; i < NUM_LEDS; i++){
leds[i] = CRGB::Blue;


void FastLEDshowESP32()
if (userTaskHandle == 0) {
// – Store the handle of the current task, so that the show task can
// notify it when it’s done
userTaskHandle = xTaskGetCurrentTaskHandle();

    // -- Trigger the show task

    // -- Wait to be notified that it's done
    const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 );
    ulTaskNotifyTake(pdTRUE, xMaxBlockTime);
    userTaskHandle = 0;


void FastLEDshowTask(void *pvParameters)
// – Run forever…
for(;:wink: {
// – Wait for the trigger
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);

    // -- Do the show (synchronously)

    // -- Notify the calling task


(João Valente) #12

This is what happens missing/deleted image from Google+

(Marc MERLIN) #13

@Joao_Valente code is one half, second half is still “which FastLED library are you using?” Where did you get it from? Did you check in your compile logs that you are using the one you meant to use (in case you have more than one)

(João Valente) #14

@Marc_MERLIN this is the library that I used.

and I honestly don’t know how to see if I am using the right one…

(Marc MERLIN) #15

@Joao_Valente ok, thanks. So, you are not using Yves’ code which is the only one that requires the complicated ESP32 code you pasted (FastLEDshowESP32 and showtask).
Try removing all of this and just defining your single strip like you would for another CPU (not ESP32). Remove everything ESP32 specific.
Hopefully that should just work.

(João Valente) #16

@Marc_MERLIN omg it works! Thanks a lot! :grin:

(Marc MERLIN) #17

@Joao_Valente great.
I’m assuming you used https://github.com/FastLED/FastLED/tree/master/examples/DemoReelESP32 ?
@Sam_Guyer / @Daniel_Garcia looks like that example ought to be removed now that ESP32 in master does not require this complicated code, which in this case even seems to be negative.
I now see that you opened https://github.com/FastLED/FastLED/issues/711 FYI you should not open an issue to ask for help. It’s only if you’re pretty sure there is a bug that isn’t your fault.

(Marc MERLIN) #18

@Joao_Valente however in your first bug report message, you didn’t state which test code you were using. Did you use DemoReelESP32 all along, or were you using something else then?

(João Valente) #19

@Marc_MERLIN sorry… I didn’t knew that. Yes I used the DemoRellESP32 from the FastLED in the first time I tried in the ESP32

(Marc MERLIN) #20

@Joao_Valente thanks for confirming. This is not something you should have known. I think this example should be removed. Thanks for confirming.