3
\$\begingroup\$

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

  1. turn on only a chosen subset of lights at one time, or
  2. 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!

\$\endgroup\$
  • \$\begingroup\$ Use a dedicated 5V/USB power supply, bypassing the linear regulator on the arduino. Also add a capacitor 1000uF or so at the beginning of the led strip, to help smooth any issues from inrush current. \$\endgroup\$ – Passerby Nov 25 '15 at 22:28
  • \$\begingroup\$ The bias towards red, if it means the red is brighter, could suggest the voltage is dropping when the leds turn on. How are you powering your arduino. \$\endgroup\$ – Passerby Nov 25 '15 at 22:30
  • \$\begingroup\$ @Passerby: I've tried USB, 9V battery, and both. It looks like most of the LEDs are completely red, and there are a few that are other colors. Should I use the Vin pin? \$\endgroup\$ – Zaz Nov 25 '15 at 22:34
  • \$\begingroup\$ If you are using VIN or the dc jack, it turns off usb and goes through the regulator. A 9V battery will be especially bad. Use a USB or connect a Regulated 5V power supply to the 5V with 1Amp or better supply. \$\endgroup\$ – Passerby Nov 25 '15 at 22:36
  • \$\begingroup\$ @passerby: he says the full LED strip wants 3.3 amps, so he'll need a 5 volt supply capable of 4 Amps or more to power both the Arduino and the LED strip. The LED strip's power should come directly from the power supply, not throught the Arduino. \$\endgroup\$ – Peter Bennett Nov 25 '15 at 22:59
2
\$\begingroup\$

While it's not possible to turn all the LEDs on max brightness without extra power, the main problem was that I hadn't realized that Pololu sells 2 almost identical 0.5m LED strips, and I was reading the instructions for the other variant.

Now that I'm sending instructions using the correct protocol everything works fine as long as I limit the number of LEDs I turn on.

Sorry for the mistake.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.