adafruit / Adafruit_NeoPixel

Arduino library for controlling single-wire LED pixels (NeoPixel, WS2812, etc.)
GNU Lesser General Public License v3.0
3.04k stars 1.26k forks source link

Arduino Due and WS2811 #311

Open danooooo11 opened 2 years ago

danooooo11 commented 2 years ago

Hi, I want to run simple project using Arduino Due and WS2811 LED strip 12V (1 segment = 3 LED) and im just not able to make it. No example program works for me, even if compilation ends with no error, no LED ever light. I just want to verify the compatibility Adafruit_Neopixel vs Arduino Due, becase in forums i cant find any reliable answers. So is really Arduino Due not compatible with your library? Beause if so, i have to buy Arduino Mega and continue in work with it. Many Thanks, Daniel

Board : Arduino Due (original) Adafruit_Neopixel Release: 1.10.3 Arduino IDE version: 1.8.19

ottobonn commented 2 years ago

It looks like the Due (using the ATSAM3X8E) is explicitly supported, so something else might be going wrong.

Here is the code that runs for the Due:

https://github.com/adafruit/Adafruit_NeoPixel/blob/b60a439aee6b9482a778e20e33faeddf01d573bb/Adafruit_NeoPixel.cpp#L2848

ottobonn commented 2 years ago

You mentioned that you are running the strip at 12V, so the WS2811 chips will derive their logic level voltage from that somehow. As far as I can tell, they operate at 5V logic levels, but note that the Due uses 3.3V logic levels. You might try reducing the supply voltage to the LEDs to see if the problem is that the logic levels are too low. See e.g. this part of the guide: https://learn.adafruit.com/adafruit-neopixel-uberguide/powering-neopixels#driving-5v-neopixels-from-3-dot-3v-microcontrollers-2894497-24

I am having trouble finding details on how the WS2811 regulates its voltage. From the datasheet (page 5, application circuit 2), it looks like it has an internal LDO regulator with a voltage-select resistor connected to 12V, with a value of 2.7K. It's possible that reducing the 12V supply will also reduce the logic gate supply of the WS2811, which could help it speak 3.3V, but I am not sure. It's also possible that it will maintain 5V even if you reduce its supply, in which case you would need a level shifter for a 3.3V chip to talk to it.

Did you already confirm the basics, like the circuit has a common ground, the pins are selected correctly, etc?

ottobonn commented 2 years ago

See also https://hackaday.com/2017/01/20/cheating-at-5v-ws2812-control-to-use-a-3-3v-data-line/, linked from other issues here

danooooo11 commented 2 years ago

Hi ottobonn, yes, I am using Pin 6 (PWM) for sending data to LED Strip DIN and yes, circuit has a common ground. Just like you said, it should work, but it doesnt.

Here is my super simple example :) maybe i have got some error there and i dont see it :|

#include <Adafruit_NeoPixel.h>
#define PIN         6 // PWM pin
#define NUMPIXELS   7 // 7 segments of 3 LED, so 21 LED in total (WS2811)
Adafruit_NeoPixel pixels = Adafruit_NeoPixel (NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin();
}

void loop() {
  pixels.setPixelColor(2, pixels.Color(200, 0, 0));
  pixels.show();
  delay(1000);
}

I will probably try Arduino Mega :/