Hello!
I'm working on some fun Arduino Christmas presents for my family in the form of LED-lit acrylic signs. I'm encountering an issue in which the project works perfectly fine when powered via USB, but seems to have issues when using any other power source. I've got a very short strip of 5x WS2812B LEDs, which I'm powering from the 5V pin on the Nano itself. The power supplies I am using are variable, I can switch from 5, 6, 7.5, 9, and 12 Volts. It can supply up to 2.5 A so I wouldn't imagine the power is lacking. I have limited space to work with in the enclosure I designed, so I am powering the nano using the VIN pin. The Nano seems to be receiving the power fine, but the lights are not operating as they should. Pending on the voltage I select on the DC Power Supply, they act differently. At 5V They do nothing, at 12V they flicker and attempt the "breathing" animation which I put in the code. Again, the lights and the "breathing" animation seem to be perfectly fine when I power it via USB. I have tried switching the Power supply to 5v and powering the lights as well as the Nano rather than powering the lights from the 5v pin on the board itself, that does nothing at all. I have very limited space to work with so I don't believe I would be able to crank the voltage from the Power Supply up to the Arduino and use a buck converter to lessen the voltage and direct line into the LEDs. Is there perhaps something simple I am missing? I'd appreciate any help/feedback.
Thanks!
#include <FastLED.h>
#define NUM_LEDS 5
#define DATA_PIN 2
int r = 0;
int g = 0;
int b = 255;
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812, DATA_PIN>(leds, NUM_LEDS);
Serial.begin(9600);
}
void loop() {
for (int c =0; c < 255; c++){
for (int i = 0; i < NUM_LEDS; i++){
leds[i] = CRGB(r,g,b);
FastLED.show();
delay(5);
if (r < 255){
r++;
}
if (g < 255){
g++;
}
}
}
for (int c =0; c < 255; c++){
for (int i = 0; i < NUM_LEDS; i++){
leds[i] = CRGB(r,g,b);
FastLED.show();
delay(5);
if (r > 0){
r--;
}
if (g > 0){
g--;
}
}
}
}