-->
Page 1 of 3

FastLED Sketch works with another board but not ESP8266

PostPosted: Fri Mar 17, 2017 11:26 pm
by UniqueIdentifier
I'm testing a known good 5M strip of WS2812B with an Arduino Uno and works perfectly. I am able to make all the lights blue or any color as well as chasing patterns,etc. Pretty basic, I agree. The end goal is a patio light set I can control via MQTT and possibly an mp3 decoder/EQ.

But when I take the same sketch, same wiring and move it over to ESP8266 (for the wifi) I get randomness. Either just LED #5 is on and green, sometimes the first 15 LED's are flickering different colors, sometimes nothing at all. I've looked around and saw references to SPI, Bitbanging, etc. But I'm not able to find a description why my Arduino Uno works and the ESP8266 does not.

Is it a library thing?
Is it because I don't have a capacitor (but Arduino works)
Or is it my error (likely)

Here is the code

Code: Select allCode: [Select]



// Verion 1 T.S  Setup


//Inclusions
#include <FastLED.h>


// Definitions
#define NUM_LEDS 300
#define LED_TYPE WS2812B
#define DATA_PIN D3
CRGB leds[NUM_LEDS];

/*
#define FASTLED_ESP8266_RAW_PIN_ORDER
#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
#define FASTLED_ESP8266_D1_PIN_ORDER
 *
 *
 */

void setup() {
  // pinMode(D3,OUTPUT);
  // Initial Array
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}

void cycle() {    //This is a single led on/off at a time creating a single movement
        for(int dot = 0; dot < NUM_LEDS; dot++) {
            leds[dot] = CRGB::Blue;
            FastLED.show();
            // clear this led for the next time around the loop
            leds[dot] = CRGB::Black;
            delay(30);
        }
}  // End cycle

void loop() {
 cycle();

// End of Loop
}


Here is a picture of how it is wired
https://www.tweaking4all.com/wp-content ... ws2812.jpg

Any ideas or recommendations?

Re: FastLED Sketch works with another board but not ESP8266

PostPosted: Sat Mar 18, 2017 7:17 pm
by gbafamily1
Could be 3.3V versus 5V logic levels. If the LEDs are powered with 5V, the data in pin should used 5V logic. If the LEDs are powered with 3.7V (for example, from a Lithium battery), 3.3V on data in pin should work.

https://learn.adafruit.com/adafruit-neo ... -practices

NeoPixelBus is optimized for the ESP8266. I am not sure if this is true for FastLED.

Re: FastLED Sketch works with another board but not ESP8266

PostPosted: Sat Mar 18, 2017 11:51 pm
by icons
yup I had the same effects,

try a 220-270 ohm resistor on digital pin instead of 470ohm, that's how I solved the problem. 480ohm is for 5v, 270ohm for 3 volts.

Re: FastLED Sketch works with another board but not ESP8266

PostPosted: Sun Mar 19, 2017 8:55 pm
by UniqueIdentifier
icons wrote:yup I had the same effects,

try a 220-270 ohm resistor on digital pin instead of 470ohm, that's how I solved the problem. 480ohm is for 5v, 270ohm for 3 volts.


Did you have the digital pin defined as Output or as a Pullup? Curious as even with a 220 ohm resister on the digital pin, i get the same output which is erratic led's pulsing. It seems as though it's a 3.3V supplied to a pixel strip that's on 5V power.