Why won't this NeoPixel bar work with ESP8266

Hi,

I’m having some issues driving a Neopixels LED bar (8 WS2812 LED’s) using a NodeMCU 1.0 with an on-board ESP8266 module. The example code I’m using to test the bar is:

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

#include <Adafruit_NeoPixel.h>
#define PIN            6

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      8

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 500; // delay for half a second

void setup() {
  pixels.begin(); // This initializes the NeoPixel library.
}

void loop() {

  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.

  for(int i=0;i<NUMPIXELS;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,255,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).

  }
}
  • The LED bar works with another Arduino board with this sketch
  • The ESP8266 configured to run with the Arduino IDE also works separately
  • The current draw seems to be relatively small since only 8 LED’s (worked fine with Arduino Nano)

Am I missing something here? Any ideas would be helpful.

I think you need the latest version or a special version of the Adafruit library to make ESP work with Neopixels. Try downloading the library from github again.

Also are you definitely using the right pin? Have you tried other pins?

I have had neopixels working with Wemos d1 minis, which are also based on ESP-12.

Paul

I've downloaded the latest version of the library and tried pins 1, 2 and 6 as data lines. Could it possibly have something to do with timing issues or should the Neopixel library take care of that?

Would I need to perhaps re-install the bootloader on the ESP8266?

fghfghdfghtrdhdtrf: Could it possibly have something to do with timing issues or should the Neopixel library take care of that?

It could be timing, who knows? Yes the library should take care of it.

fghfghdfghtrdhdtrf: Would I need to perhaps re-install the bootloader on the ESP8266?

I don't think that's possible.

How are you powering the circuit? Can you get any light out of the leds if you use single/dim colours?

I have tried powering the LED's externally using a 5V power supply to no avail. I checked the output pin on my DSO and there was no signal whatsoever (just a constant pulled high level).

As far as I can tell, the ESP8266 board seems to function fine otherwise.

You have:-

#define PIN            6

Are you sure that this pin is available?
You have to use the GPIO numbers not the D numbers. Have you tried blinking an LED to confirm your pin numbers are correct?

Node Pinout.png