Before assembling everything, let’s give the NeoPixel strip a test run. If there’s a problem, it’s easier to request help or an exchange now than with an assembled project.
If you’re not already using the Adafruit_NeoPixel library for Arduino, download and install this first. We have a guide for proper library installation.
If you’re not already using the Adafruit_NeoPixel library for Arduino, download and install this first. We have a guide for proper library installation.
After installing the library and restarting the Arduino software, copy and paste the code below into a new Arduino sketch.
DO NOT use the NeoPixel “strandtest” example for this test! It lights all the LEDs at once — more power than USB can handle. The code below is designed to light only a few LEDs at a time, so we can use the Arduino’s 5V or VIN pins.
If you have an Arduino Uno (or similar) around, use that for NeoPixel testing. Not mandatory, but the headers make for easy jumper wire connections.
DO NOT use the NeoPixel “strandtest” example for this test! It lights all the LEDs at once — more power than USB can handle. The code below is designed to light only a few LEDs at a time, so we can use the Arduino’s 5V or VIN pins.
If you have an Arduino Uno (or similar) around, use that for NeoPixel testing. Not mandatory, but the headers make for easy jumper wire connections.
// Simple NeoPixel test. Lights just a few pixels at a time so a // long 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 -- look for the data // direction arrows printed on the strip. #include <Adafruit_NeoPixel.h> #define PIN 6 #define N_LEDS 240 // 4 meter reel 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); } }
Upload this code to the Arduino board, then unplug USB and make the following three connections:
Lay the strip out flat so you can see the entire thing, then re-connect the USB cable. After a few seconds, 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.
-
GND from Arduino to GND or – on strip, usually a black wire (always connect GND first).
-
VIN from Arduino to +5V or + on strip (usually a red wire).
-
Pin 6 from Arduino to DIN (or unmarked input) on strip (usually a white wire).
Lay the strip out flat so you can see the entire thing, then re-connect the USB cable. After a few seconds, 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!
- If the computer reports a USB device is drawing too much power, unplug the Arduino immediately.
- Make sure the extra wires at either end of the strip are not touching each other or anything conductive.
- Confirm the three connections between the strip and Arduino: GND, +5V and pin 6.
- If using an Arduino Leonardo or Mini, it takes about 10 seconds when USB is connected before the sketch actually runs. Be patient.
- If you soldered any connections, make sure there’s no cold joints or solder bridges between adjacent pads.
- Make sure you’re connected to the INPUT end of the strip.
- Check the USB cable is properly seated between the Arduino and computer or powered USB hub.
The lights cut out part way down the strip.
Confirm the value of N_LEDS in the code matches the actual NeoPixel strip length.
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.
Do not proceed until you have a fully tested and working NeoPixel strip.
Text editor powered by tinymce.