WS2801 5050s Flicker at 5v, work fine at 4.7v?

I'm trying to figure out why my RGB led strip I bought which is clearly marked 5v flickers and freaks out when I apply 5v, but is perfectly fine at <4.7v. I'm using a benchtop power supply right now so it's okay, but I need to use a wall wart for this project.

Anyone experience this? Here's some video proof:

https://plus.google.com/u/0/107526151613209224858/posts/4b6pK4hgoT4

Please give more information on how you have it hooked up in both instances.

Makes no sense at all...

Q: Why does the voltage on your multimeter go up and down at the start of the video?

Have you tried different settings for amps on your power supply? What about a different power supply?

I should have explained the voltage readings on the DMM.. sorry for the confusion:

The leads for the DMM are loosely stuck in the bench top power supply's power-out port. So off camera (at first) I'm pressing them down to get a better contact to show a correct reading of ~4.7v AND the lights are fine. I also show the voltage out of the power supply which reads 4.7. I assure you that once the leads are fixed, the voltage reading is constant.

Then, I turn up the supply to 5v and the lights start to flicker. I pan over to show the flicker and back again to show a perfect 5v. I turn it back down and the flicker goes away.

Yes, I know it makes no sense. That is why I am here posting this.

So here is how I have it hooked up (only one instance in the video is needed to explain the effect). +5v in on the LED strip is plugged into the bread board + line which is then plugged into the power supply. Ground from the LED strip is plugged into the - line of the bread board which is plugged into the bench top power supply AND the Chipkit max32 ground.

Yellow is marked SO and is the 'MOSI' pin but I am using adafruit's bitbang (not SPI) 2 pin LED strip controller. I removed all references in the adafruit source of SPI to get it to compile in MPIDE (aka worst ide ever).

Green is clock.

Ground is shared between the arduino and the led strip.
It's not drawing too much current.
It works perfectly fine from 4.7v to 4.3v (starts to dim).
Voltage over 4.8 starts to flicker. 5v goes crazy. BUT only in the rainbow cycle.
Steady color (R,G,or B) doesn't seem to be affected.
I tried a 5v wall wart rated at 2 amps max with the same effect. I DMM'd it and it read 5.1v.

I'm guessing by the responses that no one has experienced this before?

Looks to me like lack of decoupling on the supply. Try adding extra capacitors at the end of the strip.

Are you running the Arduino and the lights off the same supply?
If so try using a USB on the Arduino.
I have run into issues with running ws2801's and the Arduino on a faulty USB, soon as I changed USB's it started working perfectly.

Arduino's like clean 5v. Grumpy's comment of a cap might also clean the source up enough also.

The arduino (max32) is powered via USB and the LEDs are powered from the power supply with their grounds connected. I am confident that current (or lack of) is not the issue.

I have read on other posts that there is a flicker issue, but no one mentioned it was because of high voltage (or correct voltage, rather). I don't have enough understanding of EE to figure out why that makes sense.

What size caps should I put? Does it matter or are we just trying to dump the extra voltage into someplace? Won't the cap eventually fill without something draining it?

Thanks in advance.

Grumpy_Mike:
Looks to me like lack of decoupling. Try adding extra capacitors.

I'm going to start calling this "Grumpy's hammer"... :slight_smile:

poodull:
The arduino (max32) is powered via USB and the LEDs are powered from the power supply with their grounds connected. I am confident that current (or lack of) is not the issue.

I have read on other posts that there is a flicker issue, but no one mentioned it was because of high voltage (or correct voltage, rather). I don't have enough understanding of EE to figure out why that makes sense.

What size caps should I put? Does it matter or are we just trying to dump the extra voltage into someplace? Won't the cap eventually fill without something draining it?

Thanks in advance.

Ws2801's are kind of picky, they can only be refreshed 1900-2000 times a second at most, and if the timing is off they wont latch the data, or they will latch randomly. If your supplied power is unstable it will affect timing. Each ws2801 also needs 24 bits.

The caps are just to smooth out the unwanted spikes produced by the supply. In your case put the largest cap you have on the + and - of the led cable. It does not have to be a permanent connection, this will rule out if it is an unclean voltage issue. The power loss inside the caps is very small.

If you have an oscilloscope handy that can also be used to find issues with your supply.

poodull:
What size caps should I put? Does it matter or are we just trying to dump the extra voltage into someplace? Won't the cap eventually fill without something draining it?

Whenever things switch on they create a sudden demand for current and this can cause localized drops in voltage in your circuits until the power supply catches up.

eg. If the +5V supply to your microprocessor is near a big string of LEDs and they all turn on, the 5V might drop down to 3V for a microseconds - enough to cause a glitch.

The capacitors are there to act like little batteries and keep the voltage up at those moments. Ceramic are best because they have fast reaction times.

Add ceramic caps to your circuit wherever there's a 5V supply to a chip. Put them as close to the chip as possible. You can also add them to close to the devices which suddenly switch on.

Won't the cap eventually fill without something draining it?

Yes that is the idea.
Read this:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

The caps are just to smooth out the unwanted spikes produced by the supply

No they are produced by the rapidly varying current drawn by the PWM of the LEDs.

Ceramic are best because they have fast reaction times.

Yes normally that is true, but in this case the problem is with large current draw in which case what is known as bulk decoupling is needed, this is done with large values the bigger the better. However a parallel smaller capacitor would no go amiss either. These strings of LEDs can often be extended and so they have access to the power terminals on both ends of the string. Add capacitors on both ends.

I'm going to start calling this "Grumpy's hammer"

