0

Facing a weird issue, that is probably something pretty simple, but I've went through ESPHome's code on Github and can't figure out.

I've wired up 5 WS2812B controllers on an ESP8266 (Wemos D1 R1), going from D1 to D5, controlling only 7 LEDs each.

I have the following code in ESPHome:

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: D1
    num_leds: 7
    rgb_order: GRB
    name: "Heat #1"

  - platform: fastled_clockless
    chipset: WS2812B
    pin: D2
    num_leds: 7
    rgb_order: GRB
    name: "Heat #2"

  - repeat this 5 times, only thing changing is D1 through D5 and the name

In ESPHome, it works fine, I can control all 5 controllers no problem, both with the HTTP server and the Home Assistant API. I had done that in ESPHome to test the hardware build, since I had ESPHome already setup and it was easy.

I want to setup some Arduino code so that I don't need to depend on ESPHome (this will be a standalone project, that broadcasts an AP and has custom logic).

I have the following sample copied from FastLED's multiple controller example:

#include "FastLED.h"

#define NUM_LEDS_PER_STRIP 7
CRGB leds0[NUM_LEDS_PER_STRIP];
CRGB leds1[NUM_LEDS_PER_STRIP];
CRGB leds2[NUM_LEDS_PER_STRIP];
CRGB leds3[NUM_LEDS_PER_STRIP];
CRGB leds4[NUM_LEDS_PER_STRIP];

void setup() {
    FastLED.addLeds<WS2812B, D1, GRB>(leds0, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, D2, GRB>(leds1, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, D3, GRB>(leds2, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, D4, GRB>(leds3, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, D5, GRB>(leds4, NUM_LEDS_PER_STRIP);
}

void loop() {
    for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
        leds0[i] = CRGB::Red;
        leds1[i] = CRGB::Red;
        leds2[i] = CRGB::Red;
        leds3[i] = CRGB::Red;
        leds4[i] = CRGB::Red;
        FastLED.show();
        leds0[i] = CRGB::Black;
        leds1[i] = CRGB::Black;
        leds2[i] = CRGB::Black;
        leds3[i] = CRGB::Black;
        leds4[i] = CRGB::Black;
        delay(100);
    }
}

With this one, I can only control 3 lights: D1, D2 and D5. I've attached a picture of what it looks like. The other 2 just stays white.

https://i.imgur.com/AQ7X0pe.jpg

I'm most likely missing something simple that ESPHome is doing that I am not. It's a long shot, but anyone has a clue?

  • is it on the same esp8266 module.board? – Juraj Sep 14 at 11:08
  • Same board, yep. I should specify that it's a Wemos D1 R1 dev kit. I don't even disconnect anything, just keep USB plugged in, flash another firmware. – jValdron Sep 14 at 12:02
  • 1
    are D pins the same pins? D1 R1 has different D pins to io pins mapping then R2 or NodeMcu (which have the same) R1: github.com/esp8266/Arduino/blob/… R2 github.com/esp8266/Arduino/blob/…. what board did you select in Tools menu? – Juraj Sep 14 at 12:29
  • @Juraj, that was totally it! Looks like my board is a d1_mini variant! Odd as it gets detected as a D1 R1. – jValdron Sep 14 at 23:04
  • so there is a big difference how the mini and the R1/R2 look like. the R2 and mini have the same pin mapping. – Juraj Sep 15 at 4:52

Your Answer

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

Browse other questions tagged or ask your own question.