Author Topic: Adafruit neopixel library  (Read 5065 times)

crx091081gb

  • Newbie
  • *
  • Posts: 7
Adafruit neopixel library
« on: March 27, 2014, 08:51:48 am »
Has anyone had any luck with the Adafruit neopixel library? I'm getting no joy, the code compiles but the LEDS don't work. Reading through the library it seems heavily CPU speed / core dependent and I'm surprised it compiles at all which makes me wonder what the digix is presenting itself as to the compiler.


gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Adafruit neopixel library
« Reply #1 on: March 27, 2014, 10:20:41 am »
I just compiled the strandtest example from the most current Adafruit-library without any problems.
I only changed the strip-length down to 16, as I had no longer strip within reach.
Make sure, that you source the LED-strip from a sufficient external power-source.


MichaelMeissner

  • Full Member
  • ***
  • Posts: 166
Re: Adafruit neopixel library
« Reply #2 on: March 27, 2014, 10:32:22 am »
I must admit, I haven't actually done anything with my DigiX yet.  I need to get back to that.  But I do Neopixels with other 3.3v processors (namely the Teensy 3.0).

What may be going is a voltage issue.  WS2812/WS2812B's really need/want 5v, and if you turn on all 3 LEDs, it can consume 60mA of power, which is more than the microprocessors can deliver.  So, you can't just put out the normal power rail from your DigiX and have it work (in most cases).  Generally, you want to have a separate power supply to the neopixels, and cross connect the grounds.  Now, on my Teensy, I can power 1-2 rings from the VIN pin, providing I don't let the light intensity get too high.  On the other hand, I made a mistake with one of my digisparks, and hooked up the 5v pin (not the VIN pin), and I let out the magic smoke.

Now, many of the older neopixels can be powered by 3.7v lipo battery used by 3.3v processors (like Gemma),but it is not really guaranteed.  Of the various neopixels that I have, the 24 LED ring from Adafruit CANNOT be powered by a 3.7v lipo battery.  I need 5v.  Now that ring is happy being signaled from a 3.3v processor like the Teensy or Gemma.  I suspect that the newer controller in WS2812B lightis more picky than the previous WS2812 lights, and with newer strips, you will need 5v of power.

In watching the various neopixel discussions, particularly over at adafruit, there are some strips that are nicknamed 'grumpy' strips, that will not fire unless they get a 5v signal.  So you need to do a level converter.  The only level shifter that seems to work flawlessly for neopixels on grumpy strips is the 74HCT245.  Here is the article about the level shifters: http://happyinmotion.com/?p=1247.  That article does say, the DSS Circuits TXS-0102 shifter does work for most small number of lights: http://dsscircuits.com/index.php/i2c-level-converter

In addition, the adafruit uberguide for neopixels is continually updated as people find more issues.  The usual things suggested are a big capacitor and little capacitor that connects tto the 5v and ground wires just before it is attached to the neopixel, use a 300-500 ohm resistor on the data line, and use level shifters: http://learn.adafruit.com/adafruit-neopixel-uberguide/best-practices

Note, I don't think the DigiX has the same kind of DMA support that the Teensy/FadeCandy have, so you would not be able to use the higher speed libraries like OctoWS11 or FASTSPI.
« Last Edit: March 27, 2014, 10:37:41 am by MichaelMeissner »

crx091081gb

  • Newbie
  • *
  • Posts: 7
Re: Adafruit neopixel library
« Reply #3 on: March 27, 2014, 01:06:30 pm »
Interesting, yeh I'd put it through a 74HCT245 and it was getting a solid 5v from an external psu. I guess I need to go back to scratching my head, I was ready to blame the compiler. I think the level converter might not have been working right...

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Adafruit neopixel library
« Reply #4 on: March 28, 2014, 01:56:02 am »
Try it without level converter, that works at least with my strip.

Or just with an non inverting transistor like here!

crx091081gb

  • Newbie
  • *
  • Posts: 7
Re: Adafruit neopixel library
« Reply #5 on: March 28, 2014, 04:04:57 am »
What pin are you using, just in case that makes a difference? Do you have a resistor between the pin and the strip? Any cap across the strip power supply?

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Adafruit neopixel library
« Reply #6 on: March 28, 2014, 05:32:00 am »
pin 6 like in the example.

I connected the strip to external 5V,
GND from DigiX to external GND
and pin6 straight to the strip, as in the example!


crx091081gb

  • Newbie
  • *
  • Posts: 7
Re: Adafruit neopixel library
« Reply #7 on: March 28, 2014, 10:01:05 am »
After all that I found the problem was I'd blown the first LED in the chain. They seem a bit prone to that, chopped it off and the rest work, no level shift seems necessary. I'm going to put the resistor and cap in place that the Adafruit docs recommend.

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Adafruit neopixel library
« Reply #8 on: March 28, 2014, 10:34:15 am »
Had the same sometimes middle in the chain.  In those cases I just transplanted one LED from an unused strip to that location.  With the four-connection LEDs that is quiet easy.  With the first cutting it off is an option, when you dont have the need for a certain length of the chain.