Arduino Nano ESP32 control WS2815 led strip

Hi everyone,
I’m trying to get a WS2815 LED strip working with an Arduino Nano ESP32, but I can’t get it to light up.
The strange thing is that with an Arduino UNO, using the exact same circuit and sketch, everything works perfectly.

Here’s my setup:

  • The WS2815 LED strip is powered by 12 V.
  • I’m using a DC-DC converter to step down to 5 V, which powers both the Arduino Nano ESP32 and a SN74AHCT125N buffer.
  • The data signal goes from pin 2 of the Arduino through the buffer (to shift from 3.3 V to 5 V) and then to the D pin of the WS2815 strip.
  • All GNDs (Arduino, DC-DC converter, LED strip, and buffer) are connected together.
  • I’m using the FastLED library.
  • I tested the buffer: when I apply a fixed 3.3 V input, I get 5 V output, so the level shifting seems to be working correctly.

The problem is that when I upload the sketch to the Nano ESP32, the LEDs stay completely off.
With the Arduino UNO, the exact same code and wiring work perfectly.

I also noticed that during the compilation and upload process in the Arduino IDE, it shows “Done uploading”, but I suspect the code might not be running correctly on the ESP32, or the compilation may not be fully compatible.

I’ll attach:

  • the full sketch,
  • a screenshot of the Arduino IDE right after uploading,
  • and a photo of the circuit.

Has anyone experienced something similar with the WS2815 and Nano ESP32?
Could it be a timing issue, a FastLED configuration problem, or maybe an incompatible data pin on the ESP32?

My Code

#include <FastLED.h>

#define NUM_LEDS 79
#define DATA_PIN 2

CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2815, DATA_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(180);
}

void loop() {
  fill_solid(leds, NUM_LEDS, CRGB::Red);
  FastLED.show();
  delay(1000);

  fill_solid(leds, NUM_LEDS, CRGB::Blue);
  FastLED.show();
  delay(1000);

  fill_solid(leds, NUM_LEDS, CRGB::Green);
  FastLED.show();
  delay(1000);
}

IDE Screenshot

Arduino Nano ESP32 Circuit

Arduino UNO Circuit

Hi @tonnosupremo. Try this:

  1. Change the following line of your sketch: to this:
    #define DATA_PIN D2
    
  2. Select Tools > Pin Numbering > By GPIO number (legacy) from the Arduino IDE menus.
  3. Upload the sketch to the board again, as usual.

Hopefully the LEDs will work as expected after doing that.

The reason you may sometimes feel the need to use the Nano ESP32 board in this Pin Numbering > By GPIO number (legacy) configuration is due to a quirk of how Arduino pin mapping is done by the ESP32 Arduino core. Although all the standard Arduino core functions work fine in the default Tools > Pin Numbering > By Arduino pin (default) configuration, some libraries are written in a way that expects any ESP32-based board to use the other configuration, and so will only work with the Nano ESP32 board as such.

1 Like

Wow, thank you so much @ptillisch!

That fixed it instantly! It's working perfectly now.

I changed the pin definition to D2 and set the Tools > Pin Numbering > By GPIO number (legacy) just like you said, and the strip lit up immediately.

I really appreciate the help and the clear explanation of why it was happening!

You are welcome. I'm glad it is working now.

Regards, Per