2

I'm trying to power some WS2812 LEDs from my ESP8266 ESP-12E NodeMCU board (circuit here). I'm simply trying to use the NeoPixel Strandtest which works perfectly on my Arduino UNO with the same LED strip, but when I change the #define pin 6 to #define pin D4 (or 12 as GPIO) only the first LED lights up and it's green. I did throw in a 470 ohm resistor between data and DIN, but that didn't do anything different.

When I use one of the other pins, nothing seems to light up, even if I disconnect all pins and hit reset. Here is my wiring:

Don't mind the actual 3v -> 5v. It works fine with 3v. I have also tried powering it off externally. I have tried all other pins from D0 to D7 (I saw many people say "STAY AWAY FROM PIN D8"). Could my ESP8266 be dead on arrival?

  • How long is your strip? And have you read and understood the NeoPixel uberguide (learn.adafruit.com/adafruit-neopixel-uberguide/overview)? – Paul Dec 7 '16 at 12:09
  • @Paul 3 pixels long. NeoPixel has nothing to do with this, except I'm using their example code. It works fine on my Arduino UNO so it should work fine on this as well. – MortenMoulder Dec 7 '16 at 12:11
  • Could you hook up the 5V input from the LED strip to USB-POWER pin of the NodeMCU? – Paul Dec 7 '16 at 12:13
  • @Paul There is no 5v USB-POWER pin. VIN doesn't provide 5v. Even if I hook it up externally to 3.3v or 5v, the LED strip won't work. – MortenMoulder Dec 7 '16 at 12:14
  • Hmm, I have a NodeMCU board that has an 5V usb pin, don't get why they shouldn't break that out, since it's an useful pin. – Paul Dec 7 '16 at 12:15
5

So here comes my solution: I was playing around with NeoPixelBus by Makuna and the examples. I noticed in one of his examples, it said:

// You can also use one of these for Esp8266,

// each having their own restrictions

//

// These two are the same as above as the DMA method is the default

// NOTE: These will ignore the PIN and use GPI03 pin

//NeoPixelBus<NeoGrbFeature, NeoEsp8266Dma800KbpsMethod> strip(PixelCount, PixelPin);

So I tried outcommenting that line and used that instead, and then it worked! I've always used Neo800KbpsMethod whenever I saw NeoPixelBus being used, because that was what other people did. Notice it also said:

These will ignore the PIN and use GPI03 pin

That pin is the RX pin on my board. No other example I have seen, has used the RX pin on the board.

After 6+ hours of constant troubleshooting, I can finally power on my strip and control each LED!

  • The Adafruit library uses direct port manipulation. It doesn't totally surprise me that trying to run this on another chip doesn't work as expected. I did a small library that uses the SPI hardware for a simple implementation (no assembler). However that also only works on a single pin - the one that supports SPI output on the Atmega328P. – Nick Gammon Dec 8 '16 at 20:24
  • I believe the Adafruit libraries have defines for specific implementations on Arduino and the ESP8266. However, since the timing is so strict, it may just be a little off on your specific board (and just right with the other options enabled). Also mind that ESP8266 pin numbering isn't the same as the Arduino numbering (and maybe even specific to your board). You may still want to consider using another type of (spi based) ledstrips in the future, since it's easier, less dependable/flimsy, more tweakable and much more cross platform. – Paul Jan 6 '17 at 20:48
1

Ok i got it working after banging my head for couple of days, i was using a Node MCU Board V3, the pin number on board were D1 D2 D3 D4 etc all other library when data was connected to D4 in code where we specify the pin number we use to write D4.

However for FASTLED codes tbe code you need to write is just 4 without the letter D and when i did the same it just worked like magic

0

Please read and understand the manual

You say it works on an Arduino, a big difference between the Uno and ESP8266 is the voltage (and voltage regulators).

Another difference is the chip/architecture itself.

So that leads to having to debug these two factors.

Debug the power/circuit/voltage

Please check if the 3V pin of your particular dev board can supply the current for the 3 LED's. Alternatively you can try by using another 5V power supply, or the 5V from your USB or (Arduino, since that did work) to try and power the LED's.

Another problem may be that the voltage will slowly go down over the length of the strip. Your strip is small, though you also power it from 3V, increasing the effect. You can try to power it on multiple points, or from the middle.

Try using a logic level shifter to increase the logic output pin from 3V to 5V, it may not be sufficient to transmit the data. This usually isn't a problem, but you should exclude this possibility.

The guide also shows some peculiar things regarding the wiring. They say you should use a capacitor between the + and - lines. I don't see how that can fail, but you may aswell try.

Also doublecheck the wiring, maybe some connector is a little loose. I've also had problems with LED strips that have been bent, the copper may come loose from the strip, or the strip may get teared a little.

You should also check with another piece of LED strip, just to be sure.

Debug the controller

It works on the Arduino, but not the ESP8266, and we have checked that it's not due to the voltages/power.

The NeoPixels have pretty strict timing, I would actually advise anyone to NOT use them. Since you can't write to the strip "pixel by pixel", you'll have to put the whole strip in memory, and then send it all at once.

Other SPI based LED strips can receive the pixels one by one, like streaming. So you can simply make a loop that sets a color and sends it (while slowling increasing color, to make an virtually infinite rainbow effect). The cool thing is that it even doesn't block interrupts from happening. (Neopixels disable interrupts, need 3 bytes per pixel, and can't do calculations between sending)

If you still want to use NeoPixels, there may be a timing issue. You can check at which clock speed you've set the ESP8266.

Also are you using ESP show with the right "is800KHz" option? espShow(pin, pixels, numBytes, is800KHz);

You may also try another ESP8266 from another manufacturer, to be sure that it's not the board. They may have used a crystal that isn't as accurate as it should be.

  • 1
    I am 1000000% sure the voltage is not the problem. When powering the strip from the ESP8266, but getting the data from my Arduino, it works perfectly. I did specify the 800 KHz when setting up the NeoPixelBus (using NeoPixelBus example, for instance). The problem is this: Everyone who has guides on how to set this up, does nothing but grab an example and change to the correct pin. I did that. I did exactly what they did. I have the exact same pinout as them, so I expect the boards are somewhat similar (same MHz clock, same board type, etc.). – MortenMoulder Dec 7 '16 at 12:56
  • From practice, when your expected results do not manifest .. isolate and go back to basics, test on a known working strip/board, test 3V/5V, read the available options .. as @MortenMoulder mentioned the trick was the NeoPixelBus lib and the specific RX pin – farinspace Dec 5 '17 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.