I'm working on a project to create an infinity mirror based on an Instructables tutorial. Instead of the larger analogue LED strip that the author uses, I opted for a shorter addressable LED strip that runs on 5V.
I thought I would be able to run it off the 5V port on the Arduino, but that seems not to be the case. I understand that the strip can draw up to 3.3A and the Arduino can only supply ~0.5A, but I thought it would work fine if I only turned a few lights on (each one draws ~0.05A). However many lights I program the Arduino to turn on, I always see ~10 random lights with a bias towards red.
The fact that the lights are usually red and there are ~10 of them working at any one is evidence that it is a power issue (because red is lower power and 10×0.05A = 0.5A).
Does anyone have any ideas how I can either
- turn on only a chosen subset of lights at one time, or
- supply the appropriate power to the LEDs (preferably from a battery) ?
Here's the code I'm using below, on the chance I made some stupid mistake:
/* LedStripGradient: Example Arduino sketch that shows
* how to control an Addressable RGB LED Strip from Pololu.
*
* To use this, you will need to plug an Addressable RGB LED strip from Pololu
* into pin 12. After uploading the sketch, you should see a pattern on the LED
* strip that fades from green to pink and also moves along the strip. */
#include <PololuLedStrip.h>
// Create an ledStrip object and specify the pin it will use.
PololuLedStrip<12> ledStrip;
// Create a buffer for holding the colors (4 bytes per color).
#define LED_COUNT 72
rgb_color colors[LED_COUNT];
void setup() {
}
void loop() {
// Update the colors.
byte time = millis() >> 2;
for(uint16_t i = 0; i < LED_COUNT; i++)
{
byte x = time - 8*i;
// colors[i] = (rgb_color){ x, 255 - x, x };
colors[i] = (rgb_color){ 0, 0, 0 };
}
colors[0] = (rgb_color){ 0, 0, 255 };
colors[1] = (rgb_color){ 0, 255, 0 };
colors[2] = (rgb_color){ 255, 0, 0 };
// Write the colors to the LED strip.
ledStrip.write(colors, LED_COUNT);
delay(100);
}
Thanks!