:slight_smile:
Yes with all my banging on about it the topic seems neglected by beginners, so many problems are solved by good decoupling. The clues are unexpected intermittent operation and sensitivity to voltage, this one is a classic, it works at a low voltage but not a higher one where the current is that bit higher.

Okay, I'll try adding a cap at the end.

I have seen posts about flickering and adding a cap, but I have not read a scenario where my situation fits (<4.7v works, >4.7 flickers).

One thing before I try this, an engineer at work said that using a very large cap will draw a 'ton of current' from my supply, potentially causing damage when it is switched on. I was going to add a 2amp fast blow fuse on the + lead to protect the string. Is this necessary?

I'm a little suspicious of advice given in the form of 'the largest cap you have'. I'm staring at the guts of an old Agilent power supply with 4" caps I could harvest (3000uF). I would be more comfortable with a range (50, 100, 1000, 3000uF...).

Again, thanks for the help. Being specific here might help someone else who doesn't get the decoupling hints provided elsewhere.

poodull:
I have seen posts about flickering and adding a cap, but I have not read a scenario where my situation fits (<4.7v works, >4.7 flickers).

As Grumpy says...raising the voltage also raises the current (Ohm's law!)

Most novices don't have caps larger then 220uF laying around :cold_sweat:
I bought a pack of 2000uF's about a month ago and have not even taken them out of the packing....

potentially causing damage when it is switched on.

No, the power supply will almost certainly have over current protection .

I was going to add a 2amp fast blow fuse on the + lead to protect the string. Is this necessary?

No. What will it do for you? Even a fast blow fuse is too slow to protect electronics and there is nothing much to protect. If you are very nervous then put a seriese inductor in line to limit the initial surge current.

poodull:
I'm a little suspicious of advice given in the form of 'the largest cap you have'. I'm staring at the guts of an old Agilent power supply with 4" caps I could harvest (3000uF). I would be more comfortable with a range (50, 100, 1000, 3000uF...).

That's probably a bit too big... :slight_smile:

Okay, for closure here is my answer (I hate when people never follow up)

First, the caps I used (up to 470uF) never worked. The flicker wasn't better or worse. It basically had no effect. I didn't do a lot of testing, but that was the initial results and then xmas came.

So today I rewrote the adafruit ws2801 library to work with ChipMax Mega32 and DSPI. Spoiler alert: it works at 5v now. Here's what I did to fix that code:

First, the version I downloaded wouldn't compile because of a implicit type conversion in the header. The clockport and dataport variables are int32s, not int8s.

  volatile uint32_t
    *clkport  , *dataport;   // Clock & data PORT registers

Now it still won't compile in MPIDE because there are (I found via other people's gripes) AVR specific SPI calls in the show() method. But we want DSPI anyway so here's what you need to add:
//I'm being verbose because I had NO IDEA of how to do this before today.

change the #include <SPI.h> to <DSPI.h>.
Add this to the private declarations in the header to define the DSPI class

#if defined(__PIC32MX__)
  DSPI0    
    spi;
#endif

Next, fix the startSPI() method because SPI static class is now 'spi' member variable and the DSPI calls are slightly different:

void Adafruit_WS2801::startSPI(void) {

#if defined(__PIC32MX__)
  spi.begin();
  //spi.enableInterruptTransfer(); //if using spi.intTransfer()
  //spi.setBitOrder(MSBFIRST);
  spi.setMode(DSPI_MODE0);
  //spi.setClockDivider(SPI_CLOCK_DIV16); // 1 MHz max, else flicker
  spi.setSpeed(1000000); //1 MHz is default i think
#else
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE0);
  SPI.setClockDivider(SPI_CLOCK_DIV16); // 1 MHz max, else flicker
#endif
}

You'll need to change the SPI.end() call in updatePins() as well to lowercase 'spi' like so:

    if(hardwareSPI == true) 
    {    
#if defined(__PIC32MX__)
      spi.end();
#else
      SPI.end();
#endif
    }

Lastly change the show method to call spi in one whack:

  if(hardwareSPI) 
  {
#if defined(__PIC32MX__)
      //spi.transfer(pixels[i]); //old way, one byte at a time
      spi.setSelect(LOW);       //start the transfer
      spi.transfer(nl3, pixels); //new way, send array
      spi.setSelect(HIGH);      //stop the transfer
#else
    for(i=0; i<nl3; i++) 
    {
      SPDR = pixels[i];
      while(!(SPSR & (1<<SPIF)));  //These are the AVR specific SPI calls that should never be in a library like this.
    }
#endif
  }

That should be it. I might have missed a SPI to spi somewhere, but that's easy to figure out. And just for completion (and for my own lookup later on), these are the hardware specific definitions I found online (that affect me of course):

//#define  __PIC32MX__ 1 //any Chipkit PIC
//#define  __32MX320F128H__ 1 //Uno32
//#define  __32MX795F512L__ 1 //Max32
//#define  __AVR_ATmega1280__ 1 //Mega1280

And one more piece of info on the Max32: DSPI0 is NOT pins 50-53. The DSPI0 pins are in the middle of the board (J13) and numbered from left to right, top to bottom from 1, pin 3 (middle left) is clock and pin 4 (middle right) is Data Out (http://www.digilentinc.com/Data/Products/CHIPKIT-MAX32/chipKIT%20Max32_rm.pdf). That took forever to figure out because there's a ton of posts online that contradict each other.

TLDR: Caps didn't fix anything for me, even large ones. Going from bit-banging to DSPI fixed the issue entirely.