Test NeoPixel Strip

Author Gravatar Image PHILLIP BURGESS
Let’s confirm the NeoPixel strip is 100% working before moving on.

Unplug the Arduino and remove the Data Logging Shield. We’ll return to that later, but for now we need access to the Arduino headers.

The NeoPixel library should already be installed from a prior step.

Know Your NeoPixels

IMPORTANT: pre-installed wires (if any) on the end of a NeoPixel strip don’t necessarily indicate the “input” end.

Look closely at the face of the strip for small arrows showing the data direction. It’s a little easier with 60 LEDs/meter strip, which adds “DIN” or “DI” (data in) and “DO” (data out) labels next to solder pads. The Arduino will connect to the “in” end, where the arrows are originating.

144 LEDs/meter strips always arrive in 1-meter lengths with wires pre-installed at both ends. 60 LEDs/meter strip is manufactured in longer 4-meter reels (also with wires at both ends), which are then cut when a smaller order is placed. So you might receive a strip with no wires, or there’s a 50/50 chance that the wires are really the output end. So you may have to solder on your own.
These photos show white NeoPixel strip — it’s easier to read in photographs — but you can use either the black- or white-backed type.

Running the Test

DO NOT use the NeoPixel “strandtest” example - it lights up all the LEDs which draws tons of power and could make the Arduino crash due to a 'brown out'. Instead, copy and paste the following code into a new Arduino sketch:
Copy Code
// Simple NeoPixel test.  Lights just a few pixels at a time so a
// 1m strip can safely be powered from Arduino 5V pin.  Arduino
// may nonetheless hiccup when LEDs are first connected and not
// accept code.  So upload code first, unplug USB, connect pixels
// to GND FIRST, then +5V and digital pin 6, then re-plug USB.
// A working strip will show a few pixels moving down the line,
// cycling between red, green and blue.  If you get no response,
// might be connected to wrong end of strip (the end wires, if
// any, are no indication -- look instead for the data direction
// arrows printed on the strip).

#include <Adafruit_NeoPixel.h>

#define PIN      6
#define N_LEDS 144

Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800);

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

void loop() {
  chase(strip.Color(255, 0, 0)); // Red
  chase(strip.Color(0, 255, 0)); // Green
  chase(strip.Color(0, 0, 255)); // Blue
}

static void chase(uint32_t c) {
  for(uint16_t i=0; i<strip.numPixels()+4; i++) {
      strip.setPixelColor(i  , c); // Draw new pixel
      strip.setPixelColor(i-4, 0); // Erase pixel a few steps back
      strip.show();
      delay(25);
  }
}
Edit the N_LEDS value to reflect the actual length of your NeoPixel strip.

Upload this code to the Arduino Uno, disconnect the USB cable, then we’ll connect the strip.

A wiring diagram is not provided…this is on purpose! Different types of LED strips have their connections in a different order, and the manufacturer sometimes makes changes to the design. Impulsively following a picture (rather than reading a description) increases the chance of an improper hookup and a damaged strip!

Make the following three connections:
  • GND from Arduino to GND or on strip (always connect GND first)
  • 5V from Arduino to +5V or + on strip
  • Pin 6 from Arduino to DIN (or unmarked input) on strip
Lay the strip out flat so you can see the entire thing, then re-connect the USB cable. You should see a few LEDs chasing down the length of the strip, cycling between red, green and blue. Watch carefully, noting any skipped or off-color pixels.

Nothing lights up!

  1. If the computer reports a USB device is drawing too much power, unplug the Arduino immediately.
  2. If there are extra wires at either end of the strip, make sure the tips are not touching each other or anything conductive.
  3. Confirm the three connections between the strip and Arduino: GND, +5V and pin 6.
  4. If you soldered wires on, make sure there’s no cold joints or solder bridges between adjacent pads.
  5. Make sure you’re connected to the INPUT end of the strip.
  6. Check the USB cable is properly seated between the Arduino and computer or powered USB hub.
If you have a multimeter, check the voltage across +5V and GND at the OUTPUT end of the strip. It should be around 5 Volts.

The lights cut out part way down the strip.

Confirm the value of N_LEDS in the code matches the actual NeoPixel strip length.

One or more pixels won’t light up, or show the wrong color.

Possibly defective pixel(s). Read on…
If you encounter any of these problems (or others), search the Adafruit Customer Support Forums for similar issues and their resolutions. If your situation is not addressed, make a new post with a description of the problem and (if possible) a clear photo showing the wiring between Arduino and NeoPixels. We’ll help troubleshoot the problem or have a replacement sent if needed.

Can I use more (or fewer) than 144 pixels?

Certainly! But there’s an upper limit of 170 pixels. This is the maximum that can be recorded in one SD card block (512 bytes). Going beyond this would require reading two (or more) blocks and would halve the speed of the entire system…you’d have to move at a snail’s pace when taking photos.

You’re welcome to hack it up and try, but the code will need significant changes, and there’s no guarantee the Arduino even has enough free RAM to handle this.
Do not proceed until you have a fully tested and working NeoPixel strip. Once the strip is glued to the painting wand, it will be really really hard to fix any wiring problems
Last updated on 2015-03-27 at 08.09.47 AM Published on 2013-12-10 at 03.50.52 PM