Chat freely about anything...
User avatar
By UniqueIdentifier
#63876 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

#include <FastLED.h>

// Definitions
#define NUM_LEDS 300
#define LED_TYPE WS2812B
#define DATA_PIN D3


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;
            // clear this led for the next time around the loop
            leds[dot] = CRGB::Black;
}  // End cycle

void loop() {

// End of Loop

Here is a picture of how it is wired ... ws2812.jpg

Any ideas or recommendations?
User avatar
By gbafamily1
#63911 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. ... -practices

NeoPixelBus is optimized for the ESP8266. I am not sure if this is true for FastLED.
User avatar
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.