Using FastLED with an ESP32 and APA102 - so I saw this issue:

Using FastLED with an ESP32 and APA102 - so I saw this issue: ESP32 + FastLED · Issue #504 · FastLED/FastLED · GitHub. And, if I’m reading it correctly, it’s saying that it will work now. However, running the basic “Blink” sketch and nothing happens.

The number of LEDs and Pins are set to:
#define NUM_LEDS 180
#define DATA_PIN 23
#define CLOCK_PIN 22 /

And modified setup:
void setup() {

FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
}

The configuration’s been tested with the following library and it does make the light blink and walk - so presumably it’s hooked up correctly: espressif/ESP32_APA102.ino at master · pcbreflux/espressif · GitHub

Maybe there’s an example which is known to work?

#define DATA_PIN 16
#define CLK_PIN 17
#define DATA_PIN_2 12
#define CLK_PIN_2 13
#define LED_TYPE SK9822
#define COLOR_ORDER BGR
#define NUM_LEDS 28

FastLED.addLeds<LED_TYPE, DATA_PIN, CLK_PIN, COLOR_ORDER, DATA_RATE_MHZ(12)>(LedsLeft, NUM_LEDS);
FastLED.addLeds<LED_TYPE, DATA_PIN_2, CLK_PIN_2, COLOR_ORDER, DATA_RATE_MHZ(12)>(LedsRight, NUM_LEDS);

This works fine on an ESP32 with SK9822s which are very very similar to APA102Cs. I’m using the “WeMos” WiFiBluetooth Battery (18650) board. You shouldn’t need level shifters or resistors.

@Jeremy_Spencer - thanks!
Well, I must be an idiot because I’ve tried a number of things including different boards (ESP32 & ESP32-NodeMCU), different pins, changing the order, moving pins, different data rates, etc. Unfortunately, none of the LEDS appear to do anything - FastLED with an ESP32 and APA102s.

Here’s the code I’m using. I wonder if I’m doing something wrong?

#define DATA_PIN 16
#define CLK_PIN 17
#define LED_TYPE APA102
#define COLOR_ORDER BGR // RGB, BGR
#define NUM_LEDS 64

#define BRIGHTNESS 30

CRGB leds[NUM_LEDS];

void setup() {
// FastLED.addLeds<LED_TYPE, DATA_PIN, CLK_PIN>(leds, NUM_LEDS);
FastLED.addLeds<LED_TYPE, DATA_PIN, CLK_PIN, COLOR_ORDER, DATA_RATE_MHZ(12)>(leds, NUM_LEDS);

FastLED.setBrightness(BRIGHTNESS);
fill_solid(leds, NUM_LEDS, CRGB::Blue);
FastLED.show();
}

void loop() {
fill_solid(leds, NUM_LEDS, CRGB::Blue);
FastLED.show();
delay(300);
Serial.begin(115200);

for(int dot = 0; dot < NUM_LEDS; dot++) {
Serial.print(“x”);
leds[dot] = CRGB::Blue;
FastLED.show();
// clear this led for the next time around the loop
leds[dot] = CRGB::Black;
delay(30);
}
}

Your code is a little confused, start with the demo reel 100 example sketch and a data rate of 1 MHz. Then when it works speed up the the data.

Please also post code via gist.

@Mr_Nvr you have Serial.begin() inside the Loop () functiom rhis should be in setup ()

@Leon_Yuhanov - Thanks - moved the Serial.begin to setup()!

