Adafruit Neopixel Library [PORTED]


#41

Thanks @jagor for all the interesting hints!

Using DMA with SPI for WS2812 would need 8 bytes per bit, and this times 24 times 240 for one strip would be a lot (too much) of buffer space. I hoped it could be possible to install a transfer complete interrrupt (TCI) routine with higher IRQ priority than the spark core IRQs that take > 50µS, to pre-process data in smaller chunks.

The OctoWS2812 approach is interesting, however only makes sense if one really has multiple LED strips. For a single strip we’d be back at the 8 bytes per WS2812 bit problem.


#42

The code works great, no more flickering. Great job

Do you have any suggestion on how to prevent that the b/g code doesn’t runs on time ?
I would like to choose the color effects through a POST API function but it hangs after first post.


#43

Thanks @rudyvan! Right now I don’t have a good opinion on how delayed the b/g tasks might be. I think most of it stems from truly blocking the main loop() by calling something like the rainbow() method with a wait time of 50ms or more. This will cause a delay in the main loop for >12.8 seconds.

One way to fix that is to allow your main loop() to run either as fast as it can, or at some fast interval like 10ms.

@carldanley and I have been working on an example that does just that, and will allow for some cool sequencing control from the cloud. Carl has been doing all of Class implementation and I just kind of throw stuff at him while he’s coding… heh heh, kidding! So far it’s looking very cool… .stay tune for an example soon!


#44

Anyone working on a port of the Adafruit GFX and Matrix libraries for Neopixel?


#45

Not so far, though I’m not sure what @BDub has up his sleeves; he tends to have something for everything =P I’d be interesting in helping out if I can though I think this warrants a new forum thread.


#46

@rudyvan the POST API works fine for me, even with blocked interrupts during show(). I have 240 WS2812 chips connected. So I guess it’s not the blocked IRQ that makes your core hang after the post, but some other problem.


#47

@luz thanks for the feedback. I also tested the POST API with your code, which works great, It did not hang but unfortunately it didn’t do what I wanted.
Would you mind sharing your POST API example ?

Will you be working on porting OctoWS2812 ? that would be great if it could run on :spark:
Thanks


#48

Just looked at the library for:
http://www.pjrc.com/teensy/td_libs_OctoWS2811.html

Wow, it’s made to look super simple! Not too clear how easily that would work with all the background tasks that the :spark: Core runs currently, but if the CC3000 were turned off… I’m guessing the door is open for some crazy fast LED controlling.


#49

Just adding my voice here @BDub - thanks!


#50

Noob Question Time:

Will the neopixel library work with the WS2812B RGB LED strips? For example, this one:

LINK

I believe Adafruit is transitioning to the WS2812B LED’s but I didn’t know if the current Library would work. The major reason I’m looking at these instead of the actual Neopixels is because I have a eBay store credit I can use.


#51

Yes. Judging from the datasheets and this document - https://www.mikrocontroller.net/attachment/180460/WS2812B_VS_WS2812.pdf

  • The WS2812B is just an improved brightness/layout version of its non-B counterpart. The internal IC is pretty much the same. I would be very surprised if a substantial change between assumed drop-in replacements has occurred, so the library should work fine.
    EDIT Adafruit’s neopixels and all the ones I have now from recent orders are all now the B, and the libraries still work, so go right ahead!

#52

My buddy has a strip of 30 WS2812B’s and tested the library out… said it worked flicker free. I’ve actually looked at the specs and the way the timing is on in the library now, it falls within the tolerance of the WS2812B so it should work for you! If I start hearing reports of it not working, I’ll make a custom build timing dead center to the 'B’s specs.


#53

@Thetinkerer @BDub - You guys rock. I must say this community is one of the best I’ve ever seen for ANY product, and I really appreciate all the help.


#54

I love it too. Everyone’s so helpful, friendly, and very professional. It’s perfect!


#55

Hey,
How do a noob like me use the neopixel library in the Spark IDE web?
Is there a full example for like a neopixel strip and 60 LEDs?


#56

Hi @parstalberg, just copy/paste this into your Spark IDE https://raw2.github.com/technobly/SparkCore-NeoPixel/master/SparkPixel.cpp

Then change this:
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN);

To:
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN);

Hook up your external power supply to your V+ and V- on your strip, connect the V- to the spark core’s GND, and connect the Spark core’s D0 to your Data In on your strip.

Flash, and have fun!


#57

I’m about to buy the 8x8 Neopixel grid. Do I need to also use a logic level converter to get the Spark Core’s 3.3V output pin signal up to 5V? Adafruit’s best practices seems to say that I do.


#58

Technically, yes. The datasheet says a logic level high is minimum 0.7 x VCC, so if you are powering from 5V supply, that’s about 3.5V for logic level high. However, in practice I’ve seen it work powered from the Core’s VIN pin (which is about 4.8V so logic high would be 3.36V). Since you are placing an order… you might as well get this: http://www.adafruit.com/products/757

Now adafruit recommends the 74HCT245, but it has the same input logic level high requirements as the Neopixel does… and they don’t even sell the HCT, they sell the LVC which is meant for converting 5V to 3.3V, not 3.3V to 5V (which is what you want).

The I2C safe level shifter is bi-directional, so connect the HV pin to 5V, the LV pin to 3.3V, grounds to ground, and connect A1 to your Spark Core digital output, and B1 to the NeoPixel Data Input.


#59

Thanks, Dubs! I’ll use that level converter.


#60

Is anyone else having problems with the flickering? I’m running off of VIN and GND, Data is on D0, and it’s direct copy and paste of the library. Every transition my neopixels start a weird rainbow on crack flicker then clear up for a second. Then it transitions colors and freaks out again.