Go Down

Topic: [Solved] Issue with WS2182b strip on external power. (Read 288 times) previous topic - next topic

Oopoe

Hi guys,

I've been racking my brains over this for a few days and it's getting very frustrating.

I have a basic sketch that shows a rainbow fade (original) and cycles through colours etc.

It runs perfectly on USB power from my mac. However once I hook it up to a external power supply it just won't show the right colours and sequences.

I've added two pictures of my wiring currently to show you what I'm doing. I have a 5v 2.6A power supply, with a wire going from +ve to the LED strip, and also going to the 5v pin on the Uno. The Ground also goes to the strip, and the Gnd pin on the Arduino, and finally a data pin on pin 6.

https://imgur.com/a/jzKZq

There is a 1000uF capacitor between the power supply pins.

The LEDs just flash red very aggressively when I switch the power on.

The weirdest thing is that when I remove the power supply, it appears to play the sketch correctly for half a second, as the power drains out. I can't understand why though.

Any help would be greatly appreciated.

Thank you!

larryd

#1
Sep 20, 2017, 09:24 pm Last Edit: Sep 20, 2017, 09:27 pm by larryd





Confirm the voltage is indeed 5+V, use a DVM.

Place a 4.7K resistor in series with the Data pin 6.

No technical PMs.
The last thing you did is where you should start looking.

larryd

#2
Sep 20, 2017, 09:28 pm Last Edit: Sep 20, 2017, 09:30 pm by larryd
Show us your current sketch.

Make one ground connection, do not pass GND for the strip through the Arduino PCB!


No technical PMs.
The last thing you did is where you should start looking.

Oopoe

Should I just run Ground from the strip back to the the -ve power supply?


My sketch is below:

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

#define PIN 6

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {
 


  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
 
 

  rainbow(20);
  rainbowCycle(20);
  theaterChaseRainbow(50);
}


void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
  for (int j=0; j<10; j++) {  //do 10 cycles of chasing
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, c);    //turn every third pixel on
      }
      strip.show();

      delay(wait);

      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, 0);        //turn every third pixel off
      }
    }
  }
}

//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
    for (int q=0; q < 3; q++) {
     
    }
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

larryd

#4
Sep 20, 2017, 11:39 pm Last Edit: Sep 20, 2017, 11:39 pm by larryd




No technical PMs.
The last thing you did is where you should start looking.

Oopoe

Thanks for that diagram. I just swapped those ground cables to match, but I still get the same result. I also put a resitor in line on pin 6 and no change.

Grumpy_Mike

Photograph please, it sounds like you have not done what you think you have done.
What you describe is a result of not having a common ground between strip Arduino and supply.

TomGeorge

#7
Sep 21, 2017, 10:41 am Last Edit: Sep 21, 2017, 10:46 am by TomGeorge
Hi,
Can you post a picture of your power supply please?
And its spec sticker.

You haven't answered the question , have you measured the 5V?
Do you have a DMM?

Why have you added the 1000uF cap?

Thanks.. Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

Oopoe

I added the capacitor because I've read it smoothes out the power so as not to damage the first few LEDs. I've also tried it without the capacitor and it has no change. Taken from the Neopixel Uberguide on Adafruit: https://learn.adafruit.com/adafruit-neopixel-uberguide/power

I've measured the power supply and confirmed it is 5v.

Images: https://imgur.com/a/nKn0t

Thanks


Grumpy_Mike

Lets review this. You said:-
Quote
It runs perfectly on USB power from my mac. However once I hook it up to a external power supply it just won't show the right colours and sequences.
That sort of problem always turns out to be a grounding problem or a faulty power supply. You wiring looks to be OK but you need to unplug your power supply and check for continuity along the wiring, especially the ground to check that those connectors are properly making contact. Connect one end of your meter to the strip's output ground and the other end to the unused ground connector on the Arduino next to pin 13.
Also check the contacts coming out of the power supply connector adaptor. These sometimes have an incompatible center pin size which will only make intermittent contact.

By the way to post images see image guide we don't like going off forum to see you images.

TomGeorge

#10
Sep 22, 2017, 12:12 am Last Edit: Sep 22, 2017, 12:14 am by TomGeorge
Hi,
Can you try a 0.1uF capacitor in parallel with the 1000uF cap please to add bypassing.

Also keep your LED strip and UNO away from the power supply plug pack.

Put  a 0.1uF Cap at the power wire socket of the LED strip.

You are using a switch mode power supply, it could be switching noise causing your problem.
Hence;

Quote
The weirdest thing is that when I remove the power supply, it appears to play the sketch correctly for half a second, as the power drains out. I can't understand why though.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

Grumpy_Mike

Quote
The weirdest thing is that when I remove the power supply, it appears to play the sketch correctly for half a second, as the power drains out.
That sounds like a faulty supply to me.

TomGeorge

#12
Sep 22, 2017, 12:29 am Last Edit: Sep 22, 2017, 12:31 am by TomGeorge Reason: ITE definition
HI'
That sounds like a faulty supply to me.
I agree..
What does "For I.T.E use only" mean?

EDIT: Just googled

Quote
I.T.E. = information technology equipment. Basically refers to a set of safety and other standards for a class of devices.
Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

Oopoe

Thank you all for your input and help. I managed to solve the issue. I switched out the power supply for a class 1 power supply with an active earth and it works perfectly now.

Go Up