0

I am working on ws2815 led strip with the esp8266 on arduino 1.6.6 fast led library.Using CD40109B level shifter to convert 3.3V of esp output to 12V .It's working fine upto 31 leds according to the program pattern if i increase the led count it's giving random pattern .What can be the issue. This is the code that i am using

#include <FastLED.h>
#define LED_PIN     5
#define NUM_LEDS    50

CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2813, LED_PIN, GRB>(leds, NUM_LEDS);
}

void loop() {
  for (int i = 0; i <=NUM_LEDS ; i++) {
    leds[i] = CRGB (255,0 , 0);
    FastLED.show();
    delay(40);
  }
  for (int i = NUM_LEDS; i >= 0; i--) {
    leds[i] = CRGB ( 0, 255, 0);
    FastLED.show();
    delay(40);
  }
}

EDIT We checked in oscilloscope and we observed that after internal signal reshaping of the ws2815 IC ,the RGB values are not as intended.This is also seen on the led strip with changing colour of the leds. We are trying to generate a single colour on the strip so this colour changing is quite clear.


The current rating of the power supply I am using is 12.5A, which is enough to drive the LEDs, and the voltage is also 12V at the 32nd LED.

migrated from electronics.stackexchange.com Jan 11 at 14:49

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • 1
    The voltage levels needed for the WS2815: see the datasheet. Your question is inconsistent. You ask about voltages in the subject but in the text you mention averything is fine up to 31 LEDs. So what makes you think the voltages are not OK? The LEDs work so the voltages must be OK. How about there being something unexpected happening in the program? – Bimpelrekkie Jan 10 at 12:25
  • @Bimpelrekkie That's what i am confused .previously i was worked on ws2812, after using level shifter it worked fine but not sure what is causing the problem to this one. – ilyas Jan 10 at 12:32
  • Well then it's not the voltage, is it? Note that 31=2^5-1 and 32=2^5. My hunch is there is some part of your code that is hard-coded for less than 2^5 bits or uses a 5-bit field for some important value. – Elliot Alderson Jan 10 at 13:04
  • 2
    If this code worked for other kinds of LEDs, you were just lucky. You've committed the common error of writing beyond the end of your array, in both of your for() loops. The last location in leds[] is NUM_LEDS-1, not NUM_LEDS. It sounds like you finally got unlucky and started clobbering something important. It isn't too surprising that this occurs at a power-of-2 boundary. – Dave Tweed Jan 10 at 14:54
  • 1
    Well, the code in your question still shows the error. How did a simple copy-paste operation create an error like that anyway? If this isn't an exact copy of the code you're actually running, how are we to know whether there are any other differences? – Dave Tweed Jan 11 at 13:27

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.