0

we are still having trouble with our LED strip. We fixed the library issue, and are now trying to program the LED's but have run into a few issues. 1) First of all, our LED strip does not consistently light up. We are using a 12v battery and everything is wired correctly, but how the LED's appear is very inconsistent. Not all of them light up, they are all different colors, and are all of varying brightness. We have tried to resolve this by just powering it with the battery, using our arduino as a power supply, and added a 1000uf capacitor to make sure the strip doesnt get a surge of power and short the strip. Our code is this:

 /*  Arduino Tutorial - How to use an RGB LED Strip
  Dev: Michalis Vasilakis // Date 3/6/2016 // Ver 1.0
  Info: www.ardumotive.com                */

//Library
#include <Adafruit_NeoPixel.h>

//Constants
const int dinPin = 4;    // Din pin to Arduino pin 4
const int numOfLeds = 10; // Number of leds

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(numOfLeds, dinPin, NEO_GRB + NEO_KHZ800);

// Color takes RGB values, from 0,0,0 up to 255,255,255
// e.g. White = (255,255,255), Red = (255,0,0);
int red = 255;    //Value from 0(led-off) to 255(). 
int green = 0; 
int blue = 0;


void setup() {
  pixels.begin(); // Initializes the NeoPixel library
  pixels.setBrightness(100); // Value from 0 to 100%
}

void loop() {
  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
  for(int i=0;i<numOfLeds;i++){
    pixels.setPixelColor(i, pixels.Color(red,green,blue)); 
    pixels.show(); // This sends the updated pixel color to the hardware.
    delay(10);   // Delay for a period of time to change the next led
  }
}

We are trying to set all the LED's to red just to test the code, but nothing is working. Has anyone experienced this before or has any idea of what is not working?

Mikeb
  • 1
  • Have you used a multimeter to check that the pins are activating properly? This is a debugging problem. – tadman Mar 20 '17 at 17:08
  • @Mikeb what LED strip are you using (e.g. what's the chipset used by the LEDs) ? – George Profenza Mar 20 '17 at 17:11
  • 1
    WS2812B addressable RGB LEDs (aka NeoPixels) are 5V. How are you powering them with 12V? You need to show us your wiring, but debugging your wiring is not programming related and therefore off-topic. – gre_gor Mar 20 '17 at 17:20

1 Answers1

0

99% of the time this happens when you haven't tied the ground of the LED strip to the ground of the Arduino and the ground of the power supply.

Joel Spolsky
  • 33,372
  • 17
  • 89
  • 105