@Jeremy_Spencer - Created two GISTS - both with a data rate of 1 MHz. The first is the “Moving an LED” example in the Wiki (https://github.com/FastLED/FastLED/wiki/Basic-usage#moving-an-led). The second is the DemoReel100. Unfortunately, neither works yet.

  1. “Moving an LED”: https://gist.github.com/Mr-NVR/742fbaceb5c28d7ad73844e10096f175

  2. DemoReel100: https://gist.github.com/Mr-NVR/63353e71632c0626bdf88f3cb0f81dc4

Thanks, I’ll try them with one of my ESP32s tomorrow. I’ll let you know how I get on.

Which ESP32 board are you using?

Which version of the ESP32 core are you using?

Which version of the Arduno IDE are you using?

Which version of FastLED are you using?

And, what operating system are you running on your computer?

Sorry for all of the questions :wink:

@Jeremy_Spencer - appreciate the help!

Which ESP32 board are you using?
I’ve got two:

  1. NodeMCU ESP-32S
  2. ESP32-DEVKITC

Which version of the ESP32 core are you using?

  1. The NodeMCU ESP-32S core is labeled: “ESP-WROOM-32”, “CE1313”, “211-161007”, “FCC ID :2AC7Z-ESPWROOM32”
  2. ESP32-DEVKITC core is labeled just: “ESP-WROOM-32” - although the description on the back of the board says “ESP32_Core_board_V2”

Which version of the Arduno IDE are you using?
1.8.5

Which version of FastLED are you using?
3.1.6

And, what operating system are you running on your computer?
MacOS High Sierra

BTW, the ArduinoIDE is configured:

  • Board: “NodeMCU-32S”
  • Flash Frequency: “80MHz”
  • Upload Speed: “921600”
  • Port: “/dev/cu.SLAB_USBtoUART”
  • Programmer: “AVRISP mkII”

Actually, looks like both boards have the V0 Silicon - running ESP_Version returns:
REG_READ(EFUSE_BLK0_RDATA3_REG) 0
EFUSE_RD_CHIP_VER_RESERVE_S 1100
EFUSE_RD_CHIP_VER_RESERVE_V 111

Chip Revision (official version): 0
Chip Revision from shift Opration 0

That’s very strange, both sketches work fine for me on an ESP32 “WeMos” WiFi&BluetoothBattery… I’m also using IDE v 1.8.5 and FastLED 3.1.6 and my chips are Rev0
Try downloading the latest ESP32 core https://github.com/espressif/arduino-esp32

Super strange. Downloaded the latest ESP32 core and installed it per the instructions at arduino-esp32/mac.md at master · espressif/arduino-esp32 · GitHub.

Ran sketch_dec03a.ino and got nothing (although LEDs 5 and 7 did turn on when the sketch first ran). Also connected to the Serial Monitor and it is sending “xxxxxxxxxxx…”

Also re-ran DemoReel100 and also got nothing.

BTW, created a another gist that does work with my setup using other library I mentioned: (GitHub - pololu/apa102-arduino: Pololu Arduino library for APA102 addressable RGB LEDs http://www.pololu.com/category/178/) - pololu-apa102 test for ESP32 APA102 loosely based on https://github.com/pololu/apa102-arduino rainbow example · GitHub

Thanks again for your help.

Just installed the Arduino IDE on a Windows 7 laptop, along with the ESP core and USB Drivers. Opened DemoReel100, added ‘Serial.begin(115200);’ to setup and ‘Serial.print(“x”);’ to loop.

Same result - the Serial Monitor shows that xxxxxx… is being printed, but the led strip remains unchanged.

I know it shouldn’t make amy difference, but try swapping the data and clock pin numbers, not the wires…

I’ll also try a different ESP32 board tomorrow.

@Jeremy_Spencer OK, tried swapping just the numbers, but unfortunately, that didn’t work either.

I also ordered another ESP32 which arrive today and that I’d hoped would have the Rev1 silicon. Unfortunately, when I checked it, it actually had Rev0 - even though the picture/description said it was Rev1 on Amazon (Seller Espressif although it’s actually “Olimex Ltd”)

This project seems jinx’d - but I’ve ordered a couple Arduino Nano’s that should be here tomorrow.

My ESP32s are all rev0, I don’t think that’s the problem. But I’ve no idea what the problem actually is…

@Jeremy_Spencer
Received the Arduino Nanos today, soldered the pins in, wired it up, ran DemoReel100 and … it ran the 1st time. Perfectly!

Which is both great and frustrating at the same time, haha.

It would be great to hav a picture of a working setup - especially the wires connecting the ESP32 to the LED Strip. Maybe I’m doing something boneheaded?

Also, I wonder if you participated in the initial testing that went on with the ESP32 if it’s possible you could have a remnant from that testing - maybe additional/different file than what I have locally?

I have just recieved and ESp32 i will try